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

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

Issue 2772673002: mash: switch to the new pref service (Closed)
Patch Set: Remove no longer needed tests 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..22533e78914aad1068bcb11a8210337179a0075b
--- /dev/null
+++ b/chrome/browser/prefs/active_profile_pref_service.h
@@ -0,0 +1,53 @@
+// 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"
+
+namespace prefs {
Sam McNally 2017/03/27 05:42:10 Remove.
tibell 2017/03/28 00:34:31 Done.
+
+// A |mojom::PrefStoreConnector| implementation that forwards connection calls
+// from the oot service to the active profile. Used by mash, which runs as the
sky 2017/03/27 16:00:11 If this is specific to chromeos, please move to a
sky 2017/03/27 16:00:11 oot -> root?
tibell 2017/03/28 00:34:31 Done.
tibell 2017/03/28 00:34:31 jonross@ said in his comment in chrome/app/BUILD.g
+// root user, to talk to prefs.
Sam McNally 2017/03/27 05:42:10 Add a TODO to not do this forwarding at all.
tibell 2017/03/28 00:34:31 Done.
+class ActiveProfilePrefService
+ : public mojom::PrefStoreConnector,
+ public service_manager::InterfaceFactory<mojom::PrefStoreConnector>,
+ public service_manager::Service {
+ public:
+ ActiveProfilePrefService();
+ ~ActiveProfilePrefService() override;
+
+ private:
+ // mojom::PrefStoreConnector:
+ void Connect(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();
+
+ mojom::PrefStoreConnectorPtr connector_ptr_;
+ mojo::BindingSet<mojom::PrefStoreConnector> connector_bindings_;
+
+ DISALLOW_COPY_AND_ASSIGN(ActiveProfilePrefService);
+};
+
+} // namespace prefs
+
+#endif // CHROME_BROWSER_PREFS_ACTIVE_PROFILE_PREF_SERVICE_H_

Powered by Google App Engine
This is Rietveld 408576698