| 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 "mojo/public/cpp/bindings/binding_set.h" | 5 #include "mojo/public/cpp/bindings/binding_set.h" |
| 6 #include "services/service_manager/background/tests/test.mojom.h" | 6 #include "services/service_manager/background/tests/test.mojom.h" |
| 7 #include "services/service_manager/public/c/main.h" | 7 #include "services/service_manager/public/c/main.h" |
| 8 #include "services/service_manager/public/cpp/interface_registry.h" | 8 #include "services/service_manager/public/cpp/interface_registry.h" |
| 9 #include "services/service_manager/public/cpp/service.h" | 9 #include "services/service_manager/public/cpp/service.h" |
| 10 #include "services/service_manager/public/cpp/service_runner.h" | 10 #include "services/service_manager/public/cpp/service_runner.h" |
| 11 | 11 |
| 12 namespace service_manager { | 12 namespace service_manager { |
| 13 | 13 |
| 14 class TestClient : public Service, | 14 class TestClient : public Service, |
| 15 public InterfaceFactory<mojom::TestService>, | 15 public InterfaceFactory<mojom::TestService>, |
| 16 public mojom::TestService { | 16 public mojom::TestService { |
| 17 public: | 17 public: |
| 18 TestClient() {} | 18 TestClient() {} |
| 19 ~TestClient() override {} | 19 ~TestClient() override {} |
| 20 | 20 |
| 21 private: | 21 private: |
| 22 // Service: | 22 // Service: |
| 23 bool OnConnect(const Identity& remote_identity, | 23 bool OnConnect(const ServiceInfo& remote_info, |
| 24 InterfaceRegistry* registry) override { | 24 InterfaceRegistry* registry) override { |
| 25 registry->AddInterface(this); | 25 registry->AddInterface(this); |
| 26 return true; | 26 return true; |
| 27 } | 27 } |
| 28 bool OnStop() override { | 28 bool OnStop() override { |
| 29 return true; | 29 return true; |
| 30 } | 30 } |
| 31 | 31 |
| 32 // InterfaceFactory<mojom::TestService>: | 32 // InterfaceFactory<mojom::TestService>: |
| 33 void Create(const Identity& remote_identity, | 33 void Create(const Identity& remote_identity, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 44 | 44 |
| 45 DISALLOW_COPY_AND_ASSIGN(TestClient); | 45 DISALLOW_COPY_AND_ASSIGN(TestClient); |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 } // namespace service_manager | 48 } // namespace service_manager |
| 49 | 49 |
| 50 MojoResult ServiceMain(MojoHandle service_request_handle) { | 50 MojoResult ServiceMain(MojoHandle service_request_handle) { |
| 51 service_manager::ServiceRunner runner(new service_manager::TestClient); | 51 service_manager::ServiceRunner runner(new service_manager::TestClient); |
| 52 return runner.Run(service_request_handle); | 52 return runner.Run(service_request_handle); |
| 53 } | 53 } |
| OLD | NEW |