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

Side by Side Diff: services/preferences/public/interfaces/preferences.mojom

Issue 2777483002: Pref service: Add initial support for pref registration. (Closed)
Patch Set: rebase Created 3 years, 8 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 unified diff | Download patch
« no previous file with comments | « services/preferences/public/cpp/pref_service_factory.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 module prefs.mojom; 5 module prefs.mojom;
6 6
7 import "mojo/common/values.mojom"; 7 import "mojo/common/values.mojom";
8 import "services/preferences/public/interfaces/preferences_configuration.mojom"; 8 import "services/preferences/public/interfaces/preferences_configuration.mojom";
9 9
10 const string kServiceName = "preferences"; 10 const string kServiceName = "preferences";
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 // Register a pref store. 105 // Register a pref store.
106 Register(PrefStoreType type, PrefStore pref_store); 106 Register(PrefStoreType type, PrefStore pref_store);
107 }; 107 };
108 108
109 // Allows connections to pref stores registered with |PrefStoreRegistry|. 109 // Allows connections to pref stores registered with |PrefStoreRegistry|.
110 interface PrefStoreConnector { 110 interface PrefStoreConnector {
111 // Connect to all registered pref stores, retrieving the current values of all 111 // Connect to all registered pref stores, retrieving the current values of all
112 // prefs in each store and an |observer| interfaces through which updates can 112 // prefs in each store and an |observer| interfaces through which updates can
113 // be received. 113 // be received.
114 [Sync] 114 [Sync]
115 Connect() => (PersistentPrefStoreConnection connection, 115 Connect(PrefRegistry pref_registry) =>
116 map<PrefStoreType, PrefStoreConnection> connections); 116 (PersistentPrefStoreConnection connection,
117 map<PrefStoreType, PrefStoreConnection> connections);
117 }; 118 };
118 119
119 // An interface providing mutation access to a PersistentPrefStore. 120 // An interface providing mutation access to a PersistentPrefStore.
120 interface PersistentPrefStore { 121 interface PersistentPrefStore {
121 // Sets the value for |key|. A null |value| indicates a delete. |flags| is a 122 // Sets the value for |key|. A null |value| indicates a delete. |flags| is a
122 // bitmask of WritablePrefStore::PrefWriteFlags. 123 // bitmask of WritablePrefStore::PrefWriteFlags.
123 SetValue(string key, mojo.common.mojom.Value? value, uint32 flags); 124 SetValue(string key, mojo.common.mojom.Value? value, uint32 flags);
124 125
125 // These mirror the C++ PersistentPrefStore methods. 126 // These mirror the C++ PersistentPrefStore methods.
126 CommitPendingWrite(); 127 CommitPendingWrite();
127 SchedulePendingLossyWrites(); 128 SchedulePendingLossyWrites();
128 ClearMutableValues(); 129 ClearMutableValues();
129 }; 130 };
130 131
132 // A registry of all prefs registered by a single client.
133 struct PrefRegistry {
134 map<string, PrefRegistration> registrations;
135 };
136
137 struct PrefRegistration {
138 mojo.common.mojom.Value default_value;
139
140 // A bitfield of flags. Flag values are defined in
141 // PrefRegistry::PrefRegistrationFlags and
142 // PrefRegistrySyncable::PrefRegistrationFlags.
143 uint32 flags;
144 };
145
131 interface PrefServiceControl { 146 interface PrefServiceControl {
132 // Initializes the pref service. This must be called before the service can 147 // Initializes the pref service. This must be called before the service can
133 // be used. 148 // be used.
134 Init(PersistentPrefStoreConfiguration configuration); 149 Init(PersistentPrefStoreConfiguration configuration);
135 }; 150 };
OLDNEW
« no previous file with comments | « services/preferences/public/cpp/pref_service_factory.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698