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

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: convert everything over, remove ApplicationConnection::AddService 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 | « no previous file | mojo/examples/aura_demo/aura_demo.cc » ('j') | mojo/examples/embedded_app/embedded_app.cc » ('J')
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..da383d00e248c9ae786cd14b73d8aaeaa42d0af3 100644
--- a/mojo/dbus/dbus_external_service.h
+++ b/mojo/dbus/dbus_external_service.h
@@ -50,8 +50,10 @@ class DBusExternalServiceBase {
};
template <class ServiceImpl>
-class DBusExternalService : public DBusExternalServiceBase,
- public ApplicationDelegate {
+class DBusExternalService
+ : public DBusExternalServiceBase,
+ public ApplicationDelegate,
+ public InterfaceFactory<typename ServiceImpl::Implements> {
public:
explicit DBusExternalService(const std::string& service_name)
: DBusExternalServiceBase(service_name) {
@@ -60,10 +62,16 @@ class DBusExternalService : public DBusExternalServiceBase,
virtual bool ConfigureIncomingConnection(ApplicationConnection* connection)
MOJO_OVERRIDE {
- connection->AddService<ServiceImpl>();
+ connection->AddServiceFactory(this);
return true;
}
+ virtual void Create(ApplicationConnection* connection,
+ InterfaceRequest<typename ServiceImpl::Implements>
+ request) MOJO_OVERRIDE {
+ mojo::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 | « no previous file | mojo/examples/aura_demo/aura_demo.cc » ('j') | mojo/examples/embedded_app/embedded_app.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698