| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_PREFS_ACTIVE_PROFILE_PREF_SERVICE_H_ |
| 6 #define CHROME_BROWSER_PREFS_ACTIVE_PROFILE_PREF_SERVICE_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "mojo/public/cpp/bindings/binding_set.h" |
| 10 #include "services/preferences/public/interfaces/preferences.mojom.h" |
| 11 #include "services/service_manager/public/cpp/interface_factory.h" |
| 12 #include "services/service_manager/public/cpp/service.h" |
| 13 |
| 14 // A |prefs::mojom::PrefStoreConnector| implementation that forwards connection |
| 15 // calls from the root service to the active profile. Used by mash, which runs |
| 16 // as the root user, to talk to prefs. |
| 17 // |
| 18 // TODO(http://crbug.com/705347): Once mash supports several profiles, remove |
| 19 // this class and the forwarder service. |
| 20 class ActiveProfilePrefService : public prefs::mojom::PrefStoreConnector, |
| 21 public service_manager::InterfaceFactory< |
| 22 prefs::mojom::PrefStoreConnector>, |
| 23 public service_manager::Service { |
| 24 public: |
| 25 ActiveProfilePrefService(); |
| 26 ~ActiveProfilePrefService() override; |
| 27 |
| 28 private: |
| 29 // prefs::mojom::PrefStoreConnector: |
| 30 void Connect(prefs::mojom::PrefRegistryPtr pref_registry, |
| 31 const ConnectCallback& callback) override; |
| 32 |
| 33 // service_manager::InterfaceFactory<PrefStoreConnector>: |
| 34 void Create(const service_manager::Identity& remote_identity, |
| 35 prefs::mojom::PrefStoreConnectorRequest request) override; |
| 36 |
| 37 // service_manager::Service: |
| 38 void OnStart() override; |
| 39 bool OnConnect(const service_manager::ServiceInfo& remote_info, |
| 40 service_manager::InterfaceRegistry* registry) override; |
| 41 |
| 42 // Called if forwarding the connection request to the per-profile service |
| 43 // instance failed. |
| 44 void OnConnectError(); |
| 45 |
| 46 prefs::mojom::PrefStoreConnectorPtr connector_ptr_; |
| 47 mojo::BindingSet<prefs::mojom::PrefStoreConnector> connector_bindings_; |
| 48 |
| 49 DISALLOW_COPY_AND_ASSIGN(ActiveProfilePrefService); |
| 50 }; |
| 51 |
| 52 #endif // CHROME_BROWSER_PREFS_ACTIVE_PROFILE_PREF_SERVICE_H_ |
| OLD | NEW |