| 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 "chrome/browser/prefs/active_profile_pref_service.h" | 5 #include "chrome/browser/prefs/active_profile_pref_service.h" |
| 6 | 6 |
| 7 #include "chrome/browser/profiles/profile_manager.h" | 7 #include "chrome/browser/profiles/profile_manager.h" |
| 8 #include "content/public/browser/browser_context.h" | 8 #include "content/public/browser/browser_context.h" |
| 9 #include "mojo/public/cpp/bindings/interface_request.h" | 9 #include "mojo/public/cpp/bindings/interface_request.h" |
| 10 #include "services/service_manager/public/cpp/connector.h" | 10 #include "services/service_manager/public/cpp/connector.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 void ActiveProfilePrefService::Create( | 31 void ActiveProfilePrefService::Create( |
| 32 const service_manager::Identity& remote_identity, | 32 const service_manager::Identity& remote_identity, |
| 33 prefs::mojom::PrefStoreConnectorRequest request) { | 33 prefs::mojom::PrefStoreConnectorRequest request) { |
| 34 connector_bindings_.AddBinding(this, std::move(request)); | 34 connector_bindings_.AddBinding(this, std::move(request)); |
| 35 } | 35 } |
| 36 | 36 |
| 37 void ActiveProfilePrefService::OnStart() {} | 37 void ActiveProfilePrefService::OnStart() {} |
| 38 | 38 |
| 39 void ActiveProfilePrefService::OnBindInterface( | 39 void ActiveProfilePrefService::OnBindInterface( |
| 40 const service_manager::ServiceInfo& source_info, | 40 const service_manager::BindSourceInfo& source_info, |
| 41 const std::string& interface_name, | 41 const std::string& interface_name, |
| 42 mojo::ScopedMessagePipeHandle interface_pipe) { | 42 mojo::ScopedMessagePipeHandle interface_pipe) { |
| 43 // N.B. This check is important as not doing it would allow one user to read | 43 // N.B. This check is important as not doing it would allow one user to read |
| 44 // another user's prefs. | 44 // another user's prefs. |
| 45 // TODO(beng): This should be obsoleted by Service Manager user id routing. | 45 // TODO(beng): This should be obsoleted by Service Manager user id routing. |
| 46 if (source_info.identity.user_id() != service_manager::mojom::kRootUserID) { | 46 if (source_info.identity.user_id() != service_manager::mojom::kRootUserID) { |
| 47 LOG(WARNING) << "Blocked service instance=" | 47 LOG(WARNING) << "Blocked service instance=" |
| 48 << source_info.identity.instance() | 48 << source_info.identity.instance() |
| 49 << ", name=" << source_info.identity.name() | 49 << ", name=" << source_info.identity.name() |
| 50 << ", user_id=" << source_info.identity.user_id() | 50 << ", user_id=" << source_info.identity.user_id() |
| 51 << " from connecting to the active profile's pref service."; | 51 << " from connecting to the active profile's pref service."; |
| 52 return; | 52 return; |
| 53 } | 53 } |
| 54 registry_.BindInterface(source_info.identity, interface_name, | 54 registry_.BindInterface(source_info.identity, interface_name, |
| 55 std::move(interface_pipe)); | 55 std::move(interface_pipe)); |
| 56 } | 56 } |
| 57 | 57 |
| 58 void ActiveProfilePrefService::OnConnectError() { | 58 void ActiveProfilePrefService::OnConnectError() { |
| 59 connector_bindings_.CloseAllBindings(); | 59 connector_bindings_.CloseAllBindings(); |
| 60 } | 60 } |
| OLD | NEW |