webservd: Use abstract D-Bus proxy interfaces

D-Bus code generator now uses abstract proxy interfaces whenever
possible, so made necessary modifications on the caller side to
use them as well.

BUG: 26092352
Change-Id: I26990cb383fc39b858a084ff1bed7a4cfc4f2f74
diff --git a/libwebserv/protocol_handler.cc b/libwebserv/protocol_handler.cc
index 73b61db..76d1606 100644
--- a/libwebserv/protocol_handler.cc
+++ b/libwebserv/protocol_handler.cc
@@ -109,7 +109,7 @@
   request_handlers_.emplace(
       ++last_handler_id_,
       HandlerMapEntry{url, method,
-                      std::map<ProtocolHandlerProxy*, std::string>{},
+                      std::map<ProtocolHandlerProxyInterface*, std::string>{},
                       std::move(handler)});
   // For each instance of remote protocol handler object sharing the same name,
   // add the request handler.
@@ -155,7 +155,7 @@
   return true;
 }
 
-void ProtocolHandler::Connect(ProtocolHandlerProxy* proxy) {
+void ProtocolHandler::Connect(ProtocolHandlerProxyInterface* proxy) {
   proxies_.emplace(proxy->GetObjectPath(), proxy);
   for (const auto& pair : request_handlers_) {
     proxy->AddRequestHandlerAsync(
@@ -181,7 +181,7 @@
 }
 
 void ProtocolHandler::AddHandlerSuccess(int handler_id,
-                                        ProtocolHandlerProxy* proxy,
+                                        ProtocolHandlerProxyInterface* proxy,
                                         const std::string& remote_handler_id) {
   auto p = request_handlers_.find(handler_id);
   CHECK(p != request_handlers_.end());
@@ -229,7 +229,8 @@
     int status_code,
     const std::multimap<std::string, std::string>& headers,
     brillo::StreamPtr data_stream) {
-  ProtocolHandlerProxy* proxy = GetRequestProtocolHandlerProxy(request_id);
+  ProtocolHandlerProxyInterface* proxy =
+      GetRequestProtocolHandlerProxy(request_id);
   if (!proxy)
     return;
 
@@ -252,7 +253,8 @@
     int file_id,
     const base::Callback<void(brillo::StreamPtr)>& success_callback,
     const base::Callback<void(brillo::Error*)>& error_callback) {
-  ProtocolHandlerProxy* proxy = GetRequestProtocolHandlerProxy(request_id);
+  ProtocolHandlerProxyInterface* proxy =
+      GetRequestProtocolHandlerProxy(request_id);
   CHECK(proxy);
 
   // Store the success/error callback in a shared object so it can be referenced
@@ -287,7 +289,7 @@
                                  base::Bind(on_error));
 }
 
-ProtocolHandler::ProtocolHandlerProxy*
+ProtocolHandler::ProtocolHandlerProxyInterface*
 ProtocolHandler::GetRequestProtocolHandlerProxy(
     const std::string& request_id) const {
   auto iter = request_id_map_.find(request_id);
diff --git a/libwebserv/protocol_handler.h b/libwebserv/protocol_handler.h
index ab5e0ac..2e1c748 100644
--- a/libwebserv/protocol_handler.h
+++ b/libwebserv/protocol_handler.h
@@ -36,7 +36,7 @@
 namespace chromium {
 namespace WebServer {
 
-class ProtocolHandlerProxy;
+class ProtocolHandlerProxyInterface;
 
 }  // namespace WebServer
 }  // namespace chromium
@@ -129,19 +129,20 @@
   friend class Server;
   friend class ResponseImpl;
 
-  using ProtocolHandlerProxy = org::chromium::WebServer::ProtocolHandlerProxy;
+  using ProtocolHandlerProxyInterface =
+      org::chromium::WebServer::ProtocolHandlerProxyInterface;
 
   struct LIBWEBSERV_PRIVATE HandlerMapEntry {
     std::string url;
     std::string method;
-    std::map<ProtocolHandlerProxy*, std::string> remote_handler_ids;
+    std::map<ProtocolHandlerProxyInterface*, std::string> remote_handler_ids;
     std::unique_ptr<RequestHandlerInterface> handler;
   };
 
   // Called by the Server class when the D-Bus proxy object gets connected
   // to the web server daemon.
 
-  LIBWEBSERV_PRIVATE void Connect(ProtocolHandlerProxy* proxy);
+  LIBWEBSERV_PRIVATE void Connect(ProtocolHandlerProxyInterface* proxy);
   // Called by the Server class when the D-Bus proxy object gets disconnected
   // from the web server daemon.
   LIBWEBSERV_PRIVATE void Disconnect(const dbus::ObjectPath& object_path);
@@ -150,7 +151,7 @@
   // registration over D-Bus.
   LIBWEBSERV_PRIVATE void AddHandlerSuccess(
       int handler_id,
-      ProtocolHandlerProxy* proxy,
+      ProtocolHandlerProxyInterface* proxy,
       const std::string& remote_handler_id);
   LIBWEBSERV_PRIVATE void AddHandlerError(int handler_id,
                                           brillo::Error* error);
@@ -180,8 +181,8 @@
 
   // A helper method to obtain a corresponding protocol handler D-Bus proxy for
   // outstanding request with ID |request_id|.
-  LIBWEBSERV_PRIVATE ProtocolHandlerProxy* GetRequestProtocolHandlerProxy(
-      const std::string& request_id) const;
+  LIBWEBSERV_PRIVATE ProtocolHandlerProxyInterface*
+      GetRequestProtocolHandlerProxy(const std::string& request_id) const;
 
   // Protocol Handler name.
   std::string name_;
@@ -199,7 +200,7 @@
   // Remote D-Bus proxies for the server protocol handler objects.
   // There could be multiple protocol handlers with the same name (to make
   // it possible to server the same requests on different ports, for example).
-  std::map<dbus::ObjectPath, ProtocolHandlerProxy*> proxies_;
+  std::map<dbus::ObjectPath, ProtocolHandlerProxyInterface*> proxies_;
   // A map of request ID to protocol handler ID. Used to locate the appropriate
   // protocol handler D-Bus proxy for given request.
   std::map<std::string, std::string> request_id_map_;
diff --git a/libwebserv/server.cc b/libwebserv/server.cc
index 7ca3c55..d806eaa 100644
--- a/libwebserv/server.cc
+++ b/libwebserv/server.cc
@@ -147,7 +147,7 @@
   dbus_object_.reset();
 }
 
-void Server::Online(org::chromium::WebServer::ServerProxy* server) {
+void Server::Online(org::chromium::WebServer::ServerProxyInterface* server) {
   VLOG(1) << "Web server is on-line.";
   proxy_ = server;
   if (!on_server_online_.is_null())
@@ -162,7 +162,7 @@
 }
 
 void Server::ProtocolHandlerAdded(
-    org::chromium::WebServer::ProtocolHandlerProxy* handler) {
+    org::chromium::WebServer::ProtocolHandlerProxyInterface* handler) {
   VLOG(1) << "Server-side protocol handler with ID '" << handler->id()
           << "' is on-line (" << handler->name() << ")";
 
diff --git a/libwebserv/server.h b/libwebserv/server.h
index 20a5954..ca8a6f1 100644
--- a/libwebserv/server.h
+++ b/libwebserv/server.h
@@ -31,9 +31,9 @@
 namespace WebServer {
 
 class ObjectManagerProxy;
-class ProtocolHandlerProxy;
+class ProtocolHandlerProxyInterface;
 class RequestHandlerAdaptor;
-class ServerProxy;
+class ServerProxyInterface;
 
 }  // namespace WebServer
 }  // namespace chromium
@@ -109,7 +109,8 @@
   class RequestHandler;
 
   // Handler invoked when a connection is established to web server daemon.
-  LIBWEBSERV_PRIVATE void Online(org::chromium::WebServer::ServerProxy* server);
+  LIBWEBSERV_PRIVATE void Online(
+      org::chromium::WebServer::ServerProxyInterface* server);
 
   // Handler invoked when the web server daemon connection is dropped.
   LIBWEBSERV_PRIVATE void Offline(const dbus::ObjectPath& object_path);
@@ -117,7 +118,7 @@
   // Handler invoked when a new protocol handler D-Bus proxy object becomes
   // available.
   LIBWEBSERV_PRIVATE void ProtocolHandlerAdded(
-      org::chromium::WebServer::ProtocolHandlerProxy* handler);
+      org::chromium::WebServer::ProtocolHandlerProxyInterface* handler);
 
   // Handler invoked when a protocol handler D-Bus proxy object disappears.
   LIBWEBSERV_PRIVATE void ProtocolHandlerRemoved(
@@ -156,7 +157,7 @@
   std::unique_ptr<org::chromium::WebServer::ObjectManagerProxy> object_manager_;
 
   // D-Bus proxy for the web server main object.
-  org::chromium::WebServer::ServerProxy* proxy_{nullptr};
+  org::chromium::WebServer::ServerProxyInterface* proxy_{nullptr};
 
   // D-Bus service name used by the daemon hosting this object.
   std::string service_name_;
diff --git a/webservd/firewalld_firewall.cc b/webservd/firewalld_firewall.cc
index fe34418..b3200ba 100644
--- a/webservd/firewalld_firewall.cc
+++ b/webservd/firewalld_firewall.cc
@@ -38,7 +38,7 @@
 }
 
 void FirewalldFirewall::OnFirewalldOnline(
-    org::chromium::FirewalldProxy* proxy) {
+    org::chromium::FirewalldProxyInterface* proxy) {
   proxy_ = proxy;
   service_online_cb_.Run();
 }
diff --git a/webservd/firewalld_firewall.h b/webservd/firewalld_firewall.h
index 49a139a..28f6fd5 100644
--- a/webservd/firewalld_firewall.h
+++ b/webservd/firewalld_firewall.h
@@ -40,12 +40,12 @@
       const base::Callback<void(brillo::Error*)>& failure_cb) override;
 
  private:
-  void OnFirewalldOnline(org::chromium::FirewalldProxy* proxy);
+  void OnFirewalldOnline(org::chromium::FirewalldProxyInterface* proxy);
 
   std::unique_ptr<org::chromium::Firewalld::ObjectManagerProxy> object_manager_;
 
   // Proxy to the firewall DBus service. Owned by the DBus bindings module.
-  org::chromium::FirewalldProxy* proxy_;
+  org::chromium::FirewalldProxyInterface* proxy_;
 
   // Callback to use when firewall service comes online.
   base::Closure service_online_cb_;