| 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 14 matching lines...) Expand all Loading... |
| 25 public InterfaceFactory<test::mojom::ConnectTestService>, | 25 public InterfaceFactory<test::mojom::ConnectTestService>, |
| 26 public InterfaceFactory<test::mojom::ClassInterface>, | 26 public InterfaceFactory<test::mojom::ClassInterface>, |
| 27 public test::mojom::ConnectTestService, | 27 public test::mojom::ConnectTestService, |
| 28 public test::mojom::ClassInterface { | 28 public test::mojom::ClassInterface { |
| 29 public: | 29 public: |
| 30 ConnectTestClassApp() {} | 30 ConnectTestClassApp() {} |
| 31 ~ConnectTestClassApp() override {} | 31 ~ConnectTestClassApp() override {} |
| 32 | 32 |
| 33 private: | 33 private: |
| 34 // service_manager::Service: | 34 // service_manager::Service: |
| 35 void OnStart(const Identity& identity) override { | 35 void OnStart(const ServiceInfo& info) override { |
| 36 identity_ = identity; | 36 identity_ = info.identity; |
| 37 } | 37 } |
| 38 bool OnConnect(const Identity& remote_identity, | 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->SetConnectionLostClosure( |
| 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 |
| (...skipping 38 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 |