| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 state->initialize_local_name = identity_.name(); | 84 state->initialize_local_name = identity_.name(); |
| 85 state->initialize_id = id_; | 85 state->initialize_id = id_; |
| 86 state->initialize_userid = identity_.user_id(); | 86 state->initialize_userid = identity_.user_id(); |
| 87 connection->GetInterface(&caller_); | 87 connection->GetInterface(&caller_); |
| 88 caller_->ConnectionAccepted(std::move(state)); | 88 caller_->ConnectionAccepted(std::move(state)); |
| 89 | 89 |
| 90 return true; | 90 return true; |
| 91 } | 91 } |
| 92 | 92 |
| 93 // InterfaceFactory<test::mojom::ConnectTestService>: | 93 // InterfaceFactory<test::mojom::ConnectTestService>: |
| 94 void Create(Connection* connection, | 94 void Create(const Identity& remote_identity, |
| 95 test::mojom::ConnectTestServiceRequest request) override { | 95 test::mojom::ConnectTestServiceRequest request) override { |
| 96 bindings_.AddBinding(this, std::move(request)); | 96 bindings_.AddBinding(this, std::move(request)); |
| 97 } | 97 } |
| 98 | 98 |
| 99 // InterfaceFactory<test::mojom::BlockedInterface>: | 99 // InterfaceFactory<test::mojom::BlockedInterface>: |
| 100 void Create(Connection* connection, | 100 void Create(const Identity& remote_identity, |
| 101 test::mojom::BlockedInterfaceRequest request) override { | 101 test::mojom::BlockedInterfaceRequest request) override { |
| 102 blocked_bindings_.AddBinding(this, std::move(request)); | 102 blocked_bindings_.AddBinding(this, std::move(request)); |
| 103 } | 103 } |
| 104 | 104 |
| 105 // InterfaceFactory<test::mojom::UserIdTest>: | 105 // InterfaceFactory<test::mojom::UserIdTest>: |
| 106 void Create(Connection* connection, | 106 void Create(const Identity& remote_identity, |
| 107 test::mojom::UserIdTestRequest request) override { | 107 test::mojom::UserIdTestRequest request) override { |
| 108 user_id_test_bindings_.AddBinding(this, std::move(request)); | 108 user_id_test_bindings_.AddBinding(this, std::move(request)); |
| 109 } | 109 } |
| 110 | 110 |
| 111 // test::mojom::ConnectTestService: | 111 // test::mojom::ConnectTestService: |
| 112 void GetTitle(const GetTitleCallback& callback) override { | 112 void GetTitle(const GetTitleCallback& callback) override { |
| 113 callback.Run(title_); | 113 callback.Run(title_); |
| 114 } | 114 } |
| 115 void GetInstance(const GetInstanceCallback& callback) override { | 115 void GetInstance(const GetInstanceCallback& callback) override { |
| 116 callback.Run(identity_.instance()); | 116 callback.Run(identity_.instance()); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 base::Bind(&ConnectTestService::OnConnectionError, | 182 base::Bind(&ConnectTestService::OnConnectionError, |
| 183 base::Unretained(this))); | 183 base::Unretained(this))); |
| 184 } | 184 } |
| 185 bool OnConnect(Connection* connection) override { | 185 bool OnConnect(Connection* connection) override { |
| 186 connection->AddInterface<ServiceFactory>(this); | 186 connection->AddInterface<ServiceFactory>(this); |
| 187 connection->AddInterface<test::mojom::ConnectTestService>(this); | 187 connection->AddInterface<test::mojom::ConnectTestService>(this); |
| 188 return true; | 188 return true; |
| 189 } | 189 } |
| 190 | 190 |
| 191 // InterfaceFactory<mojom::ServiceFactory>: | 191 // InterfaceFactory<mojom::ServiceFactory>: |
| 192 void Create(Connection* connection, | 192 void Create(const Identity& remote_identity, |
| 193 mojom::ServiceFactoryRequest request) override { | 193 mojom::ServiceFactoryRequest request) override { |
| 194 service_factory_bindings_.AddBinding(this, std::move(request)); | 194 service_factory_bindings_.AddBinding(this, std::move(request)); |
| 195 } | 195 } |
| 196 | 196 |
| 197 // InterfaceFactory<test::mojom::ConnectTestService>: | 197 // InterfaceFactory<test::mojom::ConnectTestService>: |
| 198 void Create(Connection* connection, | 198 void Create(const Identity& remote_identity, |
| 199 test::mojom::ConnectTestServiceRequest request) override { | 199 test::mojom::ConnectTestServiceRequest request) override { |
| 200 bindings_.AddBinding(this, std::move(request)); | 200 bindings_.AddBinding(this, std::move(request)); |
| 201 } | 201 } |
| 202 | 202 |
| 203 // mojom::ServiceFactory: | 203 // mojom::ServiceFactory: |
| 204 void CreateService(mojom::ServiceRequest request, | 204 void CreateService(mojom::ServiceRequest request, |
| 205 const mojo::String& name) override { | 205 const mojo::String& name) override { |
| 206 if (name == "mojo:connect_test_a") | 206 if (name == "mojo:connect_test_a") |
| 207 new ProvidedService("A", std::move(request)); | 207 new ProvidedService("A", std::move(request)); |
| 208 else if (name == "mojo:connect_test_b") | 208 else if (name == "mojo:connect_test_b") |
| (...skipping 21 matching lines...) Expand all Loading... |
| 230 DISALLOW_COPY_AND_ASSIGN(ConnectTestService); | 230 DISALLOW_COPY_AND_ASSIGN(ConnectTestService); |
| 231 }; | 231 }; |
| 232 | 232 |
| 233 } // namespace shell | 233 } // namespace shell |
| 234 | 234 |
| 235 MojoResult MojoMain(MojoHandle shell_handle) { | 235 MojoResult MojoMain(MojoHandle shell_handle) { |
| 236 MojoResult rv = shell::ServiceRunner(new shell::ConnectTestService) | 236 MojoResult rv = shell::ServiceRunner(new shell::ConnectTestService) |
| 237 .Run(shell_handle); | 237 .Run(shell_handle); |
| 238 return rv; | 238 return rv; |
| 239 } | 239 } |
| OLD | NEW |