Index: mojo/dbus/dbus_external_service.h |
diff --git a/mojo/dbus/dbus_external_service.h b/mojo/dbus/dbus_external_service.h |
index 1a33c4c7874bc44c182a0292c0d9ac6e44876795..92dbbb756ab3f0913fa5f8a604339434b2d43944 100644 |
--- a/mojo/dbus/dbus_external_service.h |
+++ b/mojo/dbus/dbus_external_service.h |
@@ -9,7 +9,6 @@ |
#include "dbus/object_path.h" |
#include "mojo/common/channel_init.h" |
#include "mojo/public/cpp/bindings/interface.h" |
-#include "mojo/public/cpp/bindings/remote_ptr.h" |
#include "mojo/public/cpp/shell/application.h" |
#include "mojo/public/interfaces/shell/shell.mojom.h" |
#include "mojo/shell/external_service.mojom.h" |
@@ -19,7 +18,7 @@ const char kMojoDBusImplPath[] = "/org/chromium/MojoImpl"; |
const char kMojoDBusInterface[] = "org.chromium.Mojo"; |
const char kMojoDBusConnectMethod[] = "ConnectChannel"; |
-class DBusExternalServiceBase : public mojo::ErrorHandler { |
+class DBusExternalServiceBase : public ErrorHandler { |
public: |
explicit DBusExternalServiceBase(const std::string& service_name); |
virtual ~DBusExternalServiceBase(); |
@@ -28,7 +27,7 @@ class DBusExternalServiceBase : public mojo::ErrorHandler { |
protected: |
// TODO(cmasone): Enable multiple peers to connect/disconnect |
- virtual void Connect(ScopedExternalServiceHostHandle client_handle) = 0; |
+ virtual void Connect(ScopedMessagePipeHandle client_handle) = 0; |
virtual void Disconnect() = 0; |
private: |
@@ -36,7 +35,7 @@ class DBusExternalServiceBase : public mojo::ErrorHandler { |
// Implementation of org.chromium.Mojo.ConnectChannel, exported over DBus. |
// Takes a file descriptor and uses it to create a MessagePipe that is then |
- // hooked to a RemotePtr<mojo::ExternalServiceHost>. |
+ // hooked to a RemotePtr<ExternalServiceHost>. |
void ConnectChannel(dbus::MethodCall* method_call, |
dbus::ExportedObject::ResponseSender sender); |
@@ -47,13 +46,13 @@ class DBusExternalServiceBase : public mojo::ErrorHandler { |
const std::string service_name_; |
scoped_refptr<dbus::Bus> bus_; |
dbus::ExportedObject* exported_object_; // Owned by bus_; |
- scoped_ptr<mojo::common::ChannelInit> channel_init_; |
+ scoped_ptr<common::ChannelInit> channel_init_; |
DISALLOW_COPY_AND_ASSIGN(DBusExternalServiceBase); |
}; |
template <class ServiceImpl> |
class DBusExternalService : public DBusExternalServiceBase, |
- public mojo::ExternalService { |
+ public ExternalService { |
public: |
explicit DBusExternalService(const std::string& service_name) |
: DBusExternalServiceBase(service_name) { |
@@ -61,25 +60,28 @@ class DBusExternalService : public DBusExternalServiceBase, |
virtual ~DBusExternalService() {} |
protected: |
- virtual void Connect(ScopedExternalServiceHostHandle client_handle) OVERRIDE { |
- external_service_host_.reset(client_handle.Pass(), this, this); |
+ virtual void Connect(ScopedMessagePipeHandle client_handle) OVERRIDE { |
+ external_service_.Bind(new Impl()); |
+ external_service_.ConfigureStub(client_handle); |
+ external_service_.set_error_handler(this); |
} |
virtual void Disconnect() OVERRIDE { |
- app_.reset(); |
- external_service_host_.reset(); |
+ external_service_.reset(); |
} |
private: |
- virtual void Activate(mojo::ScopedMessagePipeHandle client_handle) OVERRIDE { |
- mojo::ScopedShellHandle shell_handle( |
- mojo::ShellHandle(client_handle.release().value())); |
- app_.reset(new mojo::Application(shell_handle.Pass())); |
- app_->AddServiceConnector(new mojo::ServiceConnector<ServiceImpl>()); |
- } |
+ class Impl : public ExternalService { |
+ public: |
+ virtual void Activate(ScopedMessagePipeHandle shell_handle) OVERRIDE { |
+ app_.reset(new Application(shell_handle.Pass())); |
+ app_->AddServiceConnector(new ServiceConnector<ServiceImpl>()); |
+ } |
+ private: |
+ scoped_ptr<Application> app_; |
+ }; |
- mojo::RemotePtr<mojo::ExternalServiceHost> external_service_host_; |
- scoped_ptr<mojo::Application> app_; |
+ ExternalServicePtr external_service_; |
}; |
} // namespace mojo |