| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
| 6 #include "dbus/bus.h" | 6 #include "dbus/bus.h" |
| 7 #include "dbus/exported_object.h" | 7 #include "dbus/exported_object.h" |
| 8 #include "dbus/message.h" | 8 #include "dbus/message.h" |
| 9 #include "dbus/object_path.h" | 9 #include "dbus/object_path.h" |
| 10 #include "mojo/embedder/channel_init.h" | 10 #include "mojo/embedder/channel_init.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 class DBusExternalService | 54 class DBusExternalService |
| 55 : public DBusExternalServiceBase, | 55 : public DBusExternalServiceBase, |
| 56 public ApplicationDelegate, | 56 public ApplicationDelegate, |
| 57 public InterfaceFactory<typename ServiceImpl::ImplementedInterface> { | 57 public InterfaceFactory<typename ServiceImpl::ImplementedInterface> { |
| 58 public: | 58 public: |
| 59 explicit DBusExternalService(const std::string& service_name) | 59 explicit DBusExternalService(const std::string& service_name) |
| 60 : DBusExternalServiceBase(service_name) { | 60 : DBusExternalServiceBase(service_name) { |
| 61 } | 61 } |
| 62 virtual ~DBusExternalService() {} | 62 virtual ~DBusExternalService() {} |
| 63 | 63 |
| 64 virtual bool ConfigureIncomingConnection(ApplicationConnection* connection) | 64 virtual bool ConfigureIncomingConnection( |
| 65 MOJO_OVERRIDE { | 65 ApplicationConnection* connection) override { |
| 66 connection->AddService(this); | 66 connection->AddService(this); |
| 67 return true; | 67 return true; |
| 68 } | 68 } |
| 69 | 69 |
| 70 virtual void Create( | 70 virtual void Create( |
| 71 ApplicationConnection* connection, | 71 ApplicationConnection* connection, |
| 72 InterfaceRequest<typename ServiceImpl::ImplementedInterface> request) | 72 InterfaceRequest<typename ServiceImpl::ImplementedInterface> request) |
| 73 MOJO_OVERRIDE { | 73 override { |
| 74 BindToRequest(new ServiceImpl, &request); | 74 BindToRequest(new ServiceImpl, &request); |
| 75 } | 75 } |
| 76 | 76 |
| 77 protected: | 77 protected: |
| 78 virtual void Connect(ScopedMessagePipeHandle client_handle) OVERRIDE { | 78 virtual void Connect(ScopedMessagePipeHandle client_handle) OVERRIDE { |
| 79 external_service_.reset(BindToPipe(new Impl(this), client_handle.Pass())); | 79 external_service_.reset(BindToPipe(new Impl(this), client_handle.Pass())); |
| 80 } | 80 } |
| 81 | 81 |
| 82 virtual void Disconnect() OVERRIDE { | 82 virtual void Disconnect() OVERRIDE { |
| 83 external_service_.reset(); | 83 external_service_.reset(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 97 } | 97 } |
| 98 private: | 98 private: |
| 99 DBusExternalService* service_; | 99 DBusExternalService* service_; |
| 100 scoped_ptr<Application> app_; | 100 scoped_ptr<Application> app_; |
| 101 }; | 101 }; |
| 102 | 102 |
| 103 scoped_ptr<Impl> external_service_; | 103 scoped_ptr<Impl> external_service_; |
| 104 }; | 104 }; |
| 105 | 105 |
| 106 } // namespace mojo | 106 } // namespace mojo |
| OLD | NEW |