Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1042)

Unified Diff: mojo/dbus/dbus_external_service.h

Issue 380413003: Mojo: Use InterfaceFactory<Interface> for service registration (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix network_service_loader Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/cc/context_provider_mojo.cc ('k') | mojo/examples/aura_demo/aura_demo.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/dbus/dbus_external_service.h
diff --git a/mojo/dbus/dbus_external_service.h b/mojo/dbus/dbus_external_service.h
index 77e9e4be2df38d630a280a3f25e58405f8e3c105..ea4c602ae2e75cb2cac43bbbe24e8643b843cee7 100644
--- a/mojo/dbus/dbus_external_service.h
+++ b/mojo/dbus/dbus_external_service.h
@@ -11,6 +11,8 @@
#include "mojo/public/cpp/application/application_connection.h"
#include "mojo/public/cpp/application/application_delegate.h"
#include "mojo/public/cpp/application/application_impl.h"
+#include "mojo/public/cpp/application/interface_factory.h"
+#include "mojo/public/cpp/bindings/interface_request.h"
#include "mojo/public/interfaces/service_provider/service_provider.mojom.h"
#include "mojo/shell/external_service.mojom.h"
@@ -50,8 +52,10 @@ class DBusExternalServiceBase {
};
template <class ServiceImpl>
-class DBusExternalService : public DBusExternalServiceBase,
- public ApplicationDelegate {
+class DBusExternalService
+ : public DBusExternalServiceBase,
+ public ApplicationDelegate,
+ public InterfaceFactory<typename ServiceImpl::ImplementedInterface> {
public:
explicit DBusExternalService(const std::string& service_name)
: DBusExternalServiceBase(service_name) {
@@ -60,10 +64,17 @@ class DBusExternalService : public DBusExternalServiceBase,
virtual bool ConfigureIncomingConnection(ApplicationConnection* connection)
MOJO_OVERRIDE {
- connection->AddService<ServiceImpl>();
+ connection->AddService(this);
return true;
}
+ virtual void Create(
+ ApplicationConnection* connection,
+ InterfaceRequest<typename ServiceImpl::ImplementedInterface> request)
+ MOJO_OVERRIDE {
+ BindToRequest(new ServiceImpl, &request);
+ }
+
protected:
virtual void Connect(ScopedMessagePipeHandle client_handle) OVERRIDE {
external_service_.reset(BindToPipe(new Impl(this), client_handle.Pass()));
« no previous file with comments | « mojo/cc/context_provider_mojo.cc ('k') | mojo/examples/aura_demo/aura_demo.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698