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/c/system/main.h" | 10 #include "mojo/public/c/system/main.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 } | 37 } |
38 | 38 |
39 private: | 39 private: |
40 // shell::Service: | 40 // shell::Service: |
41 bool OnConnect(shell::Connection* connection) override { | 41 bool OnConnect(shell::Connection* connection) override { |
42 connection->AddInterface<LifecycleControl>(this); | 42 connection->AddInterface<LifecycleControl>(this); |
43 return true; | 43 return true; |
44 } | 44 } |
45 | 45 |
46 // shell::InterfaceFactory<LifecycleControl> | 46 // shell::InterfaceFactory<LifecycleControl> |
47 void Create(shell::Connection* connection, | 47 void Create(const shell::Identity& remote_identity, |
48 LifecycleControlRequest request) override { | 48 LifecycleControlRequest request) override { |
49 bindings_.AddBinding(this, std::move(request)); | 49 bindings_.AddBinding(this, std::move(request)); |
50 } | 50 } |
51 | 51 |
52 // LifecycleControl: | 52 // LifecycleControl: |
53 void Ping(const PingCallback& callback) override { | 53 void Ping(const PingCallback& callback) override { |
54 callback.Run(); | 54 callback.Run(); |
55 } | 55 } |
56 void GracefulQuit() override { | 56 void GracefulQuit() override { |
57 shell_connection_closed_callback_.Run(this); | 57 shell_connection_closed_callback_.Run(this); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 } | 98 } |
99 | 99 |
100 private: | 100 private: |
101 // shell::test::AppClient: | 101 // shell::test::AppClient: |
102 bool OnConnect(shell::Connection* connection) override { | 102 bool OnConnect(shell::Connection* connection) override { |
103 connection->AddInterface<shell::mojom::ServiceFactory>(this); | 103 connection->AddInterface<shell::mojom::ServiceFactory>(this); |
104 return app_client_.OnConnect(connection); | 104 return app_client_.OnConnect(connection); |
105 } | 105 } |
106 | 106 |
107 // shell::InterfaceFactory<shell::mojom::ServiceFactory>: | 107 // shell::InterfaceFactory<shell::mojom::ServiceFactory>: |
108 void Create(shell::Connection* connection, | 108 void Create(const shell::Identity& remote_identity, |
109 shell::mojom::ServiceFactoryRequest request) override { | 109 shell::mojom::ServiceFactoryRequest request) override { |
110 bindings_.AddBinding(this, std::move(request)); | 110 bindings_.AddBinding(this, std::move(request)); |
111 } | 111 } |
112 | 112 |
113 // shell::mojom::ServiceFactory: | 113 // shell::mojom::ServiceFactory: |
114 void CreateService(shell::mojom::ServiceRequest request, | 114 void CreateService(shell::mojom::ServiceRequest request, |
115 const mojo::String& name) override { | 115 const mojo::String& name) override { |
116 ++shell_connection_refcount_; | 116 ++shell_connection_refcount_; |
117 apps_.push_back( | 117 apps_.push_back( |
118 new PackagedApp(std::move(request), | 118 new PackagedApp(std::move(request), |
(...skipping 25 matching lines...) Expand all Loading... |
144 }; | 144 }; |
145 | 145 |
146 } // namespace | 146 } // namespace |
147 | 147 |
148 MojoResult MojoMain(MojoHandle shell_handle) { | 148 MojoResult MojoMain(MojoHandle shell_handle) { |
149 Package* package = new Package; | 149 Package* package = new Package; |
150 shell::ServiceRunner runner(package); | 150 shell::ServiceRunner runner(package); |
151 package->set_runner(&runner); | 151 package->set_runner(&runner); |
152 return runner.Run(shell_handle); | 152 return runner.Run(shell_handle); |
153 } | 153 } |
OLD | NEW |