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 "services/shell/tests/lifecycle/app_client.h" | 5 #include "services/shell/tests/lifecycle/app_client.h" |
6 | 6 |
7 #include "services/shell/public/cpp/shell_connection.h" | 7 #include "services/shell/public/cpp/shell_connection.h" |
8 | 8 |
9 namespace mojo { | |
10 namespace shell { | 9 namespace shell { |
11 namespace test { | 10 namespace test { |
12 | 11 |
13 AppClient::AppClient() {} | 12 AppClient::AppClient() {} |
14 AppClient::AppClient(shell::mojom::ShellClientRequest request) | 13 AppClient::AppClient(shell::mojom::ShellClientRequest request) |
15 : connection_(new ShellConnection(this, std::move(request))) {} | 14 : connection_(new ShellConnection(this, std::move(request))) {} |
16 AppClient::~AppClient() {} | 15 AppClient::~AppClient() {} |
17 | 16 |
18 bool AppClient::AcceptConnection(mojo::Connection* connection) { | 17 bool AppClient::AcceptConnection(Connection* connection) { |
19 connection->AddInterface<LifecycleControl>(this); | 18 connection->AddInterface<LifecycleControl>(this); |
20 return true; | 19 return true; |
21 } | 20 } |
22 | 21 |
23 void AppClient::Create(mojo::Connection* connection, | 22 void AppClient::Create(Connection* connection, |
24 LifecycleControlRequest request) { | 23 LifecycleControlRequest request) { |
25 bindings_.AddBinding(this, std::move(request)); | 24 bindings_.AddBinding(this, std::move(request)); |
26 } | 25 } |
27 | 26 |
28 void AppClient::Ping(const PingCallback& callback) { | 27 void AppClient::Ping(const PingCallback& callback) { |
29 callback.Run(); | 28 callback.Run(); |
30 } | 29 } |
31 | 30 |
32 void AppClient::GracefulQuit() { | 31 void AppClient::GracefulQuit() { |
33 base::MessageLoop::current()->QuitWhenIdle(); | 32 base::MessageLoop::current()->QuitWhenIdle(); |
(...skipping 14 matching lines...) Expand all Loading... |
48 base::Bind(&AppClient::BindingLost, base::Unretained(this))); | 47 base::Bind(&AppClient::BindingLost, base::Unretained(this))); |
49 } | 48 } |
50 | 49 |
51 void AppClient::BindingLost() { | 50 void AppClient::BindingLost() { |
52 if (bindings_.empty()) | 51 if (bindings_.empty()) |
53 GracefulQuit(); | 52 GracefulQuit(); |
54 } | 53 } |
55 | 54 |
56 } // namespace test | 55 } // namespace test |
57 } // namespace shell | 56 } // namespace shell |
58 } // namespace mojo | |
59 | 57 |
60 | 58 |
OLD | NEW |