OLD | NEW |
---|---|
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 Loading... | |
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 uint32 flags; | |
tibell
2017/03/26 22:54:47
Add a comment pointing to where these flags are de
Sam McNally
2017/03/26 23:02:45
Done.
| |
140 }; | |
141 | |
131 interface PrefServiceControl { | 142 interface PrefServiceControl { |
132 // Initializes the pref service. This must be called before the service can | 143 // Initializes the pref service. This must be called before the service can |
133 // be used. | 144 // be used. |
134 Init(PersistentPrefStoreConfiguration configuration); | 145 Init(PersistentPrefStoreConfiguration configuration); |
135 }; | 146 }; |
OLD | NEW |