OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SETTINGS_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SETTINGS_SERVICE_H_ |
6 #define CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SETTINGS_SERVICE_H_ | 6 #define CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SETTINGS_SERVICE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
105 static std::string MakeSplitSettingKey(const std::string& prefix, | 105 static std::string MakeSplitSettingKey(const std::string& prefix, |
106 const std::string& key); | 106 const std::string& key); |
107 | 107 |
108 // Uploads an item to the Sync server. Items are the same data structure as | 108 // Uploads an item to the Sync server. Items are the same data structure as |
109 // supervised user settings (i.e. key-value pairs, as described at the top of | 109 // supervised user settings (i.e. key-value pairs, as described at the top of |
110 // the file), but they are only uploaded (whereas supervised user settings are | 110 // the file), but they are only uploaded (whereas supervised user settings are |
111 // only downloaded), and never passed to the preference system. | 111 // only downloaded), and never passed to the preference system. |
112 // An example of an uploaded item is an access request to a blocked URL. | 112 // An example of an uploaded item is an access request to a blocked URL. |
113 void UploadItem(const std::string& key, std::unique_ptr<base::Value> value); | 113 void UploadItem(const std::string& key, std::unique_ptr<base::Value> value); |
114 | 114 |
115 // Updates supervised user settings and uploads it to the Sync server if they | |
Marc Treib
2016/06/08 12:08:25
grammar: singular please. Also the "if they..." pa
mamir
2016/06/09 12:14:10
Done.
| |
116 // change locally. An example is when an extension updates without permission | |
117 // increase, the approved version information should be updated accordingly. | |
118 void UpdateSetting(const std::string& key, | |
119 std::unique_ptr<base::Value> value); | |
120 | |
115 // Sets the setting with the given |key| to a copy of the given |value|. | 121 // Sets the setting with the given |key| to a copy of the given |value|. |
116 void SetLocalSetting(const std::string& key, | 122 void SetLocalSetting(const std::string& key, |
117 std::unique_ptr<base::Value> value); | 123 std::unique_ptr<base::Value> value); |
118 | 124 |
119 // Public for testing. | 125 // Public for testing. |
120 static syncer::SyncData CreateSyncDataForSetting(const std::string& name, | 126 static syncer::SyncData CreateSyncDataForSetting(const std::string& name, |
121 const base::Value& value); | 127 const base::Value& value); |
122 | 128 |
123 // KeyedService implementation: | 129 // KeyedService implementation: |
124 void Shutdown() override; | 130 void Shutdown() override; |
(...skipping 27 matching lines...) Expand all Loading... | |
152 base::DictionaryValue* GetDictionaryAndSplitKey(std::string* key) const; | 158 base::DictionaryValue* GetDictionaryAndSplitKey(std::string* key) const; |
153 | 159 |
154 // Returns a dictionary with all supervised user settings if the service is | 160 // Returns a dictionary with all supervised user settings if the service is |
155 // active, or NULL otherwise. | 161 // active, or NULL otherwise. |
156 std::unique_ptr<base::DictionaryValue> GetSettings(); | 162 std::unique_ptr<base::DictionaryValue> GetSettings(); |
157 | 163 |
158 // Sends the settings to all subscribers. This method should be called by the | 164 // Sends the settings to all subscribers. This method should be called by the |
159 // subclass whenever the settings change. | 165 // subclass whenever the settings change. |
160 void InformSubscribers(); | 166 void InformSubscribers(); |
161 | 167 |
168 void PushItemToSync(const std::string& key, | |
169 std::unique_ptr<base::Value> value); | |
170 | |
162 // Used for persisting the settings. Unlike other PrefStores, this one is not | 171 // Used for persisting the settings. Unlike other PrefStores, this one is not |
163 // directly hooked up to the PrefService. | 172 // directly hooked up to the PrefService. |
164 scoped_refptr<PersistentPrefStore> store_; | 173 scoped_refptr<PersistentPrefStore> store_; |
165 | 174 |
166 Profile* profile_; | 175 Profile* profile_; |
167 | 176 |
168 bool active_; | 177 bool active_; |
169 | 178 |
170 bool initialization_failed_; | 179 bool initialization_failed_; |
171 | 180 |
172 // A set of local settings that are fixed and not configured remotely. | 181 // A set of local settings that are fixed and not configured remotely. |
173 std::unique_ptr<base::DictionaryValue> local_settings_; | 182 std::unique_ptr<base::DictionaryValue> local_settings_; |
174 | 183 |
175 SettingsCallbackList callback_list_; | 184 SettingsCallbackList callback_list_; |
176 | 185 |
177 std::unique_ptr<syncer::SyncChangeProcessor> sync_processor_; | 186 std::unique_ptr<syncer::SyncChangeProcessor> sync_processor_; |
178 std::unique_ptr<syncer::SyncErrorFactory> error_handler_; | 187 std::unique_ptr<syncer::SyncErrorFactory> error_handler_; |
179 | 188 |
180 DISALLOW_COPY_AND_ASSIGN(SupervisedUserSettingsService); | 189 DISALLOW_COPY_AND_ASSIGN(SupervisedUserSettingsService); |
181 }; | 190 }; |
182 | 191 |
183 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SETTINGS_SERVICE_H_ | 192 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SETTINGS_SERVICE_H_ |
OLD | NEW |