Use generated DBus proxies/adaptors

Bug: 22388998
Change-Id: Ia7c26f3e9d9d8c90bce54acc82de0d991d46797b
diff --git a/Android.mk b/Android.mk
index 035a76f..22d68c4 100644
--- a/Android.mk
+++ b/Android.mk
@@ -31,10 +31,8 @@
   # 'std::__1::vector<unsigned char>'" error when building with GCC.
   LOCAL_CLANG := true
 
-  # TODO: Remove "gen" directory once D-Bus code generation is working.
   LOCAL_C_INCLUDES += \
     $(webservd_root) \
-    $(webservd_root)/gen \
     external/gtest/include \
 
   LOCAL_SHARED_LIBRARIES += \
diff --git a/gen/libwebserv/dbus-mocks.h b/gen/libwebserv/dbus-mocks.h
deleted file mode 100644
index b6b34fa..0000000
--- a/gen/libwebserv/dbus-mocks.h
+++ /dev/null
@@ -1,52 +0,0 @@
-// Automatic generation of D-Bus interface mock proxies for:
-//  - org.chromium.WebServer.RequestHandler
-#ifndef ____CHROMEOS_DBUS_BINDING___BUILD_LUMPY_VAR_CACHE_PORTAGE_CHROMEOS_BASE_WEBSERVER_OUT_DEFAULT_GEN_INCLUDE_LIBWEBSERV_DBUS_MOCKS_H
-#define ____CHROMEOS_DBUS_BINDING___BUILD_LUMPY_VAR_CACHE_PORTAGE_CHROMEOS_BASE_WEBSERVER_OUT_DEFAULT_GEN_INCLUDE_LIBWEBSERV_DBUS_MOCKS_H
-#include <string>
-#include <vector>
-
-#include <base/callback_forward.h>
-#include <base/logging.h>
-#include <base/macros.h>
-#include <chromeos/any.h>
-#include <chromeos/errors/error.h>
-#include <chromeos/variant_dictionary.h>
-#include <gmock/gmock.h>
-
-#include "dbus-proxies.h"
-
-namespace org {
-namespace chromium {
-namespace WebServer {
-
-// Mock object for RequestHandlerProxyInterface.
-class RequestHandlerProxyMock : public RequestHandlerProxyInterface {
- public:
-  RequestHandlerProxyMock() = default;
-
-  MOCK_METHOD7(ProcessRequest,
-               bool(const std::tuple<std::string, std::string, std::string, std::string, std::string>& /*in_request_info*/,
-                    const std::vector<std::tuple<std::string, std::string>>& /*in_headers*/,
-                    const std::vector<std::tuple<bool, std::string, std::string>>& /*in_params*/,
-                    const std::vector<std::tuple<int32_t, std::string, std::string, std::string, std::string>>& /*in_files*/,
-                    const std::vector<uint8_t>& /*in_body*/,
-                    chromeos::ErrorPtr* /*error*/,
-                    int /*timeout_ms*/));
-  MOCK_METHOD8(ProcessRequestAsync,
-               void(const std::tuple<std::string, std::string, std::string, std::string, std::string>& /*in_request_info*/,
-                    const std::vector<std::tuple<std::string, std::string>>& /*in_headers*/,
-                    const std::vector<std::tuple<bool, std::string, std::string>>& /*in_params*/,
-                    const std::vector<std::tuple<int32_t, std::string, std::string, std::string, std::string>>& /*in_files*/,
-                    const std::vector<uint8_t>& /*in_body*/,
-                    const base::Callback<void()>& /*success_callback*/,
-                    const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
-                    int /*timeout_ms*/));
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(RequestHandlerProxyMock);
-};
-}  // namespace WebServer
-}  // namespace chromium
-}  // namespace org
-
-#endif  // ____CHROMEOS_DBUS_BINDING___BUILD_LUMPY_VAR_CACHE_PORTAGE_CHROMEOS_BASE_WEBSERVER_OUT_DEFAULT_GEN_INCLUDE_LIBWEBSERV_DBUS_MOCKS_H
diff --git a/gen/libwebserv/dbus-proxies.h b/gen/libwebserv/dbus-proxies.h
deleted file mode 100644
index bda3a69..0000000
--- a/gen/libwebserv/dbus-proxies.h
+++ /dev/null
@@ -1,279 +0,0 @@
-// Automatic generation of D-Bus interfaces:
-//  - org.chromium.WebServer.RequestHandler
-#ifndef ____CHROMEOS_DBUS_BINDING___BUILD_LUMPY_VAR_CACHE_PORTAGE_CHROMEOS_BASE_WEBSERVER_OUT_DEFAULT_GEN_INCLUDE_LIBWEBSERV_DBUS_PROXIES_H
-#define ____CHROMEOS_DBUS_BINDING___BUILD_LUMPY_VAR_CACHE_PORTAGE_CHROMEOS_BASE_WEBSERVER_OUT_DEFAULT_GEN_INCLUDE_LIBWEBSERV_DBUS_PROXIES_H
-#include <memory>
-#include <string>
-#include <vector>
-
-#include <base/bind.h>
-#include <base/callback.h>
-#include <base/logging.h>
-#include <base/macros.h>
-#include <base/memory/ref_counted.h>
-#include <chromeos/any.h>
-#include <chromeos/dbus/dbus_method_invoker.h>
-#include <chromeos/dbus/dbus_property.h>
-#include <chromeos/dbus/dbus_signal_handler.h>
-#include <chromeos/errors/error.h>
-#include <chromeos/variant_dictionary.h>
-#include <dbus/bus.h>
-#include <dbus/message.h>
-#include <dbus/object_manager.h>
-#include <dbus/object_path.h>
-#include <dbus/object_proxy.h>
-
-namespace org {
-namespace chromium {
-namespace WebServer {
-
-// Abstract interface proxy for org::chromium::WebServer::RequestHandler.
-class RequestHandlerProxyInterface {
- public:
-  virtual ~RequestHandlerProxyInterface() = default;
-
-  // Sends a new HTTP request to the handler.
-  // Parameters:
-  // - request_info - request metadata. Due to limitation of base::Callback
-  //                on the number of parameters, we have to collapse a couple
-  //                of distinct parameters into a larger struct, containing:
-  //                - (s) protocol_handler_id - ID of the protocol handler.
-  //                - (s) request_handler_id - ID of the registered request
-  //                                           handler.
-  //                - (s) request_id - unique ID of this request within the
-  //                                   protocol handler.
-  //                - (s) url - The request URL (e.g. "/path/object").
-  //                - (s) method - Request method (e.g. "GET", "POST", ...).
-  // - headers - Request headers (key-value pairs)
-  // - params - an array of request parameters which could be either
-  //            URL params (specified after "?" in the request URL), or
-  //            form fields in a POST request. Elements have the following
-  //            structure:
-  //            - (b) true = form field, false = URL param
-  //            - (s) field_name
-  //            - (s) field_value
-  // - files - Information about uploaded files.
-  //           The data is an array of FileInfo structures containing the
-  //           following fields:
-  //           - (i) file_id
-  //           - (s) field_name
-  //           - (s) file_name
-  //           - (s) content_type
-  //           - (s) transfer_encoding
-  //           The actual contents of the file is obtained by calling
-  //           GetFileData() on the request object
-  // - body - Raw unparsed request data. Could be empty for POST requests
-  //          that have form data/uploaded files already parsed into
-  //          form_fields/files parameters.
-  virtual bool ProcessRequest(
-      const std::tuple<std::string, std::string, std::string, std::string, std::string>& in_request_info,
-      const std::vector<std::tuple<std::string, std::string>>& in_headers,
-      const std::vector<std::tuple<bool, std::string, std::string>>& in_params,
-      const std::vector<std::tuple<int32_t, std::string, std::string, std::string, std::string>>& in_files,
-      const std::vector<uint8_t>& in_body,
-      chromeos::ErrorPtr* error,
-      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
-  // Sends a new HTTP request to the handler.
-  // Parameters:
-  // - request_info - request metadata. Due to limitation of base::Callback
-  //                on the number of parameters, we have to collapse a couple
-  //                of distinct parameters into a larger struct, containing:
-  //                - (s) protocol_handler_id - ID of the protocol handler.
-  //                - (s) request_handler_id - ID of the registered request
-  //                                           handler.
-  //                - (s) request_id - unique ID of this request within the
-  //                                   protocol handler.
-  //                - (s) url - The request URL (e.g. "/path/object").
-  //                - (s) method - Request method (e.g. "GET", "POST", ...).
-  // - headers - Request headers (key-value pairs)
-  // - params - an array of request parameters which could be either
-  //            URL params (specified after "?" in the request URL), or
-  //            form fields in a POST request. Elements have the following
-  //            structure:
-  //            - (b) true = form field, false = URL param
-  //            - (s) field_name
-  //            - (s) field_value
-  // - files - Information about uploaded files.
-  //           The data is an array of FileInfo structures containing the
-  //           following fields:
-  //           - (i) file_id
-  //           - (s) field_name
-  //           - (s) file_name
-  //           - (s) content_type
-  //           - (s) transfer_encoding
-  //           The actual contents of the file is obtained by calling
-  //           GetFileData() on the request object
-  // - body - Raw unparsed request data. Could be empty for POST requests
-  //          that have form data/uploaded files already parsed into
-  //          form_fields/files parameters.
-  virtual void ProcessRequestAsync(
-      const std::tuple<std::string, std::string, std::string, std::string, std::string>& in_request_info,
-      const std::vector<std::tuple<std::string, std::string>>& in_headers,
-      const std::vector<std::tuple<bool, std::string, std::string>>& in_params,
-      const std::vector<std::tuple<int32_t, std::string, std::string, std::string, std::string>>& in_files,
-      const std::vector<uint8_t>& in_body,
-      const base::Callback<void()>& success_callback,
-      const base::Callback<void(chromeos::Error*)>& error_callback,
-      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-};
-
-}  // namespace WebServer
-}  // namespace chromium
-}  // namespace org
-
-namespace org {
-namespace chromium {
-namespace WebServer {
-
-// Interface proxy for org::chromium::WebServer::RequestHandler.
-class RequestHandlerProxy final : public RequestHandlerProxyInterface {
- public:
-  RequestHandlerProxy(
-      const scoped_refptr<dbus::Bus>& bus,
-      const std::string& service_name) :
-          bus_{bus},
-          service_name_{service_name},
-          dbus_object_proxy_{
-              bus_->GetObjectProxy(service_name_, object_path_)} {
-  }
-
-  ~RequestHandlerProxy() override {
-  }
-
-  void ReleaseObjectProxy(const base::Closure& callback) {
-    bus_->RemoveObjectProxy(service_name_, object_path_, callback);
-  }
-
-  const dbus::ObjectPath& GetObjectPath() const {
-    return object_path_;
-  }
-
-  dbus::ObjectProxy* GetObjectProxy() const { return dbus_object_proxy_; }
-
-  // Sends a new HTTP request to the handler.
-  // Parameters:
-  // - request_info - request metadata. Due to limitation of base::Callback
-  //                on the number of parameters, we have to collapse a couple
-  //                of distinct parameters into a larger struct, containing:
-  //                - (s) protocol_handler_id - ID of the protocol handler.
-  //                - (s) request_handler_id - ID of the registered request
-  //                                           handler.
-  //                - (s) request_id - unique ID of this request within the
-  //                                   protocol handler.
-  //                - (s) url - The request URL (e.g. "/path/object").
-  //                - (s) method - Request method (e.g. "GET", "POST", ...).
-  // - headers - Request headers (key-value pairs)
-  // - params - an array of request parameters which could be either
-  //            URL params (specified after "?" in the request URL), or
-  //            form fields in a POST request. Elements have the following
-  //            structure:
-  //            - (b) true = form field, false = URL param
-  //            - (s) field_name
-  //            - (s) field_value
-  // - files - Information about uploaded files.
-  //           The data is an array of FileInfo structures containing the
-  //           following fields:
-  //           - (i) file_id
-  //           - (s) field_name
-  //           - (s) file_name
-  //           - (s) content_type
-  //           - (s) transfer_encoding
-  //           The actual contents of the file is obtained by calling
-  //           GetFileData() on the request object
-  // - body - Raw unparsed request data. Could be empty for POST requests
-  //          that have form data/uploaded files already parsed into
-  //          form_fields/files parameters.
-  bool ProcessRequest(
-      const std::tuple<std::string, std::string, std::string, std::string, std::string>& in_request_info,
-      const std::vector<std::tuple<std::string, std::string>>& in_headers,
-      const std::vector<std::tuple<bool, std::string, std::string>>& in_params,
-      const std::vector<std::tuple<int32_t, std::string, std::string, std::string, std::string>>& in_files,
-      const std::vector<uint8_t>& in_body,
-      chromeos::ErrorPtr* error,
-      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
-    auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
-        timeout_ms,
-        dbus_object_proxy_,
-        "org.chromium.WebServer.RequestHandler",
-        "ProcessRequest",
-        error,
-        in_request_info,
-        in_headers,
-        in_params,
-        in_files,
-        in_body);
-    return response && chromeos::dbus_utils::ExtractMethodCallResults(
-        response.get(), error);
-  }
-
-  // Sends a new HTTP request to the handler.
-  // Parameters:
-  // - request_info - request metadata. Due to limitation of base::Callback
-  //                on the number of parameters, we have to collapse a couple
-  //                of distinct parameters into a larger struct, containing:
-  //                - (s) protocol_handler_id - ID of the protocol handler.
-  //                - (s) request_handler_id - ID of the registered request
-  //                                           handler.
-  //                - (s) request_id - unique ID of this request within the
-  //                                   protocol handler.
-  //                - (s) url - The request URL (e.g. "/path/object").
-  //                - (s) method - Request method (e.g. "GET", "POST", ...).
-  // - headers - Request headers (key-value pairs)
-  // - params - an array of request parameters which could be either
-  //            URL params (specified after "?" in the request URL), or
-  //            form fields in a POST request. Elements have the following
-  //            structure:
-  //            - (b) true = form field, false = URL param
-  //            - (s) field_name
-  //            - (s) field_value
-  // - files - Information about uploaded files.
-  //           The data is an array of FileInfo structures containing the
-  //           following fields:
-  //           - (i) file_id
-  //           - (s) field_name
-  //           - (s) file_name
-  //           - (s) content_type
-  //           - (s) transfer_encoding
-  //           The actual contents of the file is obtained by calling
-  //           GetFileData() on the request object
-  // - body - Raw unparsed request data. Could be empty for POST requests
-  //          that have form data/uploaded files already parsed into
-  //          form_fields/files parameters.
-  void ProcessRequestAsync(
-      const std::tuple<std::string, std::string, std::string, std::string, std::string>& in_request_info,
-      const std::vector<std::tuple<std::string, std::string>>& in_headers,
-      const std::vector<std::tuple<bool, std::string, std::string>>& in_params,
-      const std::vector<std::tuple<int32_t, std::string, std::string, std::string, std::string>>& in_files,
-      const std::vector<uint8_t>& in_body,
-      const base::Callback<void()>& success_callback,
-      const base::Callback<void(chromeos::Error*)>& error_callback,
-      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
-    chromeos::dbus_utils::CallMethodWithTimeout(
-        timeout_ms,
-        dbus_object_proxy_,
-        "org.chromium.WebServer.RequestHandler",
-        "ProcessRequest",
-        success_callback,
-        error_callback,
-        in_request_info,
-        in_headers,
-        in_params,
-        in_files,
-        in_body);
-  }
-
- private:
-  scoped_refptr<dbus::Bus> bus_;
-  std::string service_name_;
-  const dbus::ObjectPath object_path_{"/org/chromium/WebServer/RequestHandler"};
-  dbus::ObjectProxy* dbus_object_proxy_;
-
-  DISALLOW_COPY_AND_ASSIGN(RequestHandlerProxy);
-};
-
-}  // namespace WebServer
-}  // namespace chromium
-}  // namespace org
-
-#endif  // ____CHROMEOS_DBUS_BINDING___BUILD_LUMPY_VAR_CACHE_PORTAGE_CHROMEOS_BASE_WEBSERVER_OUT_DEFAULT_GEN_INCLUDE_LIBWEBSERV_DBUS_PROXIES_H
diff --git a/gen/libwebserv/org.chromium.WebServer.RequestHandler.h b/gen/libwebserv/org.chromium.WebServer.RequestHandler.h
deleted file mode 100644
index 51faa52..0000000
--- a/gen/libwebserv/org.chromium.WebServer.RequestHandler.h
+++ /dev/null
@@ -1,96 +0,0 @@
-// Automatic generation of D-Bus interfaces:
-//  - org.chromium.WebServer.RequestHandler
-#ifndef ____CHROMEOS_DBUS_BINDING_______________________VAR_CACHE_PORTAGE_CHROMEOS_BASE_WEBSERVER_OUT_DEFAULT_GEN_INCLUDE_LIBWEBSERV_ORG_CHROMIUM_WEBSERVER_REQUESTHANDLER_H
-#define ____CHROMEOS_DBUS_BINDING_______________________VAR_CACHE_PORTAGE_CHROMEOS_BASE_WEBSERVER_OUT_DEFAULT_GEN_INCLUDE_LIBWEBSERV_ORG_CHROMIUM_WEBSERVER_REQUESTHANDLER_H
-#include <memory>
-#include <string>
-#include <tuple>
-#include <vector>
-
-#include <base/macros.h>
-#include <dbus/object_path.h>
-#include <chromeos/any.h>
-#include <chromeos/dbus/dbus_object.h>
-#include <chromeos/dbus/exported_object_manager.h>
-#include <chromeos/variant_dictionary.h>
-
-namespace org {
-namespace chromium {
-namespace WebServer {
-
-// Interface definition for org::chromium::WebServer::RequestHandler.
-class RequestHandlerInterface {
- public:
-  virtual ~RequestHandlerInterface() = default;
-
-  // Sends a new HTTP request to the handler.
-  // Parameters:
-  // - request_info - request metadata. Due to limitation of base::Callback
-  //                on the number of parameters, we have to collapse a couple
-  //                of distinct parameters into a larger struct, containing:
-  //                - (s) protocol_handler_id - ID of the protocol handler.
-  //                - (s) request_handler_id - ID of the registered request
-  //                                           handler.
-  //                - (s) request_id - unique ID of this request within the
-  //                                   protocol handler.
-  //                - (s) url - The request URL (e.g. "/path/object").
-  //                - (s) method - Request method (e.g. "GET", "POST", ...).
-  // - headers - Request headers (key-value pairs)
-  // - params - an array of request parameters which could be either
-  //            URL params (specified after "?" in the request URL), or
-  //            form fields in a POST request. Elements have the following
-  //            structure:
-  //            - (b) true = form field, false = URL param
-  //            - (s) field_name
-  //            - (s) field_value
-  // - files - Information about uploaded files.
-  //           The data is an array of FileInfo structures containing the
-  //           following fields:
-  //           - (i) file_id
-  //           - (s) field_name
-  //           - (s) file_name
-  //           - (s) content_type
-  //           - (s) transfer_encoding
-  //           The actual contents of the file is obtained by calling
-  //           GetFileData() on the request object
-  // - body - Raw unparsed request data. Could be empty for POST requests
-  //          that have form data/uploaded files already parsed into
-  //          form_fields/files parameters.
-  virtual bool ProcessRequest(
-      chromeos::ErrorPtr* error,
-      const std::tuple<std::string, std::string, std::string, std::string, std::string>& in_request_info,
-      const std::vector<std::tuple<std::string, std::string>>& in_headers,
-      const std::vector<std::tuple<bool, std::string, std::string>>& in_params,
-      const std::vector<std::tuple<int32_t, std::string, std::string, std::string, std::string>>& in_files,
-      const std::vector<uint8_t>& in_body) = 0;
-};
-
-// Interface adaptor for org::chromium::WebServer::RequestHandler.
-class RequestHandlerAdaptor {
- public:
-  RequestHandlerAdaptor(RequestHandlerInterface* interface) : interface_(interface) {}
-
-  void RegisterWithDBusObject(chromeos::dbus_utils::DBusObject* object) {
-    chromeos::dbus_utils::DBusInterface* itf =
-        object->AddOrGetInterface("org.chromium.WebServer.RequestHandler");
-
-    itf->AddSimpleMethodHandlerWithError(
-        "ProcessRequest",
-        base::Unretained(interface_),
-        &RequestHandlerInterface::ProcessRequest);
-  }
-
-  static dbus::ObjectPath GetObjectPath() {
-    return dbus::ObjectPath{"/org/chromium/WebServer/RequestHandler"};
-  }
-
- private:
-  RequestHandlerInterface* interface_;  // Owned by container of this adapter.
-
-  DISALLOW_COPY_AND_ASSIGN(RequestHandlerAdaptor);
-};
-
-}  // namespace WebServer
-}  // namespace chromium
-}  // namespace org
-#endif  // ____CHROMEOS_DBUS_BINDING_______________________VAR_CACHE_PORTAGE_CHROMEOS_BASE_WEBSERVER_OUT_DEFAULT_GEN_INCLUDE_LIBWEBSERV_ORG_CHROMIUM_WEBSERVER_REQUESTHANDLER_H
diff --git a/gen/webservd/dbus-mocks.h b/gen/webservd/dbus-mocks.h
deleted file mode 100644
index 9073663..0000000
--- a/gen/webservd/dbus-mocks.h
+++ /dev/null
@@ -1,116 +0,0 @@
-// Automatic generation of D-Bus interface mock proxies for:
-//  - org.chromium.WebServer.ProtocolHandler
-//  - org.chromium.WebServer.Server
-#ifndef ____CHROMEOS_DBUS_BINDING___BUILD_LUMPY_VAR_CACHE_PORTAGE_CHROMEOS_BASE_WEBSERVER_OUT_DEFAULT_GEN_INCLUDE_WEBSERVD_DBUS_MOCKS_H
-#define ____CHROMEOS_DBUS_BINDING___BUILD_LUMPY_VAR_CACHE_PORTAGE_CHROMEOS_BASE_WEBSERVER_OUT_DEFAULT_GEN_INCLUDE_WEBSERVD_DBUS_MOCKS_H
-#include <string>
-#include <vector>
-
-#include <base/callback_forward.h>
-#include <base/logging.h>
-#include <base/macros.h>
-#include <chromeos/any.h>
-#include <chromeos/errors/error.h>
-#include <chromeos/variant_dictionary.h>
-#include <gmock/gmock.h>
-
-#include "dbus-proxies.h"
-
-namespace org {
-namespace chromium {
-namespace WebServer {
-
-// Mock object for ProtocolHandlerProxyInterface.
-class ProtocolHandlerProxyMock : public ProtocolHandlerProxyInterface {
- public:
-  ProtocolHandlerProxyMock() = default;
-
-  MOCK_METHOD6(AddRequestHandler,
-               bool(const std::string& /*in_url*/,
-                    const std::string& /*in_method*/,
-                    const std::string& /*in_service_name*/,
-                    std::string* /*out_request_handler_id*/,
-                    chromeos::ErrorPtr* /*error*/,
-                    int /*timeout_ms*/));
-  MOCK_METHOD6(AddRequestHandlerAsync,
-               void(const std::string& /*in_url*/,
-                    const std::string& /*in_method*/,
-                    const std::string& /*in_service_name*/,
-                    const base::Callback<void(const std::string& /*request_handler_id*/)>& /*success_callback*/,
-                    const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
-                    int /*timeout_ms*/));
-  MOCK_METHOD3(RemoveRequestHandler,
-               bool(const std::string& /*in_request_handler_id*/,
-                    chromeos::ErrorPtr* /*error*/,
-                    int /*timeout_ms*/));
-  MOCK_METHOD4(RemoveRequestHandlerAsync,
-               void(const std::string& /*in_request_handler_id*/,
-                    const base::Callback<void()>& /*success_callback*/,
-                    const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
-                    int /*timeout_ms*/));
-  MOCK_METHOD5(GetRequestFileData,
-               bool(const std::string& /*in_request_id*/,
-                    int32_t /*in_file_id*/,
-                    std::vector<uint8_t>* /*out_contents*/,
-                    chromeos::ErrorPtr* /*error*/,
-                    int /*timeout_ms*/));
-  MOCK_METHOD5(GetRequestFileDataAsync,
-               void(const std::string& /*in_request_id*/,
-                    int32_t /*in_file_id*/,
-                    const base::Callback<void(const std::vector<uint8_t>& /*contents*/)>& /*success_callback*/,
-                    const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
-                    int /*timeout_ms*/));
-  MOCK_METHOD6(CompleteRequest,
-               bool(const std::string& /*in_request_id*/,
-                    int32_t /*in_status_code*/,
-                    const std::vector<std::tuple<std::string, std::string>>& /*in_headers*/,
-                    const std::vector<uint8_t>& /*in_data*/,
-                    chromeos::ErrorPtr* /*error*/,
-                    int /*timeout_ms*/));
-  MOCK_METHOD7(CompleteRequestAsync,
-               void(const std::string& /*in_request_id*/,
-                    int32_t /*in_status_code*/,
-                    const std::vector<std::tuple<std::string, std::string>>& /*in_headers*/,
-                    const std::vector<uint8_t>& /*in_data*/,
-                    const base::Callback<void()>& /*success_callback*/,
-                    const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
-                    int /*timeout_ms*/));
-  MOCK_CONST_METHOD0(id, const std::string&());
-  MOCK_CONST_METHOD0(name, const std::string&());
-  MOCK_CONST_METHOD0(port, uint16_t());
-  MOCK_CONST_METHOD0(protocol, const std::string&());
-  MOCK_CONST_METHOD0(certificate_fingerprint, const std::vector<uint8_t>&());
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(ProtocolHandlerProxyMock);
-};
-}  // namespace WebServer
-}  // namespace chromium
-}  // namespace org
-
-namespace org {
-namespace chromium {
-namespace WebServer {
-
-// Mock object for ServerProxyInterface.
-class ServerProxyMock : public ServerProxyInterface {
- public:
-  ServerProxyMock() = default;
-
-  MOCK_METHOD3(Ping,
-               bool(std::string* /*out_message*/,
-                    chromeos::ErrorPtr* /*error*/,
-                    int /*timeout_ms*/));
-  MOCK_METHOD3(PingAsync,
-               void(const base::Callback<void(const std::string& /*message*/)>& /*success_callback*/,
-                    const base::Callback<void(chromeos::Error*)>& /*error_callback*/,
-                    int /*timeout_ms*/));
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(ServerProxyMock);
-};
-}  // namespace WebServer
-}  // namespace chromium
-}  // namespace org
-
-#endif  // ____CHROMEOS_DBUS_BINDING___BUILD_LUMPY_VAR_CACHE_PORTAGE_CHROMEOS_BASE_WEBSERVER_OUT_DEFAULT_GEN_INCLUDE_WEBSERVD_DBUS_MOCKS_H
diff --git a/gen/webservd/dbus-proxies.h b/gen/webservd/dbus-proxies.h
deleted file mode 100644
index b129107..0000000
--- a/gen/webservd/dbus-proxies.h
+++ /dev/null
@@ -1,680 +0,0 @@
-// Automatic generation of D-Bus interfaces:
-//  - org.chromium.WebServer.ProtocolHandler
-//  - org.chromium.WebServer.Server
-#ifndef ____CHROMEOS_DBUS_BINDING___BUILD_LUMPY_VAR_CACHE_PORTAGE_CHROMEOS_BASE_WEBSERVER_OUT_DEFAULT_GEN_INCLUDE_WEBSERVD_DBUS_PROXIES_H
-#define ____CHROMEOS_DBUS_BINDING___BUILD_LUMPY_VAR_CACHE_PORTAGE_CHROMEOS_BASE_WEBSERVER_OUT_DEFAULT_GEN_INCLUDE_WEBSERVD_DBUS_PROXIES_H
-#include <memory>
-#include <string>
-#include <vector>
-
-#include <base/bind.h>
-#include <base/callback.h>
-#include <base/logging.h>
-#include <base/macros.h>
-#include <base/memory/ref_counted.h>
-#include <chromeos/any.h>
-#include <chromeos/dbus/dbus_method_invoker.h>
-#include <chromeos/dbus/dbus_property.h>
-#include <chromeos/dbus/dbus_signal_handler.h>
-#include <chromeos/errors/error.h>
-#include <chromeos/variant_dictionary.h>
-#include <dbus/bus.h>
-#include <dbus/message.h>
-#include <dbus/object_manager.h>
-#include <dbus/object_path.h>
-#include <dbus/object_proxy.h>
-
-namespace org {
-namespace chromium {
-namespace WebServer {
-class ObjectManagerProxy;
-}  // namespace WebServer
-}  // namespace chromium
-}  // namespace org
-
-namespace org {
-namespace chromium {
-namespace WebServer {
-
-// Abstract interface proxy for org::chromium::WebServer::ProtocolHandler.
-class ProtocolHandlerProxyInterface {
- public:
-  virtual ~ProtocolHandlerProxyInterface() = default;
-
-  // Adds a handler for the given |url|, and optionally request |method|.
-  // On success returns a handler ID.
-  virtual bool AddRequestHandler(
-      const std::string& in_url,
-      const std::string& in_method,
-      const std::string& in_service_name,
-      std::string* out_request_handler_id,
-      chromeos::ErrorPtr* error,
-      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
-  // Adds a handler for the given |url|, and optionally request |method|.
-  // On success returns a handler ID.
-  virtual void AddRequestHandlerAsync(
-      const std::string& in_url,
-      const std::string& in_method,
-      const std::string& in_service_name,
-      const base::Callback<void(const std::string& /*request_handler_id*/)>& success_callback,
-      const base::Callback<void(chromeos::Error*)>& error_callback,
-      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
-  // Removes a previously registered request handler.
-  // The |handler_id| is the ID returned from AddHanlder() method.
-  virtual bool RemoveRequestHandler(
-      const std::string& in_request_handler_id,
-      chromeos::ErrorPtr* error,
-      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
-  // Removes a previously registered request handler.
-  // The |handler_id| is the ID returned from AddHanlder() method.
-  virtual void RemoveRequestHandlerAsync(
-      const std::string& in_request_handler_id,
-      const base::Callback<void()>& success_callback,
-      const base::Callback<void(chromeos::Error*)>& error_callback,
-      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
-  // Returns the contents of the given uploaded file. The |file_id| parameter
-  // must correspond to the file_id member of FileInfo structure returned
-  // by |Files| property for the given |request_id|.
-  virtual bool GetRequestFileData(
-      const std::string& in_request_id,
-      int32_t in_file_id,
-      std::vector<uint8_t>* out_contents,
-      chromeos::ErrorPtr* error,
-      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
-  // Returns the contents of the given uploaded file. The |file_id| parameter
-  // must correspond to the file_id member of FileInfo structure returned
-  // by |Files| property for the given |request_id|.
-  virtual void GetRequestFileDataAsync(
-      const std::string& in_request_id,
-      int32_t in_file_id,
-      const base::Callback<void(const std::vector<uint8_t>& /*contents*/)>& success_callback,
-      const base::Callback<void(chromeos::Error*)>& error_callback,
-      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
-  // Fulfills the request with specified |request_id| and provides response.
-  virtual bool CompleteRequest(
-      const std::string& in_request_id,
-      int32_t in_status_code,
-      const std::vector<std::tuple<std::string, std::string>>& in_headers,
-      const std::vector<uint8_t>& in_data,
-      chromeos::ErrorPtr* error,
-      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
-  // Fulfills the request with specified |request_id| and provides response.
-  virtual void CompleteRequestAsync(
-      const std::string& in_request_id,
-      int32_t in_status_code,
-      const std::vector<std::tuple<std::string, std::string>>& in_headers,
-      const std::vector<uint8_t>& in_data,
-      const base::Callback<void()>& success_callback,
-      const base::Callback<void(chromeos::Error*)>& error_callback,
-      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
-  static const char* IdName() { return "Id"; }
-  virtual const std::string& id() const = 0;
-  static const char* NameName() { return "Name"; }
-  virtual const std::string& name() const = 0;
-  static const char* PortName() { return "Port"; }
-  virtual uint16_t port() const = 0;
-  static const char* ProtocolName() { return "Protocol"; }
-  virtual const std::string& protocol() const = 0;
-  static const char* CertificateFingerprintName() { return "CertificateFingerprint"; }
-  virtual const std::vector<uint8_t>& certificate_fingerprint() const = 0;
-};
-
-}  // namespace WebServer
-}  // namespace chromium
-}  // namespace org
-
-namespace org {
-namespace chromium {
-namespace WebServer {
-
-// Interface proxy for org::chromium::WebServer::ProtocolHandler.
-class ProtocolHandlerProxy final : public ProtocolHandlerProxyInterface {
- public:
-  class PropertySet : public dbus::PropertySet {
-   public:
-    PropertySet(dbus::ObjectProxy* object_proxy,
-                const PropertyChangedCallback& callback)
-        : dbus::PropertySet{object_proxy,
-                            "org.chromium.WebServer.ProtocolHandler",
-                            callback} {
-      RegisterProperty(IdName(), &id);
-      RegisterProperty(NameName(), &name);
-      RegisterProperty(PortName(), &port);
-      RegisterProperty(ProtocolName(), &protocol);
-      RegisterProperty(CertificateFingerprintName(), &certificate_fingerprint);
-    }
-
-    chromeos::dbus_utils::Property<std::string> id;
-    chromeos::dbus_utils::Property<std::string> name;
-    chromeos::dbus_utils::Property<uint16_t> port;
-    chromeos::dbus_utils::Property<std::string> protocol;
-    chromeos::dbus_utils::Property<std::vector<uint8_t>> certificate_fingerprint;
-
-   private:
-    DISALLOW_COPY_AND_ASSIGN(PropertySet);
-  };
-
-  ProtocolHandlerProxy(
-      const scoped_refptr<dbus::Bus>& bus,
-      const dbus::ObjectPath& object_path,
-      PropertySet* property_set) :
-          bus_{bus},
-          object_path_{object_path},
-          property_set_{property_set},
-          dbus_object_proxy_{
-              bus_->GetObjectProxy(service_name_, object_path_)} {
-  }
-
-  ~ProtocolHandlerProxy() override {
-  }
-
-  void ReleaseObjectProxy(const base::Closure& callback) {
-    bus_->RemoveObjectProxy(service_name_, object_path_, callback);
-  }
-
-  const dbus::ObjectPath& GetObjectPath() const {
-    return object_path_;
-  }
-
-  dbus::ObjectProxy* GetObjectProxy() const { return dbus_object_proxy_; }
-
-  void SetPropertyChangedCallback(
-      const base::Callback<void(ProtocolHandlerProxy*, const std::string&)>& callback) {
-    on_property_changed_ = callback;
-  }
-
-  const PropertySet* GetProperties() const { return property_set_; }
-  PropertySet* GetProperties() { return property_set_; }
-
-  // Adds a handler for the given |url|, and optionally request |method|.
-  // On success returns a handler ID.
-  bool AddRequestHandler(
-      const std::string& in_url,
-      const std::string& in_method,
-      const std::string& in_service_name,
-      std::string* out_request_handler_id,
-      chromeos::ErrorPtr* error,
-      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
-    auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
-        timeout_ms,
-        dbus_object_proxy_,
-        "org.chromium.WebServer.ProtocolHandler",
-        "AddRequestHandler",
-        error,
-        in_url,
-        in_method,
-        in_service_name);
-    return response && chromeos::dbus_utils::ExtractMethodCallResults(
-        response.get(), error, out_request_handler_id);
-  }
-
-  // Adds a handler for the given |url|, and optionally request |method|.
-  // On success returns a handler ID.
-  void AddRequestHandlerAsync(
-      const std::string& in_url,
-      const std::string& in_method,
-      const std::string& in_service_name,
-      const base::Callback<void(const std::string& /*request_handler_id*/)>& success_callback,
-      const base::Callback<void(chromeos::Error*)>& error_callback,
-      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
-    chromeos::dbus_utils::CallMethodWithTimeout(
-        timeout_ms,
-        dbus_object_proxy_,
-        "org.chromium.WebServer.ProtocolHandler",
-        "AddRequestHandler",
-        success_callback,
-        error_callback,
-        in_url,
-        in_method,
-        in_service_name);
-  }
-
-  // Removes a previously registered request handler.
-  // The |handler_id| is the ID returned from AddHanlder() method.
-  bool RemoveRequestHandler(
-      const std::string& in_request_handler_id,
-      chromeos::ErrorPtr* error,
-      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
-    auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
-        timeout_ms,
-        dbus_object_proxy_,
-        "org.chromium.WebServer.ProtocolHandler",
-        "RemoveRequestHandler",
-        error,
-        in_request_handler_id);
-    return response && chromeos::dbus_utils::ExtractMethodCallResults(
-        response.get(), error);
-  }
-
-  // Removes a previously registered request handler.
-  // The |handler_id| is the ID returned from AddHanlder() method.
-  void RemoveRequestHandlerAsync(
-      const std::string& in_request_handler_id,
-      const base::Callback<void()>& success_callback,
-      const base::Callback<void(chromeos::Error*)>& error_callback,
-      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
-    chromeos::dbus_utils::CallMethodWithTimeout(
-        timeout_ms,
-        dbus_object_proxy_,
-        "org.chromium.WebServer.ProtocolHandler",
-        "RemoveRequestHandler",
-        success_callback,
-        error_callback,
-        in_request_handler_id);
-  }
-
-  // Returns the contents of the given uploaded file. The |file_id| parameter
-  // must correspond to the file_id member of FileInfo structure returned
-  // by |Files| property for the given |request_id|.
-  bool GetRequestFileData(
-      const std::string& in_request_id,
-      int32_t in_file_id,
-      std::vector<uint8_t>* out_contents,
-      chromeos::ErrorPtr* error,
-      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
-    auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
-        timeout_ms,
-        dbus_object_proxy_,
-        "org.chromium.WebServer.ProtocolHandler",
-        "GetRequestFileData",
-        error,
-        in_request_id,
-        in_file_id);
-    return response && chromeos::dbus_utils::ExtractMethodCallResults(
-        response.get(), error, out_contents);
-  }
-
-  // Returns the contents of the given uploaded file. The |file_id| parameter
-  // must correspond to the file_id member of FileInfo structure returned
-  // by |Files| property for the given |request_id|.
-  void GetRequestFileDataAsync(
-      const std::string& in_request_id,
-      int32_t in_file_id,
-      const base::Callback<void(const std::vector<uint8_t>& /*contents*/)>& success_callback,
-      const base::Callback<void(chromeos::Error*)>& error_callback,
-      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
-    chromeos::dbus_utils::CallMethodWithTimeout(
-        timeout_ms,
-        dbus_object_proxy_,
-        "org.chromium.WebServer.ProtocolHandler",
-        "GetRequestFileData",
-        success_callback,
-        error_callback,
-        in_request_id,
-        in_file_id);
-  }
-
-  // Fulfills the request with specified |request_id| and provides response.
-  bool CompleteRequest(
-      const std::string& in_request_id,
-      int32_t in_status_code,
-      const std::vector<std::tuple<std::string, std::string>>& in_headers,
-      const std::vector<uint8_t>& in_data,
-      chromeos::ErrorPtr* error,
-      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
-    auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
-        timeout_ms,
-        dbus_object_proxy_,
-        "org.chromium.WebServer.ProtocolHandler",
-        "CompleteRequest",
-        error,
-        in_request_id,
-        in_status_code,
-        in_headers,
-        in_data);
-    return response && chromeos::dbus_utils::ExtractMethodCallResults(
-        response.get(), error);
-  }
-
-  // Fulfills the request with specified |request_id| and provides response.
-  void CompleteRequestAsync(
-      const std::string& in_request_id,
-      int32_t in_status_code,
-      const std::vector<std::tuple<std::string, std::string>>& in_headers,
-      const std::vector<uint8_t>& in_data,
-      const base::Callback<void()>& success_callback,
-      const base::Callback<void(chromeos::Error*)>& error_callback,
-      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
-    chromeos::dbus_utils::CallMethodWithTimeout(
-        timeout_ms,
-        dbus_object_proxy_,
-        "org.chromium.WebServer.ProtocolHandler",
-        "CompleteRequest",
-        success_callback,
-        error_callback,
-        in_request_id,
-        in_status_code,
-        in_headers,
-        in_data);
-  }
-
-  const std::string& id() const override {
-    return property_set_->id.value();
-  }
-
-  const std::string& name() const override {
-    return property_set_->name.value();
-  }
-
-  uint16_t port() const override {
-    return property_set_->port.value();
-  }
-
-  const std::string& protocol() const override {
-    return property_set_->protocol.value();
-  }
-
-  const std::vector<uint8_t>& certificate_fingerprint() const override {
-    return property_set_->certificate_fingerprint.value();
-  }
-
- private:
-  void OnPropertyChanged(const std::string& property_name) {
-    if (!on_property_changed_.is_null())
-      on_property_changed_.Run(this, property_name);
-  }
-
-  scoped_refptr<dbus::Bus> bus_;
-  const std::string service_name_{"org.chromium.WebServer"};
-  dbus::ObjectPath object_path_;
-  PropertySet* property_set_;
-  base::Callback<void(ProtocolHandlerProxy*, const std::string&)> on_property_changed_;
-  dbus::ObjectProxy* dbus_object_proxy_;
-
-  friend class org::chromium::WebServer::ObjectManagerProxy;
-  DISALLOW_COPY_AND_ASSIGN(ProtocolHandlerProxy);
-};
-
-}  // namespace WebServer
-}  // namespace chromium
-}  // namespace org
-
-namespace org {
-namespace chromium {
-namespace WebServer {
-
-// Abstract interface proxy for org::chromium::WebServer::Server.
-class ServerProxyInterface {
- public:
-  virtual ~ServerProxyInterface() = default;
-
-  virtual bool Ping(
-      std::string* out_message,
-      chromeos::ErrorPtr* error,
-      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-
-  virtual void PingAsync(
-      const base::Callback<void(const std::string& /*message*/)>& success_callback,
-      const base::Callback<void(chromeos::Error*)>& error_callback,
-      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0;
-};
-
-}  // namespace WebServer
-}  // namespace chromium
-}  // namespace org
-
-namespace org {
-namespace chromium {
-namespace WebServer {
-
-// Interface proxy for org::chromium::WebServer::Server.
-class ServerProxy final : public ServerProxyInterface {
- public:
-  class PropertySet : public dbus::PropertySet {
-   public:
-    PropertySet(dbus::ObjectProxy* object_proxy,
-                const PropertyChangedCallback& callback)
-        : dbus::PropertySet{object_proxy,
-                            "org.chromium.WebServer.Server",
-                            callback} {
-    }
-
-
-   private:
-    DISALLOW_COPY_AND_ASSIGN(PropertySet);
-  };
-
-  ServerProxy(const scoped_refptr<dbus::Bus>& bus) :
-      bus_{bus},
-      dbus_object_proxy_{
-          bus_->GetObjectProxy(service_name_, object_path_)} {
-  }
-
-  ~ServerProxy() override {
-  }
-
-  void ReleaseObjectProxy(const base::Closure& callback) {
-    bus_->RemoveObjectProxy(service_name_, object_path_, callback);
-  }
-
-  const dbus::ObjectPath& GetObjectPath() const {
-    return object_path_;
-  }
-
-  dbus::ObjectProxy* GetObjectProxy() const { return dbus_object_proxy_; }
-
-  bool Ping(
-      std::string* out_message,
-      chromeos::ErrorPtr* error,
-      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
-    auto response = chromeos::dbus_utils::CallMethodAndBlockWithTimeout(
-        timeout_ms,
-        dbus_object_proxy_,
-        "org.chromium.WebServer.Server",
-        "Ping",
-        error);
-    return response && chromeos::dbus_utils::ExtractMethodCallResults(
-        response.get(), error, out_message);
-  }
-
-  void PingAsync(
-      const base::Callback<void(const std::string& /*message*/)>& success_callback,
-      const base::Callback<void(chromeos::Error*)>& error_callback,
-      int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override {
-    chromeos::dbus_utils::CallMethodWithTimeout(
-        timeout_ms,
-        dbus_object_proxy_,
-        "org.chromium.WebServer.Server",
-        "Ping",
-        success_callback,
-        error_callback);
-  }
-
- private:
-  scoped_refptr<dbus::Bus> bus_;
-  const std::string service_name_{"org.chromium.WebServer"};
-  const dbus::ObjectPath object_path_{"/org/chromium/WebServer/Server"};
-  dbus::ObjectProxy* dbus_object_proxy_;
-
-  DISALLOW_COPY_AND_ASSIGN(ServerProxy);
-};
-
-}  // namespace WebServer
-}  // namespace chromium
-}  // namespace org
-
-namespace org {
-namespace chromium {
-namespace WebServer {
-
-class ObjectManagerProxy : public dbus::ObjectManager::Interface {
- public:
-  ObjectManagerProxy(const scoped_refptr<dbus::Bus>& bus)
-      : bus_{bus},
-        dbus_object_manager_{bus->GetObjectManager(
-            "org.chromium.WebServer",
-            dbus::ObjectPath{"/org/chromium/WebServer"})} {
-    dbus_object_manager_->RegisterInterface("org.chromium.WebServer.ProtocolHandler", this);
-    dbus_object_manager_->RegisterInterface("org.chromium.WebServer.Server", this);
-  }
-
-  ~ObjectManagerProxy() override {
-    dbus_object_manager_->UnregisterInterface("org.chromium.WebServer.ProtocolHandler");
-    dbus_object_manager_->UnregisterInterface("org.chromium.WebServer.Server");
-  }
-
-  dbus::ObjectManager* GetObjectManagerProxy() const {
-    return dbus_object_manager_;
-  }
-
-  org::chromium::WebServer::ProtocolHandlerProxy* GetProtocolHandlerProxy(
-      const dbus::ObjectPath& object_path) {
-    auto p = protocol_handler_instances_.find(object_path);
-    if (p != protocol_handler_instances_.end())
-      return p->second.get();
-    return nullptr;
-  }
-  std::vector<org::chromium::WebServer::ProtocolHandlerProxy*> GetProtocolHandlerInstances() const {
-    std::vector<org::chromium::WebServer::ProtocolHandlerProxy*> values;
-    values.reserve(protocol_handler_instances_.size());
-    for (const auto& pair : protocol_handler_instances_)
-      values.push_back(pair.second.get());
-    return values;
-  }
-  void SetProtocolHandlerAddedCallback(
-      const base::Callback<void(org::chromium::WebServer::ProtocolHandlerProxy*)>& callback) {
-    on_protocol_handler_added_ = callback;
-  }
-  void SetProtocolHandlerRemovedCallback(
-      const base::Callback<void(const dbus::ObjectPath&)>& callback) {
-    on_protocol_handler_removed_ = callback;
-  }
-
-  org::chromium::WebServer::ServerProxy* GetServerProxy() {
-    if (server_instances_.empty())
-      return nullptr;
-    return server_instances_.begin()->second.get();
-  }
-  std::vector<org::chromium::WebServer::ServerProxy*> GetServerInstances() const {
-    std::vector<org::chromium::WebServer::ServerProxy*> values;
-    values.reserve(server_instances_.size());
-    for (const auto& pair : server_instances_)
-      values.push_back(pair.second.get());
-    return values;
-  }
-  void SetServerAddedCallback(
-      const base::Callback<void(org::chromium::WebServer::ServerProxy*)>& callback) {
-    on_server_added_ = callback;
-  }
-  void SetServerRemovedCallback(
-      const base::Callback<void(const dbus::ObjectPath&)>& callback) {
-    on_server_removed_ = callback;
-  }
-
- private:
-  void OnPropertyChanged(const dbus::ObjectPath& object_path,
-                         const std::string& interface_name,
-                         const std::string& property_name) {
-    if (interface_name == "org.chromium.WebServer.ProtocolHandler") {
-      auto p = protocol_handler_instances_.find(object_path);
-      if (p == protocol_handler_instances_.end())
-        return;
-      p->second->OnPropertyChanged(property_name);
-      return;
-    }
-  }
-
-  void ObjectAdded(
-      const dbus::ObjectPath& object_path,
-      const std::string& interface_name) override {
-    if (interface_name == "org.chromium.WebServer.ProtocolHandler") {
-      auto property_set =
-          static_cast<org::chromium::WebServer::ProtocolHandlerProxy::PropertySet*>(
-              dbus_object_manager_->GetProperties(object_path, interface_name));
-      std::unique_ptr<org::chromium::WebServer::ProtocolHandlerProxy> protocol_handler_proxy{
-        new org::chromium::WebServer::ProtocolHandlerProxy{bus_, object_path, property_set}
-      };
-      auto p = protocol_handler_instances_.emplace(object_path, std::move(protocol_handler_proxy));
-      if (!on_protocol_handler_added_.is_null())
-        on_protocol_handler_added_.Run(p.first->second.get());
-      return;
-    }
-    if (interface_name == "org.chromium.WebServer.Server") {
-      std::unique_ptr<org::chromium::WebServer::ServerProxy> server_proxy{
-        new org::chromium::WebServer::ServerProxy{bus_}
-      };
-      auto p = server_instances_.emplace(object_path, std::move(server_proxy));
-      if (!on_server_added_.is_null())
-        on_server_added_.Run(p.first->second.get());
-      return;
-    }
-  }
-
-  void ObjectRemoved(
-      const dbus::ObjectPath& object_path,
-      const std::string& interface_name) override {
-    if (interface_name == "org.chromium.WebServer.ProtocolHandler") {
-      auto p = protocol_handler_instances_.find(object_path);
-      if (p != protocol_handler_instances_.end()) {
-        if (!on_protocol_handler_removed_.is_null())
-          on_protocol_handler_removed_.Run(object_path);
-        protocol_handler_instances_.erase(p);
-      }
-      return;
-    }
-    if (interface_name == "org.chromium.WebServer.Server") {
-      auto p = server_instances_.find(object_path);
-      if (p != server_instances_.end()) {
-        if (!on_server_removed_.is_null())
-          on_server_removed_.Run(object_path);
-        server_instances_.erase(p);
-      }
-      return;
-    }
-  }
-
-  dbus::PropertySet* CreateProperties(
-      dbus::ObjectProxy* object_proxy,
-      const dbus::ObjectPath& object_path,
-      const std::string& interface_name) override {
-    if (interface_name == "org.chromium.WebServer.ProtocolHandler") {
-      return new org::chromium::WebServer::ProtocolHandlerProxy::PropertySet{
-          object_proxy,
-          base::Bind(&ObjectManagerProxy::OnPropertyChanged,
-                     weak_ptr_factory_.GetWeakPtr(),
-                     object_path,
-                     interface_name)
-      };
-    }
-    if (interface_name == "org.chromium.WebServer.Server") {
-      return new org::chromium::WebServer::ServerProxy::PropertySet{
-          object_proxy,
-          base::Bind(&ObjectManagerProxy::OnPropertyChanged,
-                     weak_ptr_factory_.GetWeakPtr(),
-                     object_path,
-                     interface_name)
-      };
-    }
-    LOG(FATAL) << "Creating properties for unsupported interface "
-               << interface_name;
-    return nullptr;
-  }
-
-  scoped_refptr<dbus::Bus> bus_;
-  dbus::ObjectManager* dbus_object_manager_;
-  std::map<dbus::ObjectPath,
-           std::unique_ptr<org::chromium::WebServer::ProtocolHandlerProxy>> protocol_handler_instances_;
-  base::Callback<void(org::chromium::WebServer::ProtocolHandlerProxy*)> on_protocol_handler_added_;
-  base::Callback<void(const dbus::ObjectPath&)> on_protocol_handler_removed_;
-  std::map<dbus::ObjectPath,
-           std::unique_ptr<org::chromium::WebServer::ServerProxy>> server_instances_;
-  base::Callback<void(org::chromium::WebServer::ServerProxy*)> on_server_added_;
-  base::Callback<void(const dbus::ObjectPath&)> on_server_removed_;
-  base::WeakPtrFactory<ObjectManagerProxy> weak_ptr_factory_{this};
-
-  DISALLOW_COPY_AND_ASSIGN(ObjectManagerProxy);
-};
-
-}  // namespace WebServer
-}  // namespace chromium
-}  // namespace org
-
-#endif  // ____CHROMEOS_DBUS_BINDING___BUILD_LUMPY_VAR_CACHE_PORTAGE_CHROMEOS_BASE_WEBSERVER_OUT_DEFAULT_GEN_INCLUDE_WEBSERVD_DBUS_PROXIES_H
diff --git a/gen/webservd/org.chromium.WebServer.ProtocolHandler.h b/gen/webservd/org.chromium.WebServer.ProtocolHandler.h
deleted file mode 100644
index fd185a9..0000000
--- a/gen/webservd/org.chromium.WebServer.ProtocolHandler.h
+++ /dev/null
@@ -1,150 +0,0 @@
-// Automatic generation of D-Bus interfaces:
-//  - org.chromium.WebServer.ProtocolHandler
-#ifndef ____CHROMEOS_DBUS_BINDING_______________________VAR_CACHE_PORTAGE_CHROMEOS_BASE_WEBSERVER_OUT_DEFAULT_GEN_INCLUDE_WEBSERVD_ORG_CHROMIUM_WEBSERVER_PROTOCOLHANDLER_H
-#define ____CHROMEOS_DBUS_BINDING_______________________VAR_CACHE_PORTAGE_CHROMEOS_BASE_WEBSERVER_OUT_DEFAULT_GEN_INCLUDE_WEBSERVD_ORG_CHROMIUM_WEBSERVER_PROTOCOLHANDLER_H
-#include <memory>
-#include <string>
-#include <tuple>
-#include <vector>
-
-#include <base/macros.h>
-#include <dbus/object_path.h>
-#include <chromeos/any.h>
-#include <chromeos/dbus/dbus_object.h>
-#include <chromeos/dbus/exported_object_manager.h>
-#include <chromeos/variant_dictionary.h>
-
-namespace org {
-namespace chromium {
-namespace WebServer {
-
-// Interface definition for org::chromium::WebServer::ProtocolHandler.
-class ProtocolHandlerInterface {
- public:
-  virtual ~ProtocolHandlerInterface() = default;
-
-  // Adds a handler for the given |url|, and optionally request |method|.
-  // On success returns a handler ID.
-  virtual std::string AddRequestHandler(
-      const std::string& in_url,
-      const std::string& in_method,
-      const std::string& in_service_name) = 0;
-  // Removes a previously registered request handler.
-  // The |handler_id| is the ID returned from AddHanlder() method.
-  virtual bool RemoveRequestHandler(
-      chromeos::ErrorPtr* error,
-      const std::string& in_request_handler_id) = 0;
-  // Returns the contents of the given uploaded file. The |file_id| parameter
-  // must correspond to the file_id member of FileInfo structure returned
-  // by |Files| property for the given |request_id|.
-  virtual bool GetRequestFileData(
-      chromeos::ErrorPtr* error,
-      const std::string& in_request_id,
-      int32_t in_file_id,
-      std::vector<uint8_t>* out_contents) = 0;
-  // Fulfills the request with specified |request_id| and provides response.
-  virtual bool CompleteRequest(
-      chromeos::ErrorPtr* error,
-      const std::string& in_request_id,
-      int32_t in_status_code,
-      const std::vector<std::tuple<std::string, std::string>>& in_headers,
-      const std::vector<uint8_t>& in_data) = 0;
-};
-
-// Interface adaptor for org::chromium::WebServer::ProtocolHandler.
-class ProtocolHandlerAdaptor {
- public:
-  ProtocolHandlerAdaptor(ProtocolHandlerInterface* interface) : interface_(interface) {}
-
-  void RegisterWithDBusObject(chromeos::dbus_utils::DBusObject* object) {
-    chromeos::dbus_utils::DBusInterface* itf =
-        object->AddOrGetInterface("org.chromium.WebServer.ProtocolHandler");
-
-    itf->AddSimpleMethodHandler(
-        "AddRequestHandler",
-        base::Unretained(interface_),
-        &ProtocolHandlerInterface::AddRequestHandler);
-    itf->AddSimpleMethodHandlerWithError(
-        "RemoveRequestHandler",
-        base::Unretained(interface_),
-        &ProtocolHandlerInterface::RemoveRequestHandler);
-    itf->AddSimpleMethodHandlerWithError(
-        "GetRequestFileData",
-        base::Unretained(interface_),
-        &ProtocolHandlerInterface::GetRequestFileData);
-    itf->AddSimpleMethodHandlerWithError(
-        "CompleteRequest",
-        base::Unretained(interface_),
-        &ProtocolHandlerInterface::CompleteRequest);
-
-    itf->AddProperty(IdName(), &id_);
-    itf->AddProperty(NameName(), &name_);
-    itf->AddProperty(PortName(), &port_);
-    itf->AddProperty(ProtocolName(), &protocol_);
-    itf->AddProperty(CertificateFingerprintName(), &certificate_fingerprint_);
-  }
-
-  // Returns a unique ID of this instance.
-  static const char* IdName() { return "Id"; }
-  std::string GetId() const {
-    return id_.GetValue().Get<std::string>();
-  }
-  void SetId(const std::string& id) {
-    id_.SetValue(id);
-  }
-
-  // Returns the name of the handler. Multiple related protocol handler
-  // could share the same name so that clients don't have to register
-  // request handlers for each of them separately.
-  static const char* NameName() { return "Name"; }
-  std::string GetName() const {
-    return name_.GetValue().Get<std::string>();
-  }
-  void SetName(const std::string& name) {
-    name_.SetValue(name);
-  }
-
-  // Returns the port number this instance is serving requests on.
-  static const char* PortName() { return "Port"; }
-  uint16_t GetPort() const {
-    return port_.GetValue().Get<uint16_t>();
-  }
-  void SetPort(uint16_t port) {
-    port_.SetValue(port);
-  }
-
-  // Returns the protocol name of this instance ("http" or "https").
-  static const char* ProtocolName() { return "Protocol"; }
-  std::string GetProtocol() const {
-    return protocol_.GetValue().Get<std::string>();
-  }
-  void SetProtocol(const std::string& protocol) {
-    protocol_.SetValue(protocol);
-  }
-
-  // Returns the TLS certificate fingerprint used for HTTPS instance or
-  // empty array if this is an unsecured HTTP instance.
-  static const char* CertificateFingerprintName() { return "CertificateFingerprint"; }
-  std::vector<uint8_t> GetCertificateFingerprint() const {
-    return certificate_fingerprint_.GetValue().Get<std::vector<uint8_t>>();
-  }
-  void SetCertificateFingerprint(const std::vector<uint8_t>& certificate_fingerprint) {
-    certificate_fingerprint_.SetValue(certificate_fingerprint);
-  }
-
- private:
-  chromeos::dbus_utils::ExportedProperty<std::string> id_;
-  chromeos::dbus_utils::ExportedProperty<std::string> name_;
-  chromeos::dbus_utils::ExportedProperty<uint16_t> port_;
-  chromeos::dbus_utils::ExportedProperty<std::string> protocol_;
-  chromeos::dbus_utils::ExportedProperty<std::vector<uint8_t>> certificate_fingerprint_;
-
-  ProtocolHandlerInterface* interface_;  // Owned by container of this adapter.
-
-  DISALLOW_COPY_AND_ASSIGN(ProtocolHandlerAdaptor);
-};
-
-}  // namespace WebServer
-}  // namespace chromium
-}  // namespace org
-#endif  // ____CHROMEOS_DBUS_BINDING_______________________VAR_CACHE_PORTAGE_CHROMEOS_BASE_WEBSERVER_OUT_DEFAULT_GEN_INCLUDE_WEBSERVD_ORG_CHROMIUM_WEBSERVER_PROTOCOLHANDLER_H
diff --git a/gen/webservd/org.chromium.WebServer.Server.h b/gen/webservd/org.chromium.WebServer.Server.h
deleted file mode 100644
index 1b844c8..0000000
--- a/gen/webservd/org.chromium.WebServer.Server.h
+++ /dev/null
@@ -1,57 +0,0 @@
-// Automatic generation of D-Bus interfaces:
-//  - org.chromium.WebServer.Server
-#ifndef ____CHROMEOS_DBUS_BINDING_______________________VAR_CACHE_PORTAGE_CHROMEOS_BASE_WEBSERVER_OUT_DEFAULT_GEN_INCLUDE_WEBSERVD_ORG_CHROMIUM_WEBSERVER_SERVER_H
-#define ____CHROMEOS_DBUS_BINDING_______________________VAR_CACHE_PORTAGE_CHROMEOS_BASE_WEBSERVER_OUT_DEFAULT_GEN_INCLUDE_WEBSERVD_ORG_CHROMIUM_WEBSERVER_SERVER_H
-#include <memory>
-#include <string>
-#include <tuple>
-#include <vector>
-
-#include <base/macros.h>
-#include <dbus/object_path.h>
-#include <chromeos/any.h>
-#include <chromeos/dbus/dbus_object.h>
-#include <chromeos/dbus/exported_object_manager.h>
-#include <chromeos/variant_dictionary.h>
-
-namespace org {
-namespace chromium {
-namespace WebServer {
-
-// Interface definition for org::chromium::WebServer::Server.
-class ServerInterface {
- public:
-  virtual ~ServerInterface() = default;
-
-  virtual std::string Ping() = 0;
-};
-
-// Interface adaptor for org::chromium::WebServer::Server.
-class ServerAdaptor {
- public:
-  ServerAdaptor(ServerInterface* interface) : interface_(interface) {}
-
-  void RegisterWithDBusObject(chromeos::dbus_utils::DBusObject* object) {
-    chromeos::dbus_utils::DBusInterface* itf =
-        object->AddOrGetInterface("org.chromium.WebServer.Server");
-
-    itf->AddSimpleMethodHandler(
-        "Ping",
-        base::Unretained(interface_),
-        &ServerInterface::Ping);
-  }
-
-  static dbus::ObjectPath GetObjectPath() {
-    return dbus::ObjectPath{"/org/chromium/WebServer/Server"};
-  }
-
- private:
-  ServerInterface* interface_;  // Owned by container of this adapter.
-
-  DISALLOW_COPY_AND_ASSIGN(ServerAdaptor);
-};
-
-}  // namespace WebServer
-}  // namespace chromium
-}  // namespace org
-#endif  // ____CHROMEOS_DBUS_BINDING_______________________VAR_CACHE_PORTAGE_CHROMEOS_BASE_WEBSERVER_OUT_DEFAULT_GEN_INCLUDE_WEBSERVD_ORG_CHROMIUM_WEBSERVER_SERVER_H
diff --git a/libwebserv/Android.mk b/libwebserv/Android.mk
index a813426..9462248 100644
--- a/libwebserv/Android.mk
+++ b/libwebserv/Android.mk
@@ -22,9 +22,9 @@
 include $(CLEAR_VARS)
 LOCAL_MODULE := libwebserv
 LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/..
-# TODO: Add dbus_bindings/org.chromium.WebServer.RequestHandler.dbus.xml once
-# code generation is working.
+LOCAL_SHARED_LIBRARIES := libwebservd-client-internal
 LOCAL_SRC_FILES := \
+    dbus_bindings/org.chromium.WebServer.RequestHandler.dbus-xml \
     protocol_handler.cc \
     request.cc \
     request_handler_callback.cc \
@@ -33,3 +33,16 @@
 
 $(eval $(webservd_common))
 include $(BUILD_SHARED_LIBRARY)
+
+# libwebserv-proxies-internal shared library
+# ========================================================
+# You do not want to depend on this.  Depend on libwebserv instead.
+# libwebserv abstracts and helps you consume this interface.
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := libwebserv-proxies-internal
+LOCAL_SRC_FILES := \
+    dbus_bindings/org.chromium.WebServer.RequestHandler.dbus-xml \
+
+LOCAL_DBUS_PROXY_PREFIX := libwebserv
+include $(BUILD_SHARED_LIBRARY)
diff --git a/libwebserv/dbus_bindings/org.chromium.WebServer.RequestHandler.xml b/libwebserv/dbus_bindings/org.chromium.WebServer.RequestHandler.dbus-xml
similarity index 100%
rename from libwebserv/dbus_bindings/org.chromium.WebServer.RequestHandler.xml
rename to libwebserv/dbus_bindings/org.chromium.WebServer.RequestHandler.dbus-xml
diff --git a/libwebserv/protocol_handler.cc b/libwebserv/protocol_handler.cc
index 7897c76..e7e8dc8 100644
--- a/libwebserv/protocol_handler.cc
+++ b/libwebserv/protocol_handler.cc
@@ -19,7 +19,7 @@
 #include <base/logging.h>
 #include <chromeos/map_utils.h>
 
-#include "libwebserv/org.chromium.WebServer.RequestHandler.h"
+#include "dbus_bindings/org.chromium.WebServer.RequestHandler.h"
 #include "libwebserv/request.h"
 #include "libwebserv/request_handler_callback.h"
 #include "libwebserv/response.h"
diff --git a/libwebserv/server.cc b/libwebserv/server.cc
index 113be20..3ec66a8 100644
--- a/libwebserv/server.cc
+++ b/libwebserv/server.cc
@@ -20,7 +20,7 @@
 #include <libwebserv/protocol_handler.h>
 #include <libwebserv/request.h>
 
-#include "libwebserv/org.chromium.WebServer.RequestHandler.h"
+#include "dbus_bindings/org.chromium.WebServer.RequestHandler.h"
 #include "webservd/dbus-proxies.h"
 
 namespace libwebserv {
diff --git a/webservd/Android.mk b/webservd/Android.mk
index 7954018..dbfe263 100644
--- a/webservd/Android.mk
+++ b/webservd/Android.mk
@@ -28,13 +28,13 @@
     libcrypto \
     libfirewalld-client \
     libwebserv \
+    libwebserv-proxies-internal \
 
-# TODO: Add the following once code generation is working:
-# dbus_bindings/dbus-service-config.json
-# dbus_bindings/org.chromium.WebServer.ProtocolHandler.dbus.xml
-# dbus_bindings/org.chromium.WebServer.Server.dbus.xml
 LOCAL_SRC_FILES := \
     config.cc \
+    dbus_bindings/dbus-service-config.json \
+    dbus_bindings/org.chromium.WebServer.ProtocolHandler.dbus-xml \
+    dbus_bindings/org.chromium.WebServer.Server.dbus-xml \
     dbus_protocol_handler.cc \
     dbus_request_handler.cc \
     error_codes.cc \
@@ -49,6 +49,22 @@
 $(eval $(webservd_common))
 include $(BUILD_EXECUTABLE)
 
+# libwebservd-client-internal shared library
+# ========================================================
+# You do not want to depend on this.  Depend on libwebserv instead.
+# libwebserv abstracts and helps you consume this interface.
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := libwebservd-client-internal
+LOCAL_SRC_FILES := \
+    dbus_bindings/dbus-service-config.json \
+    dbus_bindings/org.chromium.WebServer.ProtocolHandler.dbus-xml \
+    dbus_bindings/org.chromium.WebServer.Server.dbus-xml \
+
+LOCAL_DBUS_PROXY_PREFIX := webservd
+include $(BUILD_SHARED_LIBRARY)
+
+
 # init.webservd.rc script
 # ========================================================
 
diff --git a/webservd/dbus_bindings/org.chromium.WebServer.ProtocolHandler.xml b/webservd/dbus_bindings/org.chromium.WebServer.ProtocolHandler.dbus-xml
similarity index 100%
rename from webservd/dbus_bindings/org.chromium.WebServer.ProtocolHandler.xml
rename to webservd/dbus_bindings/org.chromium.WebServer.ProtocolHandler.dbus-xml
diff --git a/webservd/dbus_bindings/org.chromium.WebServer.Server.xml b/webservd/dbus_bindings/org.chromium.WebServer.Server.dbus-xml
similarity index 100%
rename from webservd/dbus_bindings/org.chromium.WebServer.Server.xml
rename to webservd/dbus_bindings/org.chromium.WebServer.Server.dbus-xml
diff --git a/webservd/dbus_protocol_handler.h b/webservd/dbus_protocol_handler.h
index bcec227..20bf72f 100644
--- a/webservd/dbus_protocol_handler.h
+++ b/webservd/dbus_protocol_handler.h
@@ -28,7 +28,7 @@
 #include <dbus/bus.h>
 
 #include "libwebserv/dbus-proxies.h"
-#include "webservd/org.chromium.WebServer.ProtocolHandler.h"
+#include "dbus_bindings/org.chromium.WebServer.ProtocolHandler.h"
 
 namespace chromeos {
 namespace dbus_utils {
diff --git a/webservd/server.h b/webservd/server.h
index 418ec71..d691f4c 100644
--- a/webservd/server.h
+++ b/webservd/server.h
@@ -26,8 +26,8 @@
 #include <chromeos/dbus/exported_object_manager.h>
 #include <chromeos/secure_blob.h>
 
+#include "dbus_bindings/org.chromium.WebServer.Server.h"
 #include "webservd/firewall_interface.h"
-#include "webservd/org.chromium.WebServer.Server.h"
 #include "webservd/server_interface.h"
 
 namespace webservd {
diff --git a/webserver.gyp b/webserver.gyp
index 478e7d9..8c7ae39 100644
--- a/webserver.gyp
+++ b/webserver.gyp
@@ -17,7 +17,7 @@
         # get tied to some constant service name, since it will be
         # provided by the consumer of libwebserv library.
         'dbus_service_config': '',
-        'dbus_adaptors_out_dir': 'include/libwebserv',
+        'dbus_adaptors_out_dir': 'include/dbus_bindings',
       },
       # This static library is used in libwebserv shared library, which means
       # we must generate position-independent code for the files comprising
@@ -77,7 +77,7 @@
           'openssl',
         ],
         'deps': ['<@(exported_deps)'],
-        'dbus_adaptors_out_dir': 'include/webservd',
+        'dbus_adaptors_out_dir': 'include/dbus_bindings',
         'dbus_service_config': 'webservd/dbus_bindings/dbus-service-config.json',
       },
       'all_dependent_settings': {