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 25 matching lines...) Expand all Loading... |
36 &ConnectTestClassApp::HandleInterfaceClose, base::Unretained(this))); | 36 &ConnectTestClassApp::HandleInterfaceClose, base::Unretained(this))); |
37 class_interface_bindings_.set_connection_error_handler(base::Bind( | 37 class_interface_bindings_.set_connection_error_handler(base::Bind( |
38 &ConnectTestClassApp::HandleInterfaceClose, base::Unretained(this))); | 38 &ConnectTestClassApp::HandleInterfaceClose, base::Unretained(this))); |
39 registry_.AddInterface<test::mojom::ConnectTestService>(this); | 39 registry_.AddInterface<test::mojom::ConnectTestService>(this); |
40 registry_.AddInterface<test::mojom::ClassInterface>(this); | 40 registry_.AddInterface<test::mojom::ClassInterface>(this); |
41 } | 41 } |
42 ~ConnectTestClassApp() override {} | 42 ~ConnectTestClassApp() override {} |
43 | 43 |
44 private: | 44 private: |
45 // service_manager::Service: | 45 // service_manager::Service: |
46 void OnBindInterface(const ServiceInfo& source_info, | 46 void OnBindInterface(const BindSourceInfo& source_info, |
47 const std::string& interface_name, | 47 const std::string& interface_name, |
48 mojo::ScopedMessagePipeHandle interface_pipe) override { | 48 mojo::ScopedMessagePipeHandle interface_pipe) override { |
49 registry_.BindInterface(source_info.identity, interface_name, | 49 registry_.BindInterface(source_info.identity, interface_name, |
50 std::move(interface_pipe)); | 50 std::move(interface_pipe)); |
51 } | 51 } |
52 | 52 |
53 // InterfaceFactory<test::mojom::ConnectTestService>: | 53 // InterfaceFactory<test::mojom::ConnectTestService>: |
54 void Create(const Identity& remote_identity, | 54 void Create(const Identity& remote_identity, |
55 test::mojom::ConnectTestServiceRequest request) override { | 55 test::mojom::ConnectTestServiceRequest request) override { |
56 refs_.push_back(ref_factory_.CreateRef()); | 56 refs_.push_back(ref_factory_.CreateRef()); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 DISALLOW_COPY_AND_ASSIGN(ConnectTestClassApp); | 90 DISALLOW_COPY_AND_ASSIGN(ConnectTestClassApp); |
91 }; | 91 }; |
92 | 92 |
93 } // namespace service_manager | 93 } // namespace service_manager |
94 | 94 |
95 MojoResult ServiceMain(MojoHandle service_request_handle) { | 95 MojoResult ServiceMain(MojoHandle service_request_handle) { |
96 service_manager::ServiceRunner runner( | 96 service_manager::ServiceRunner runner( |
97 new service_manager::ConnectTestClassApp); | 97 new service_manager::ConnectTestClassApp); |
98 return runner.Run(service_request_handle); | 98 return runner.Run(service_request_handle); |
99 } | 99 } |
OLD | NEW |