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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/macros.h" | 6 #include "base/macros.h" |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "mojo/public/cpp/bindings/binding_set.h" | 9 #include "mojo/public/cpp/bindings/binding_set.h" |
10 #include "services/service_manager/public/c/main.h" | 10 #include "services/service_manager/public/c/main.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 private: | 33 private: |
34 // service_manager::Service: | 34 // service_manager::Service: |
35 void OnStart(const ServiceInfo& info) override { | 35 void OnStart(const ServiceInfo& info) override { |
36 identity_ = info.identity; | 36 identity_ = info.identity; |
37 } | 37 } |
38 bool OnConnect(const ServiceInfo& remote_info, | 38 bool OnConnect(const ServiceInfo& remote_info, |
39 InterfaceRegistry* registry) override { | 39 InterfaceRegistry* registry) override { |
40 registry->AddInterface<test::mojom::ConnectTestService>(this); | 40 registry->AddInterface<test::mojom::ConnectTestService>(this); |
41 registry->AddInterface<test::mojom::ClassInterface>(this); | 41 registry->AddInterface<test::mojom::ClassInterface>(this); |
42 inbound_connections_.insert(registry); | 42 inbound_connections_.insert(registry); |
43 registry->SetConnectionLostClosure( | 43 registry->AddConnectionLostClosure( |
44 base::Bind(&ConnectTestClassApp::OnConnectionError, | 44 base::Bind(&ConnectTestClassApp::OnConnectionError, |
45 base::Unretained(this), registry)); | 45 base::Unretained(this), registry)); |
46 return true; | 46 return true; |
47 } | 47 } |
48 | 48 |
49 // InterfaceFactory<test::mojom::ConnectTestService>: | 49 // InterfaceFactory<test::mojom::ConnectTestService>: |
50 void Create(const Identity& remote_identity, | 50 void Create(const Identity& remote_identity, |
51 test::mojom::ConnectTestServiceRequest request) override { | 51 test::mojom::ConnectTestServiceRequest request) override { |
52 bindings_.AddBinding(this, std::move(request)); | 52 bindings_.AddBinding(this, std::move(request)); |
53 } | 53 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 DISALLOW_COPY_AND_ASSIGN(ConnectTestClassApp); | 87 DISALLOW_COPY_AND_ASSIGN(ConnectTestClassApp); |
88 }; | 88 }; |
89 | 89 |
90 } // namespace service_manager | 90 } // namespace service_manager |
91 | 91 |
92 MojoResult ServiceMain(MojoHandle service_request_handle) { | 92 MojoResult ServiceMain(MojoHandle service_request_handle) { |
93 service_manager::ServiceRunner runner( | 93 service_manager::ServiceRunner runner( |
94 new service_manager::ConnectTestClassApp); | 94 new service_manager::ConnectTestClassApp); |
95 return runner.Run(service_request_handle); | 95 return runner.Run(service_request_handle); |
96 } | 96 } |
OLD | NEW |