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/c/system/main.h" | 9 #include "mojo/public/c/system/main.h" |
10 #include "mojo/public/cpp/bindings/binding_set.h" | 10 #include "mojo/public/cpp/bindings/binding_set.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 ~ConnectTestClassApp() override {} | 30 ~ConnectTestClassApp() override {} |
31 | 31 |
32 private: | 32 private: |
33 // shell::ShellClient: | 33 // shell::ShellClient: |
34 void Initialize(Connector* connector, const Identity& identity, | 34 void Initialize(Connector* connector, const Identity& identity, |
35 uint32_t id) override { | 35 uint32_t id) override { |
36 connector_ = connector; | 36 connector_ = connector; |
37 identity_ = identity; | 37 identity_ = identity; |
38 } | 38 } |
39 bool AcceptConnection(Connection* connection) override { | 39 bool AcceptConnection(Connection* connection) override { |
| 40 CHECK(connection->HasCapabilityClass("class")); |
40 connection->AddInterface<test::mojom::ConnectTestService>(this); | 41 connection->AddInterface<test::mojom::ConnectTestService>(this); |
41 connection->AddInterface<test::mojom::ClassInterface>(this); | 42 connection->AddInterface<test::mojom::ClassInterface>(this); |
42 inbound_connections_.insert(connection); | 43 inbound_connections_.insert(connection); |
43 connection->SetConnectionLostClosure( | 44 connection->SetConnectionLostClosure( |
44 base::Bind(&ConnectTestClassApp::OnConnectionError, | 45 base::Bind(&ConnectTestClassApp::OnConnectionError, |
45 base::Unretained(this), connection)); | 46 base::Unretained(this), connection)); |
46 return true; | 47 return true; |
47 } | 48 } |
48 | 49 |
49 // InterfaceFactory<test::mojom::ConnectTestService>: | 50 // InterfaceFactory<test::mojom::ConnectTestService>: |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 }; | 90 }; |
90 | 91 |
91 } // namespace shell | 92 } // namespace shell |
92 | 93 |
93 | 94 |
94 MojoResult MojoMain(MojoHandle shell_handle) { | 95 MojoResult MojoMain(MojoHandle shell_handle) { |
95 MojoResult rv = shell::ApplicationRunner(new shell::ConnectTestClassApp) | 96 MojoResult rv = shell::ApplicationRunner(new shell::ConnectTestClassApp) |
96 .Run(shell_handle); | 97 .Run(shell_handle); |
97 return rv; | 98 return rv; |
98 } | 99 } |
OLD | NEW |