Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(125)

Unified Diff: chrome/browser/prefs/active_profile_pref_service.h

Issue 2772673002: mash: switch to the new pref service (Closed)
Patch Set: Address review comments Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/prefs/active_profile_pref_service.h
diff --git a/chrome/browser/prefs/active_profile_pref_service.h b/chrome/browser/prefs/active_profile_pref_service.h
new file mode 100644
index 0000000000000000000000000000000000000000..a5ffacc20d9a231b75f0480b4704f61179852b30
--- /dev/null
+++ b/chrome/browser/prefs/active_profile_pref_service.h
@@ -0,0 +1,52 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_PREFS_ACTIVE_PROFILE_PREF_SERVICE_H_
+#define CHROME_BROWSER_PREFS_ACTIVE_PROFILE_PREF_SERVICE_H_
+
+#include "base/macros.h"
+#include "mojo/public/cpp/bindings/binding_set.h"
+#include "services/preferences/public/interfaces/preferences.mojom.h"
+#include "services/service_manager/public/cpp/interface_factory.h"
+#include "services/service_manager/public/cpp/service.h"
+
+// A |prefs::mojom::PrefStoreConnector| implementation that forwards connection
+// calls from the root service to the active profile. Used by mash, which runs
+// as the root user, to talk to prefs.
+//
+// TODO(http://crbug.com/705347): Once mash supports several profiles, remove
+// this class and the forwarder service.
+class ActiveProfilePrefService : public prefs::mojom::PrefStoreConnector,
+ public service_manager::InterfaceFactory<
+ prefs::mojom::PrefStoreConnector>,
+ public service_manager::Service {
+ public:
+ ActiveProfilePrefService();
+ ~ActiveProfilePrefService() override;
+
+ private:
+ // prefs::mojom::PrefStoreConnector:
+ void Connect(prefs::mojom::PrefRegistryPtr pref_registry,
+ const ConnectCallback& callback) override;
+
+ // service_manager::InterfaceFactory<PrefStoreConnector>:
+ void Create(const service_manager::Identity& remote_identity,
+ prefs::mojom::PrefStoreConnectorRequest request) override;
+
+ // service_manager::Service:
+ void OnStart() override;
+ bool OnConnect(const service_manager::ServiceInfo& remote_info,
+ service_manager::InterfaceRegistry* registry) override;
+
+ // Called if forwarding the connection request to the per-profile service
+ // instance failed.
+ void OnConnectError();
+
+ prefs::mojom::PrefStoreConnectorPtr connector_ptr_;
+ mojo::BindingSet<prefs::mojom::PrefStoreConnector> connector_bindings_;
+
+ DISALLOW_COPY_AND_ASSIGN(ActiveProfilePrefService);
+};
+
+#endif // CHROME_BROWSER_PREFS_ACTIVE_PROFILE_PREF_SERVICE_H_
« no previous file with comments | « chrome/browser/chromeos/preferences_chromeos_browsertest.cc ('k') | chrome/browser/prefs/active_profile_pref_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698