OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "services/identity/identity_service.h" | 5 #include "services/identity/identity_service.h" |
6 | 6 |
7 #include "services/identity/identity_manager.h" | 7 #include "services/identity/identity_manager.h" |
8 #include "services/service_manager/public/cpp/connection.h" | 8 #include "services/service_manager/public/cpp/connection.h" |
9 #include "services/service_manager/public/cpp/interface_registry.h" | |
10 #include "services/service_manager/public/cpp/service_context.h" | 9 #include "services/service_manager/public/cpp/service_context.h" |
11 | 10 |
12 namespace identity { | 11 namespace identity { |
13 | 12 |
14 IdentityService::IdentityService(SigninManagerBase* signin_manager) | 13 IdentityService::IdentityService(SigninManagerBase* signin_manager) |
15 : signin_manager_(signin_manager) {} | 14 : signin_manager_(signin_manager) { |
| 15 registry_.AddInterface<mojom::IdentityManager>(this); |
| 16 } |
16 | 17 |
17 IdentityService::~IdentityService() {} | 18 IdentityService::~IdentityService() {} |
18 | 19 |
19 void IdentityService::OnStart() {} | 20 void IdentityService::OnStart() {} |
20 | 21 |
21 bool IdentityService::OnConnect(const service_manager::ServiceInfo& remote_info, | 22 void IdentityService::OnBindInterface( |
22 service_manager::InterfaceRegistry* registry) { | 23 const service_manager::ServiceInfo& source_info, |
23 registry->AddInterface<mojom::IdentityManager>(this); | 24 const std::string& interface_name, |
24 return true; | 25 mojo::ScopedMessagePipeHandle interface_pipe) { |
| 26 registry_.BindInterface(source_info.identity, interface_name, |
| 27 std::move(interface_pipe)); |
25 } | 28 } |
26 | 29 |
27 void IdentityService::Create(const service_manager::Identity& remote_identity, | 30 void IdentityService::Create(const service_manager::Identity& remote_identity, |
28 mojom::IdentityManagerRequest request) { | 31 mojom::IdentityManagerRequest request) { |
29 IdentityManager::Create(std::move(request), signin_manager_); | 32 IdentityManager::Create(std::move(request), signin_manager_); |
30 } | 33 } |
31 | 34 |
32 } // namespace identity | 35 } // namespace identity |
OLD | NEW |