| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 title_(title), | 54 title_(title), |
| 55 request_(std::move(request)) { | 55 request_(std::move(request)) { |
| 56 Start(); | 56 Start(); |
| 57 } | 57 } |
| 58 ~ProvidedService() override { | 58 ~ProvidedService() override { |
| 59 Join(); | 59 Join(); |
| 60 } | 60 } |
| 61 | 61 |
| 62 private: | 62 private: |
| 63 // service_manager::Service: | 63 // service_manager::Service: |
| 64 void OnStart(const Identity& identity) override { | 64 void OnStart(const ServiceInfo& info) override { |
| 65 identity_ = identity; | 65 identity_ = info.identity; |
| 66 bindings_.set_connection_error_handler( | 66 bindings_.set_connection_error_handler( |
| 67 base::Bind(&ProvidedService::OnConnectionError, | 67 base::Bind(&ProvidedService::OnConnectionError, |
| 68 base::Unretained(this))); | 68 base::Unretained(this))); |
| 69 } | 69 } |
| 70 bool OnConnect(const Identity& remote_identity, | 70 bool OnConnect(const ServiceInfo& remote_info, |
| 71 InterfaceRegistry* registry) override { | 71 InterfaceRegistry* registry) override { |
| 72 registry->AddInterface<test::mojom::ConnectTestService>(this); | 72 registry->AddInterface<test::mojom::ConnectTestService>(this); |
| 73 registry->AddInterface<test::mojom::BlockedInterface>(this); | 73 registry->AddInterface<test::mojom::BlockedInterface>(this); |
| 74 registry->AddInterface<test::mojom::UserIdTest>(this); | 74 registry->AddInterface<test::mojom::UserIdTest>(this); |
| 75 | 75 |
| 76 test::mojom::ConnectionStatePtr state(test::mojom::ConnectionState::New()); | 76 test::mojom::ConnectionStatePtr state(test::mojom::ConnectionState::New()); |
| 77 state->connection_remote_name = remote_identity.name(); | 77 state->connection_remote_name = remote_info.identity.name(); |
| 78 state->connection_remote_userid = remote_identity.user_id(); | 78 state->connection_remote_userid = remote_info.identity.user_id(); |
| 79 state->initialize_local_name = identity_.name(); | 79 state->initialize_local_name = identity_.name(); |
| 80 state->initialize_userid = identity_.user_id(); | 80 state->initialize_userid = identity_.user_id(); |
| 81 | 81 |
| 82 connector()->ConnectToInterface(remote_identity, &caller_); | 82 connector()->ConnectToInterface(remote_identity, &caller_); |
| 83 caller_->ConnectionAccepted(std::move(state)); | 83 caller_->ConnectionAccepted(std::move(state)); |
| 84 | 84 |
| 85 return true; | 85 return true; |
| 86 } | 86 } |
| 87 | 87 |
| 88 // InterfaceFactory<test::mojom::ConnectTestService>: | 88 // InterfaceFactory<test::mojom::ConnectTestService>: |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 DISALLOW_COPY_AND_ASSIGN(ConnectTestService); | 224 DISALLOW_COPY_AND_ASSIGN(ConnectTestService); |
| 225 }; | 225 }; |
| 226 | 226 |
| 227 } // namespace service_manager | 227 } // namespace service_manager |
| 228 | 228 |
| 229 MojoResult ServiceMain(MojoHandle service_request_handle) { | 229 MojoResult ServiceMain(MojoHandle service_request_handle) { |
| 230 service_manager::ServiceRunner runner( | 230 service_manager::ServiceRunner runner( |
| 231 new service_manager::ConnectTestService); | 231 new service_manager::ConnectTestService); |
| 232 return runner.Run(service_request_handle); | 232 return runner.Run(service_request_handle); |
| 233 } | 233 } |
| OLD | NEW |