OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef CONTENT_PUBLIC_TEST_TEST_SERVICE_H_ | 5 #ifndef CONTENT_PUBLIC_TEST_TEST_SERVICE_H_ |
6 #define CONTENT_PUBLIC_TEST_TEST_SERVICE_H_ | 6 #define CONTENT_PUBLIC_TEST_TEST_SERVICE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "content/public/test/test_service.mojom.h" | 11 #include "content/public/test/test_service.mojom.h" |
12 #include "mojo/public/cpp/bindings/binding.h" | 12 #include "mojo/public/cpp/bindings/binding.h" |
| 13 #include "services/service_manager/public/cpp/binder_registry.h" |
13 #include "services/service_manager/public/cpp/interface_factory.h" | 14 #include "services/service_manager/public/cpp/interface_factory.h" |
14 #include "services/service_manager/public/cpp/service.h" | 15 #include "services/service_manager/public/cpp/service.h" |
15 | 16 |
16 namespace content { | 17 namespace content { |
17 | 18 |
18 extern const char kTestServiceUrl[]; | 19 extern const char kTestServiceUrl[]; |
19 | 20 |
20 // Simple Service which provides a mojom::TestService impl. The service | 21 // Simple Service which provides a mojom::TestService impl. The service |
21 // terminates itself after its TestService fulfills a single DoSomething call. | 22 // terminates itself after its TestService fulfills a single DoSomething call. |
22 class TestService | 23 class TestService |
23 : public service_manager::Service, | 24 : public service_manager::Service, |
24 public service_manager::InterfaceFactory<mojom::TestService>, | 25 public service_manager::InterfaceFactory<mojom::TestService>, |
25 public mojom::TestService { | 26 public mojom::TestService { |
26 public: | 27 public: |
27 TestService(); | 28 TestService(); |
28 ~TestService() override; | 29 ~TestService() override; |
29 | 30 |
30 private: | 31 private: |
31 // service_manager::Service: | 32 // service_manager::Service: |
32 bool OnConnect(const service_manager::ServiceInfo& remote_info, | 33 void OnBindInterface(const service_manager::ServiceInfo& source_info, |
33 service_manager::InterfaceRegistry* registry) override; | 34 const std::string& interface_name, |
| 35 mojo::ScopedMessagePipeHandle interface_pipe) override; |
34 | 36 |
35 // service_manager::InterfaceFactory<mojom::TestService>: | 37 // service_manager::InterfaceFactory<mojom::TestService>: |
36 void Create(const service_manager::Identity& remote_identity, | 38 void Create(const service_manager::Identity& remote_identity, |
37 mojom::TestServiceRequest request) override; | 39 mojom::TestServiceRequest request) override; |
38 | 40 |
39 // TestService: | 41 // TestService: |
40 void DoSomething(const DoSomethingCallback& callback) override; | 42 void DoSomething(const DoSomethingCallback& callback) override; |
41 void DoTerminateProcess(const DoTerminateProcessCallback& callback) override; | 43 void DoTerminateProcess(const DoTerminateProcessCallback& callback) override; |
42 void CreateFolder(const CreateFolderCallback& callback) override; | 44 void CreateFolder(const CreateFolderCallback& callback) override; |
43 void GetRequestorName(const GetRequestorNameCallback& callback) override; | 45 void GetRequestorName(const GetRequestorNameCallback& callback) override; |
44 void CreateSharedBuffer(const std::string& message, | 46 void CreateSharedBuffer(const std::string& message, |
45 const CreateSharedBufferCallback& callback) override; | 47 const CreateSharedBufferCallback& callback) override; |
46 | 48 |
| 49 service_manager::BinderRegistry registry_; |
47 mojo::Binding<mojom::TestService> service_binding_; | 50 mojo::Binding<mojom::TestService> service_binding_; |
48 | 51 |
49 // The name of the app connecting to us. | 52 // The name of the app connecting to us. |
50 std::string requestor_name_; | 53 std::string requestor_name_; |
51 | 54 |
52 DISALLOW_COPY_AND_ASSIGN(TestService); | 55 DISALLOW_COPY_AND_ASSIGN(TestService); |
53 }; | 56 }; |
54 | 57 |
55 } // namespace content | 58 } // namespace content |
56 | 59 |
57 #endif // CONTENT_PUBLIC_TEST_TEST_SERVICE_H_ | 60 #endif // CONTENT_PUBLIC_TEST_TEST_SERVICE_H_ |
OLD | NEW |