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

Unified Diff: services/preferences/public/interfaces/preferences.mojom

Issue 2635153002: Pref service: expose all read-only PrefStores through Mojo (Closed)
Patch Set: Create and register service Created 3 years, 10 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: services/preferences/public/interfaces/preferences.mojom
diff --git a/services/preferences/public/interfaces/preferences.mojom b/services/preferences/public/interfaces/preferences.mojom
index 1978e4b671fc5a85ccbd004317b7e515bffa0d90..7dd301dea2b5c32008541ddd990e2d81d0df0083 100644
--- a/services/preferences/public/interfaces/preferences.mojom
+++ b/services/preferences/public/interfaces/preferences.mojom
@@ -27,3 +27,46 @@ interface PreferencesService {
SetPreferences(mojo.common.mojom.DictionaryValue preferences);
Subscribe(array<string> preferences);
};
+
+const string kPrefStoreServiceName = "preferences2";
+
+[Native]
+enum PrefStoreType;
+
+// Allows observing changes to prefs stored in a |PrefStore|.
+interface PrefStoreObserver {
+ OnPreferencesChanged(mojo.common.mojom.DictionaryValue preferences);
+ OnInitializationCompleted(bool succeeded);
+};
+
+// Captures the connections to a PrefStore by supplying the initial state of the
+// store and a handle to receive notifications on.
+struct PrefStoreConnection {
+ PrefStoreObserver& observer;
+ mojo.common.mojom.DictionaryValue initial_prefs;
+ bool is_initialized;
+};
+
+// Manages actual read of preference data. Accepts observers who subscribe to
+// preferences, notifying them of changes.
+interface PrefStore {
+ // Add an observer of changes. This current values of all prefs will not be
+ // communicated through a call to |observer| but instead be returned in
+ // |initial_prefs|.
+ AddObserver() => (PrefStoreConnection connection);
+};
+
+// Manages a registry of all pref stores. Registered pref stores can be
+// connected to through the |PrefStoreConnector| interface.
+interface PrefStoreRegistry {
+ // Register a pref store.
+ Register(PrefStore pref_store, PrefStoreType type);
+};
+
+// Allows connections to pref stores registered with |PrefStoreRegistry|.
+interface PrefStoreConnector {
+ // Connect to all registered pref stores, retrieving the current values of all
+ // prefs in each store and an |observer| interfaces through which updates can
+ // be received.
+ Connect() => (map<PrefStoreType, PrefStoreConnection> connections);
+};

Powered by Google App Engine
This is Rietveld 408576698