OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 private: | 70 private: |
71 // service_manager::Service: | 71 // service_manager::Service: |
72 void OnStart() override { | 72 void OnStart() override { |
73 bindings_.set_connection_error_handler( | 73 bindings_.set_connection_error_handler( |
74 base::Bind(&ProvidedService::OnConnectionError, | 74 base::Bind(&ProvidedService::OnConnectionError, |
75 base::Unretained(this))); | 75 base::Unretained(this))); |
76 registry_.AddInterface<test::mojom::ConnectTestService>(this); | 76 registry_.AddInterface<test::mojom::ConnectTestService>(this); |
77 registry_.AddInterface<test::mojom::BlockedInterface>(this); | 77 registry_.AddInterface<test::mojom::BlockedInterface>(this); |
78 registry_.AddInterface<test::mojom::UserIdTest>(this); | 78 registry_.AddInterface<test::mojom::UserIdTest>(this); |
79 } | 79 } |
80 void OnBindInterface(const ServiceInfo& source_info, | 80 void OnBindInterface(const BindSourceInfo& source_info, |
81 const std::string& interface_name, | 81 const std::string& interface_name, |
82 mojo::ScopedMessagePipeHandle interface_pipe) override { | 82 mojo::ScopedMessagePipeHandle interface_pipe) override { |
83 registry_.BindInterface(source_info.identity, interface_name, | 83 registry_.BindInterface(source_info.identity, interface_name, |
84 std::move(interface_pipe)); | 84 std::move(interface_pipe)); |
85 } | 85 } |
86 | 86 |
87 // InterfaceFactory<test::mojom::ConnectTestService>: | 87 // InterfaceFactory<test::mojom::ConnectTestService>: |
88 void Create(const Identity& remote_identity, | 88 void Create(const Identity& remote_identity, |
89 test::mojom::ConnectTestServiceRequest request) override { | 89 test::mojom::ConnectTestServiceRequest request) override { |
90 bindings_.AddBinding(this, std::move(request)); | 90 bindings_.AddBinding(this, std::move(request)); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 // service_manager::Service: | 183 // service_manager::Service: |
184 void OnStart() override { | 184 void OnStart() override { |
185 base::Closure error_handler = | 185 base::Closure error_handler = |
186 base::Bind(&ConnectTestService::OnConnectionError, | 186 base::Bind(&ConnectTestService::OnConnectionError, |
187 base::Unretained(this)); | 187 base::Unretained(this)); |
188 bindings_.set_connection_error_handler(error_handler); | 188 bindings_.set_connection_error_handler(error_handler); |
189 service_factory_bindings_.set_connection_error_handler(error_handler); | 189 service_factory_bindings_.set_connection_error_handler(error_handler); |
190 registry_.AddInterface<ServiceFactory>(this); | 190 registry_.AddInterface<ServiceFactory>(this); |
191 registry_.AddInterface<test::mojom::ConnectTestService>(this); | 191 registry_.AddInterface<test::mojom::ConnectTestService>(this); |
192 } | 192 } |
193 void OnBindInterface(const ServiceInfo& source_info, | 193 void OnBindInterface(const BindSourceInfo& source_info, |
194 const std::string& interface_name, | 194 const std::string& interface_name, |
195 mojo::ScopedMessagePipeHandle interface_pipe) override { | 195 mojo::ScopedMessagePipeHandle interface_pipe) override { |
196 registry_.BindInterface(source_info.identity, interface_name, | 196 registry_.BindInterface(source_info.identity, interface_name, |
197 std::move(interface_pipe)); | 197 std::move(interface_pipe)); |
198 } | 198 } |
199 | 199 |
200 bool OnServiceManagerConnectionLost() override { | 200 bool OnServiceManagerConnectionLost() override { |
201 provided_services_.clear(); | 201 provided_services_.clear(); |
202 return true; | 202 return true; |
203 } | 203 } |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 DISALLOW_COPY_AND_ASSIGN(ConnectTestService); | 249 DISALLOW_COPY_AND_ASSIGN(ConnectTestService); |
250 }; | 250 }; |
251 | 251 |
252 } // namespace service_manager | 252 } // namespace service_manager |
253 | 253 |
254 MojoResult ServiceMain(MojoHandle service_request_handle) { | 254 MojoResult ServiceMain(MojoHandle service_request_handle) { |
255 service_manager::ServiceRunner runner( | 255 service_manager::ServiceRunner runner( |
256 new service_manager::ConnectTestService); | 256 new service_manager::ConnectTestService); |
257 return runner.Run(service_request_handle); | 257 return runner.Run(service_request_handle); |
258 } | 258 } |
OLD | NEW |