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 <algorithm> | 5 #include <algorithm> |
6 #include <memory> | 6 #include <memory> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "mojo/public/cpp/bindings/binding_set.h" | 10 #include "mojo/public/cpp/bindings/binding_set.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 destruct_callback_(destruct_callback) { | 31 destruct_callback_(destruct_callback) { |
32 bindings_.set_connection_error_handler(base::Bind(&PackagedApp::BindingLost, | 32 bindings_.set_connection_error_handler(base::Bind(&PackagedApp::BindingLost, |
33 base::Unretained(this))); | 33 base::Unretained(this))); |
34 } | 34 } |
35 ~PackagedApp() override { | 35 ~PackagedApp() override { |
36 destruct_callback_.Run(this); | 36 destruct_callback_.Run(this); |
37 } | 37 } |
38 | 38 |
39 private: | 39 private: |
40 // shell::Service: | 40 // shell::Service: |
41 bool OnConnect(shell::Connection* connection) override { | 41 bool OnConnect(const shell::Identity& remote_identity, |
42 connection->AddInterface<LifecycleControl>(this); | 42 shell::InterfaceRegistry* registry) override { |
| 43 registry->AddInterface<LifecycleControl>(this); |
43 return true; | 44 return true; |
44 } | 45 } |
45 | 46 |
46 // shell::InterfaceFactory<LifecycleControl> | 47 // shell::InterfaceFactory<LifecycleControl> |
47 void Create(const shell::Identity& remote_identity, | 48 void Create(const shell::Identity& remote_identity, |
48 LifecycleControlRequest request) override { | 49 LifecycleControlRequest request) override { |
49 bindings_.AddBinding(this, std::move(request)); | 50 bindings_.AddBinding(this, std::move(request)); |
50 } | 51 } |
51 | 52 |
52 // LifecycleControl: | 53 // LifecycleControl: |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 public: | 93 public: |
93 Package() {} | 94 Package() {} |
94 ~Package() override {} | 95 ~Package() override {} |
95 | 96 |
96 void set_runner(shell::ServiceRunner* runner) { | 97 void set_runner(shell::ServiceRunner* runner) { |
97 app_client_.set_runner(runner); | 98 app_client_.set_runner(runner); |
98 } | 99 } |
99 | 100 |
100 private: | 101 private: |
101 // shell::test::AppClient: | 102 // shell::test::AppClient: |
102 bool OnConnect(shell::Connection* connection) override { | 103 bool OnConnect(const shell::Identity& remote_identity, |
103 connection->AddInterface<shell::mojom::ServiceFactory>(this); | 104 shell::InterfaceRegistry* registry) override { |
104 return app_client_.OnConnect(connection); | 105 registry->AddInterface<shell::mojom::ServiceFactory>(this); |
| 106 return app_client_.OnConnect(remote_identity, registry); |
105 } | 107 } |
106 | 108 |
107 // shell::InterfaceFactory<shell::mojom::ServiceFactory>: | 109 // shell::InterfaceFactory<shell::mojom::ServiceFactory>: |
108 void Create(const shell::Identity& remote_identity, | 110 void Create(const shell::Identity& remote_identity, |
109 shell::mojom::ServiceFactoryRequest request) override { | 111 shell::mojom::ServiceFactoryRequest request) override { |
110 bindings_.AddBinding(this, std::move(request)); | 112 bindings_.AddBinding(this, std::move(request)); |
111 } | 113 } |
112 | 114 |
113 // shell::mojom::ServiceFactory: | 115 // shell::mojom::ServiceFactory: |
114 void CreateService(shell::mojom::ServiceRequest request, | 116 void CreateService(shell::mojom::ServiceRequest request, |
(...skipping 29 matching lines...) Expand all Loading... |
144 }; | 146 }; |
145 | 147 |
146 } // namespace | 148 } // namespace |
147 | 149 |
148 MojoResult ServiceMain(MojoHandle service_request_handle) { | 150 MojoResult ServiceMain(MojoHandle service_request_handle) { |
149 Package* package = new Package; | 151 Package* package = new Package; |
150 shell::ServiceRunner runner(package); | 152 shell::ServiceRunner runner(package); |
151 package->set_runner(&runner); | 153 package->set_runner(&runner); |
152 return runner.Run(service_request_handle); | 154 return runner.Run(service_request_handle); |
153 } | 155 } |
OLD | NEW |