| 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 29 matching lines...) Expand all Loading... |
| 40 connection->AddInterface<test::mojom::ConnectTestService>(this); | 40 connection->AddInterface<test::mojom::ConnectTestService>(this); |
| 41 connection->AddInterface<test::mojom::ClassInterface>(this); | 41 connection->AddInterface<test::mojom::ClassInterface>(this); |
| 42 inbound_connections_.insert(connection); | 42 inbound_connections_.insert(connection); |
| 43 connection->SetConnectionLostClosure( | 43 connection->SetConnectionLostClosure( |
| 44 base::Bind(&ConnectTestClassApp::OnConnectionError, | 44 base::Bind(&ConnectTestClassApp::OnConnectionError, |
| 45 base::Unretained(this), connection)); | 45 base::Unretained(this), connection)); |
| 46 return true; | 46 return true; |
| 47 } | 47 } |
| 48 | 48 |
| 49 // InterfaceFactory<test::mojom::ConnectTestService>: | 49 // InterfaceFactory<test::mojom::ConnectTestService>: |
| 50 void Create(Connection* connection, | 50 void Create(const Identity& remote_identity, |
| 51 test::mojom::ConnectTestServiceRequest request) override { | 51 test::mojom::ConnectTestServiceRequest request) override { |
| 52 bindings_.AddBinding(this, std::move(request)); | 52 bindings_.AddBinding(this, std::move(request)); |
| 53 } | 53 } |
| 54 | 54 |
| 55 // InterfaceFactory<test::mojom::ClassInterface>: | 55 // InterfaceFactory<test::mojom::ClassInterface>: |
| 56 void Create(Connection* connection, | 56 void Create(const Identity& remote_identity, |
| 57 test::mojom::ClassInterfaceRequest request) override { | 57 test::mojom::ClassInterfaceRequest request) override { |
| 58 class_interface_bindings_.AddBinding(this, std::move(request)); | 58 class_interface_bindings_.AddBinding(this, std::move(request)); |
| 59 } | 59 } |
| 60 | 60 |
| 61 // test::mojom::ConnectTestService: | 61 // test::mojom::ConnectTestService: |
| 62 void GetTitle(const GetTitleCallback& callback) override { | 62 void GetTitle(const GetTitleCallback& callback) override { |
| 63 callback.Run("CLASS APP"); | 63 callback.Run("CLASS APP"); |
| 64 } | 64 } |
| 65 void GetInstance(const GetInstanceCallback& callback) override { | 65 void GetInstance(const GetInstanceCallback& callback) override { |
| 66 callback.Run(identity_.instance()); | 66 callback.Run(identity_.instance()); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 89 }; | 89 }; |
| 90 | 90 |
| 91 } // namespace shell | 91 } // namespace shell |
| 92 | 92 |
| 93 | 93 |
| 94 MojoResult MojoMain(MojoHandle shell_handle) { | 94 MojoResult MojoMain(MojoHandle shell_handle) { |
| 95 MojoResult rv = shell::ServiceRunner(new shell::ConnectTestClassApp) | 95 MojoResult rv = shell::ServiceRunner(new shell::ConnectTestClassApp) |
| 96 .Run(shell_handle); | 96 .Run(shell_handle); |
| 97 return rv; | 97 return rv; |
| 98 } | 98 } |
| OLD | NEW |