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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 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(); |
84 } | 84 } |
85 | 85 |
86 private: | 86 private: |
87 class Impl : public InterfaceImpl<ExternalService> { | 87 class Impl : public InterfaceImpl<ExternalService> { |
88 public: | 88 public: |
89 explicit Impl(DBusExternalService* service) : service_(service) { | 89 explicit Impl(DBusExternalService* service) : service_(service) { |
90 } | 90 } |
91 virtual void OnConnectionError() OVERRIDE { | 91 virtual void OnConnectionError() override { |
92 service_->Disconnect(); | 92 service_->Disconnect(); |
93 } | 93 } |
94 virtual void Activate(ScopedMessagePipeHandle service_provider_handle) | 94 virtual void Activate(ScopedMessagePipeHandle service_provider_handle) |
95 OVERRIDE { | 95 override { |
96 app_.reset(new ApplicationImpl(service_, service_provider_handle.Pass())); | 96 app_.reset(new ApplicationImpl(service_, service_provider_handle.Pass())); |
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 |