| 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")); | |
| 41 connection->AddInterface<test::mojom::ConnectTestService>(this); | 40 connection->AddInterface<test::mojom::ConnectTestService>(this); |
| 42 connection->AddInterface<test::mojom::ClassInterface>(this); | 41 connection->AddInterface<test::mojom::ClassInterface>(this); |
| 43 inbound_connections_.insert(connection); | 42 inbound_connections_.insert(connection); |
| 44 connection->SetConnectionLostClosure( | 43 connection->SetConnectionLostClosure( |
| 45 base::Bind(&ConnectTestClassApp::OnConnectionError, | 44 base::Bind(&ConnectTestClassApp::OnConnectionError, |
| 46 base::Unretained(this), connection)); | 45 base::Unretained(this), connection)); |
| 47 return true; | 46 return true; |
| 48 } | 47 } |
| 49 | 48 |
| 50 // InterfaceFactory<test::mojom::ConnectTestService>: | 49 // InterfaceFactory<test::mojom::ConnectTestService>: |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 }; | 89 }; |
| 91 | 90 |
| 92 } // namespace shell | 91 } // namespace shell |
| 93 | 92 |
| 94 | 93 |
| 95 MojoResult MojoMain(MojoHandle shell_handle) { | 94 MojoResult MojoMain(MojoHandle shell_handle) { |
| 96 MojoResult rv = shell::ApplicationRunner(new shell::ConnectTestClassApp) | 95 MojoResult rv = shell::ApplicationRunner(new shell::ConnectTestClassApp) |
| 97 .Run(shell_handle); | 96 .Run(shell_handle); |
| 98 return rv; | 97 return rv; |
| 99 } | 98 } |
| OLD | NEW |