| 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 #ifndef CHROME_BROWSER_PREFS_ACTIVE_PROFILE_PREF_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_PREFS_ACTIVE_PROFILE_PREF_SERVICE_H_ |
| 6 #define CHROME_BROWSER_PREFS_ACTIVE_PROFILE_PREF_SERVICE_H_ | 6 #define CHROME_BROWSER_PREFS_ACTIVE_PROFILE_PREF_SERVICE_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "components/prefs/pref_value_store.h" | 11 #include "components/prefs/pref_value_store.h" |
| 12 #include "mojo/public/cpp/bindings/binding_set.h" | 12 #include "mojo/public/cpp/bindings/binding_set.h" |
| 13 #include "services/preferences/public/interfaces/preferences.mojom.h" | 13 #include "services/preferences/public/interfaces/preferences.mojom.h" |
| 14 #include "services/service_manager/public/cpp/binder_registry.h" |
| 14 #include "services/service_manager/public/cpp/interface_factory.h" | 15 #include "services/service_manager/public/cpp/interface_factory.h" |
| 15 #include "services/service_manager/public/cpp/service.h" | 16 #include "services/service_manager/public/cpp/service.h" |
| 16 | 17 |
| 17 // A |prefs::mojom::PrefStoreConnector| implementation that forwards connection | 18 // A |prefs::mojom::PrefStoreConnector| implementation that forwards connection |
| 18 // calls from the root service to the active profile. Used by mash, which runs | 19 // calls from the root service to the active profile. Used by mash, which runs |
| 19 // as the root user, to talk to prefs. | 20 // as the root user, to talk to prefs. |
| 20 // | 21 // |
| 21 // TODO(http://crbug.com/705347): Once mash supports several profiles, remove | 22 // TODO(http://crbug.com/705347): Once mash supports several profiles, remove |
| 22 // this class and the forwarder service. | 23 // this class and the forwarder service. |
| 23 class ActiveProfilePrefService : public prefs::mojom::PrefStoreConnector, | 24 class ActiveProfilePrefService : public prefs::mojom::PrefStoreConnector, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 34 prefs::mojom::PrefRegistryPtr pref_registry, | 35 prefs::mojom::PrefRegistryPtr pref_registry, |
| 35 const std::vector<PrefValueStore::PrefStoreType>& already_connected_types, | 36 const std::vector<PrefValueStore::PrefStoreType>& already_connected_types, |
| 36 const ConnectCallback& callback) override; | 37 const ConnectCallback& callback) override; |
| 37 | 38 |
| 38 // service_manager::InterfaceFactory<PrefStoreConnector>: | 39 // service_manager::InterfaceFactory<PrefStoreConnector>: |
| 39 void Create(const service_manager::Identity& remote_identity, | 40 void Create(const service_manager::Identity& remote_identity, |
| 40 prefs::mojom::PrefStoreConnectorRequest request) override; | 41 prefs::mojom::PrefStoreConnectorRequest request) override; |
| 41 | 42 |
| 42 // service_manager::Service: | 43 // service_manager::Service: |
| 43 void OnStart() override; | 44 void OnStart() override; |
| 44 bool OnConnect(const service_manager::ServiceInfo& remote_info, | 45 void OnBindInterface(const service_manager::ServiceInfo& source_info, |
| 45 service_manager::InterfaceRegistry* registry) override; | 46 const std::string& interface_name, |
| 47 mojo::ScopedMessagePipeHandle interface_pipe) override; |
| 46 | 48 |
| 47 // Called if forwarding the connection request to the per-profile service | 49 // Called if forwarding the connection request to the per-profile service |
| 48 // instance failed. | 50 // instance failed. |
| 49 void OnConnectError(); | 51 void OnConnectError(); |
| 50 | 52 |
| 51 prefs::mojom::PrefStoreConnectorPtr connector_ptr_; | 53 prefs::mojom::PrefStoreConnectorPtr connector_ptr_; |
| 54 service_manager::BinderRegistry registry_; |
| 52 mojo::BindingSet<prefs::mojom::PrefStoreConnector> connector_bindings_; | 55 mojo::BindingSet<prefs::mojom::PrefStoreConnector> connector_bindings_; |
| 53 | 56 |
| 54 DISALLOW_COPY_AND_ASSIGN(ActiveProfilePrefService); | 57 DISALLOW_COPY_AND_ASSIGN(ActiveProfilePrefService); |
| 55 }; | 58 }; |
| 56 | 59 |
| 57 #endif // CHROME_BROWSER_PREFS_ACTIVE_PROFILE_PREF_SERVICE_H_ | 60 #endif // CHROME_BROWSER_PREFS_ACTIVE_PROFILE_PREF_SERVICE_H_ |
| OLD | NEW |