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/file_path.mojom"; |
| 8 import "mojo/common/string16.mojom"; |
7 import "mojo/common/values.mojom"; | 9 import "mojo/common/values.mojom"; |
| 10 import "services/preferences/public/interfaces/tracked_preference_validation_del
egate.mojom"; |
8 | 11 |
9 const string kServiceName = "preferences"; | 12 const string kServiceName = "preferences"; |
10 | 13 |
11 // Used for the creation of a PreferencesService and to ensure that the | 14 // Used for the creation of a PreferencesService and to ensure that the |
12 // PreferencesServiceClient is bound at creation time. | 15 // PreferencesServiceClient is bound at creation time. |
13 interface PreferencesServiceFactory { | 16 interface PreferencesServiceFactory { |
14 // Creates a PreferencesService bound to the provided |observer|. | 17 // Creates a PreferencesService bound to the provided |observer|. |
15 Create(PreferencesServiceClient observer, PreferencesService& service); | 18 Create(PreferencesServiceClient observer, PreferencesService& service); |
16 }; | 19 }; |
17 | 20 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 Register(PrefStoreType type, PrefStore pref_store); | 87 Register(PrefStoreType type, PrefStore pref_store); |
85 }; | 88 }; |
86 | 89 |
87 // Allows connections to pref stores registered with |PrefStoreRegistry|. | 90 // Allows connections to pref stores registered with |PrefStoreRegistry|. |
88 interface PrefStoreConnector { | 91 interface PrefStoreConnector { |
89 // Connect to all registered pref stores, retrieving the current values of all | 92 // 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 | 93 // prefs in each store and an |observer| interfaces through which updates can |
91 // be received. | 94 // be received. |
92 Connect() => (map<PrefStoreType, PrefStoreConnection> connections); | 95 Connect() => (map<PrefStoreType, PrefStoreConnection> connections); |
93 }; | 96 }; |
| 97 |
| 98 // A persistent PrefStore. This |
| 99 interface PersistentPrefStore { |
| 100 // Null |value| indicates a delete. |flags| is a bitmask of |
| 101 // WritablePrefStore::PrefWriteFlags. |
| 102 SetValue(string key, mojo.common.mojom.Value? value, uint32 flags); |
| 103 |
| 104 CommitPendingWrite(); |
| 105 SchedulePendingLossyWrites(); |
| 106 ClearMutableValues(); |
| 107 }; |
| 108 |
| 109 interface PersistentPrefStoreConnector { |
| 110 enum ReadError { |
| 111 NONE = 0, |
| 112 JSON_PARSE = 1, |
| 113 JSON_TYPE = 2, |
| 114 ACCESS_DENIED = 3, |
| 115 FILE_OTHER = 4, |
| 116 FILE_LOCKED = 5, |
| 117 NO_FILE = 6, |
| 118 JSON_REPEAT = 7, |
| 119 // OTHER = 8, // Deprecated. |
| 120 FILE_NOT_SPECIFIED = 9, |
| 121 ASYNCHRONOUS_TASK_INCOMPLETE = 10, |
| 122 }; |
| 123 |
| 124 // A null |preferences| indicates that the pref service failed to load prefs. |
| 125 [Sync] |
| 126 Connect() => ( |
| 127 ReadError read_error, |
| 128 bool read_only, |
| 129 mojo.common.mojom.DictionaryValue? preferences, |
| 130 PersistentPrefStore? pref_store, |
| 131 PrefStoreObserver&? observer); |
| 132 }; |
| 133 |
| 134 interface ResetOnLoadObserver { |
| 135 OnResetOnLoad(); |
| 136 }; |
| 137 |
| 138 interface PersistentPrefStoreInit { |
| 139 Init(UserPrefsConfiguration configuration); |
| 140 }; |
| 141 |
| 142 union UserPrefsConfiguration { |
| 143 SimpleUserPrefsConfiguration simple_configuration; |
| 144 SegregatedUserPrefsConfiguration segregated_configuration; |
| 145 }; |
| 146 |
| 147 struct SimpleUserPrefsConfiguration { |
| 148 mojo.common.mojom.FilePath pref_filename; |
| 149 }; |
| 150 |
| 151 struct SegregatedUserPrefsConfiguration { |
| 152 mojo.common.mojom.FilePath unprotected_pref_filename; |
| 153 mojo.common.mojom.FilePath protected_pref_filename; |
| 154 array<TrackedPreferenceMetadata> tracking_configuration; |
| 155 uint64 reporting_ids_count; |
| 156 string seed; |
| 157 string legacy_device_id; |
| 158 mojo.common.mojom.String16 registry_path; |
| 159 TrackedPreferenceValidationDelegate? validation_delegate; |
| 160 ResetOnLoadObserver reset_on_load_observer; |
| 161 }; |
| 162 |
| 163 struct TrackedPreferenceMetadata { |
| 164 enum EnforcementLevel { NO_ENFORCEMENT, ENFORCE_ON_LOAD }; |
| 165 |
| 166 enum PrefTrackingStrategy { |
| 167 // Atomic preferences are tracked as a whole. |
| 168 ATOMIC, |
| 169 // Split preferences are dictionaries for which each top-level entry is |
| 170 // tracked independently. Note: preferences using this strategy must be kept |
| 171 // in sync with TrackedSplitPreferences in histograms.xml. |
| 172 SPLIT, |
| 173 }; |
| 174 |
| 175 enum ValueType { |
| 176 IMPERSONAL, |
| 177 // The preference value may contain personal information. |
| 178 PERSONAL, |
| 179 }; |
| 180 |
| 181 uint64 reporting_id; |
| 182 string name; |
| 183 EnforcementLevel enforcement_level; |
| 184 PrefTrackingStrategy strategy; |
| 185 ValueType value_type; |
| 186 }; |
OLD | NEW |