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 | 8 |
9 const string kServiceName = "preferences"; | 9 const string kServiceName = "preferences"; |
10 | 10 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 Register(PrefStoreType type, PrefStore pref_store); | 84 Register(PrefStoreType type, PrefStore pref_store); |
85 }; | 85 }; |
86 | 86 |
87 // Allows connections to pref stores registered with |PrefStoreRegistry|. | 87 // Allows connections to pref stores registered with |PrefStoreRegistry|. |
88 interface PrefStoreConnector { | 88 interface PrefStoreConnector { |
89 // Connect to all registered pref stores, retrieving the current values of all | 89 // Connect to all registered pref stores, retrieving the current values of all |
90 // prefs in each store and an |observer| interfaces through which updates can | 90 // prefs in each store and an |observer| interfaces through which updates can |
91 // be received. | 91 // be received. |
92 Connect() => (map<PrefStoreType, PrefStoreConnection> connections); | 92 Connect() => (map<PrefStoreType, PrefStoreConnection> connections); |
93 }; | 93 }; |
| 94 |
| 95 // An interface providing mutation access to a PersistentPrefStore. |
| 96 interface PersistentPrefStore { |
| 97 // Sets the value for |key|. A null |value| indicates a delete. |flags| is a |
| 98 // bitmask of WritablePrefStore::PrefWriteFlags. |
| 99 SetValue(string key, mojo.common.mojom.Value? value, uint32 flags); |
| 100 |
| 101 // These mirror the C++ PersistentPrefStore methods. |
| 102 CommitPendingWrite(); |
| 103 SchedulePendingLossyWrites(); |
| 104 ClearMutableValues(); |
| 105 }; |
| 106 |
| 107 // A connector that provides a way to connect to a PersistentPrefStore. |
| 108 interface PersistentPrefStoreConnector { |
| 109 enum ReadError { |
| 110 NONE = 0, |
| 111 JSON_PARSE = 1, |
| 112 JSON_TYPE = 2, |
| 113 ACCESS_DENIED = 3, |
| 114 FILE_OTHER = 4, |
| 115 FILE_LOCKED = 5, |
| 116 NO_FILE = 6, |
| 117 JSON_REPEAT = 7, |
| 118 // OTHER = 8, // Deprecated. |
| 119 FILE_NOT_SPECIFIED = 9, |
| 120 ASYNCHRONOUS_TASK_INCOMPLETE = 10, |
| 121 }; |
| 122 |
| 123 // Connects to the PersistentPrefStore. |
| 124 // A null |preferences| indicates that the pref service failed to load prefs. |
| 125 // |pref_store| provides write access; |observer| is used to observe writes |
| 126 // instigated by other clients. |
| 127 [Sync] |
| 128 Connect() => ( |
| 129 ReadError read_error, |
| 130 bool read_only, |
| 131 mojo.common.mojom.DictionaryValue? preferences, |
| 132 PersistentPrefStore? pref_store, |
| 133 PrefStoreObserver&? observer); |
| 134 }; |
OLD | NEW |