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 EXTENSIONS_BROWSER_EXTENSION_PREFS_H_ | 5 #ifndef EXTENSIONS_BROWSER_EXTENSION_PREFS_H_ |
6 #define EXTENSIONS_BROWSER_EXTENSION_PREFS_H_ | 6 #define EXTENSIONS_BROWSER_EXTENSION_PREFS_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 // Use this as needed for testing. | 142 // Use this as needed for testing. |
143 static ExtensionPrefs* Create( | 143 static ExtensionPrefs* Create( |
144 PrefService* prefs, | 144 PrefService* prefs, |
145 const base::FilePath& root_dir, | 145 const base::FilePath& root_dir, |
146 ExtensionPrefValueMap* extension_pref_value_map, | 146 ExtensionPrefValueMap* extension_pref_value_map, |
147 scoped_ptr<AppSorting> app_sorting, | 147 scoped_ptr<AppSorting> app_sorting, |
148 bool extensions_disabled, | 148 bool extensions_disabled, |
149 const std::vector<ExtensionPrefsObserver*>& early_observers, | 149 const std::vector<ExtensionPrefsObserver*>& early_observers, |
150 scoped_ptr<TimeProvider> time_provider); | 150 scoped_ptr<TimeProvider> time_provider); |
151 | 151 |
152 virtual ~ExtensionPrefs(); | 152 ~ExtensionPrefs() override; |
153 | 153 |
154 // Convenience function to get the ExtensionPrefs for a BrowserContext. | 154 // Convenience function to get the ExtensionPrefs for a BrowserContext. |
155 static ExtensionPrefs* Get(content::BrowserContext* context); | 155 static ExtensionPrefs* Get(content::BrowserContext* context); |
156 | 156 |
157 // Returns all installed extensions from extension preferences provided by | 157 // Returns all installed extensions from extension preferences provided by |
158 // |pref_service|. This is exposed for ProtectedPrefsWatcher because it needs | 158 // |pref_service|. This is exposed for ProtectedPrefsWatcher because it needs |
159 // access to the extension ID list before the ExtensionService is initialized. | 159 // access to the extension ID list before the ExtensionService is initialized. |
160 static ExtensionIdList GetExtensionsFrom(const PrefService* pref_service); | 160 static ExtensionIdList GetExtensionsFrom(const PrefService* pref_service); |
161 | 161 |
162 // Add or remove an observer from the ExtensionPrefs. | 162 // Add or remove an observer from the ExtensionPrefs. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 BlacklistState state); | 211 BlacklistState state); |
212 | 212 |
213 // Checks whether |extension_id| is marked as greylisted. | 213 // Checks whether |extension_id| is marked as greylisted. |
214 // TODO(oleg): Replace IsExtensionBlacklisted by this method. | 214 // TODO(oleg): Replace IsExtensionBlacklisted by this method. |
215 BlacklistState GetExtensionBlacklistState(const std::string& extension_id); | 215 BlacklistState GetExtensionBlacklistState(const std::string& extension_id); |
216 | 216 |
217 // Populates |out| with the ids of all installed extensions. | 217 // Populates |out| with the ids of all installed extensions. |
218 void GetExtensions(ExtensionIdList* out); | 218 void GetExtensions(ExtensionIdList* out); |
219 | 219 |
220 // ExtensionScopedPrefs methods: | 220 // ExtensionScopedPrefs methods: |
221 virtual void UpdateExtensionPref(const std::string& id, | 221 void UpdateExtensionPref(const std::string& id, |
222 const std::string& key, | 222 const std::string& key, |
223 base::Value* value) override; | 223 base::Value* value) override; |
224 | 224 |
225 virtual void DeleteExtensionPrefs(const std::string& id) override; | 225 void DeleteExtensionPrefs(const std::string& id) override; |
226 | 226 |
227 virtual bool ReadPrefAsBoolean(const std::string& extension_id, | 227 bool ReadPrefAsBoolean(const std::string& extension_id, |
228 const std::string& pref_key, | 228 const std::string& pref_key, |
229 bool* out_value) const override; | 229 bool* out_value) const override; |
230 | 230 |
231 virtual bool ReadPrefAsInteger(const std::string& extension_id, | 231 bool ReadPrefAsInteger(const std::string& extension_id, |
232 const std::string& pref_key, | 232 const std::string& pref_key, |
233 int* out_value) const override; | 233 int* out_value) const override; |
234 | 234 |
235 virtual bool ReadPrefAsString(const std::string& extension_id, | 235 bool ReadPrefAsString(const std::string& extension_id, |
236 const std::string& pref_key, | 236 const std::string& pref_key, |
237 std::string* out_value) const override; | 237 std::string* out_value) const override; |
238 | 238 |
239 virtual bool ReadPrefAsList(const std::string& extension_id, | 239 bool ReadPrefAsList(const std::string& extension_id, |
240 const std::string& pref_key, | 240 const std::string& pref_key, |
241 const base::ListValue** out_value) const override; | 241 const base::ListValue** out_value) const override; |
242 | 242 |
243 virtual bool ReadPrefAsDictionary( | 243 bool ReadPrefAsDictionary( |
244 const std::string& extension_id, | 244 const std::string& extension_id, |
245 const std::string& pref_key, | 245 const std::string& pref_key, |
246 const base::DictionaryValue** out_value) const override; | 246 const base::DictionaryValue** out_value) const override; |
247 | 247 |
248 virtual bool HasPrefForExtension(const std::string& extension_id) const | 248 bool HasPrefForExtension(const std::string& extension_id) const override; |
249 override; | |
250 | 249 |
251 // Did the extension ask to escalate its permission during an upgrade? | 250 // Did the extension ask to escalate its permission during an upgrade? |
252 bool DidExtensionEscalatePermissions(const std::string& id); | 251 bool DidExtensionEscalatePermissions(const std::string& id); |
253 | 252 |
254 // If |did_escalate| is true, the preferences for |extension| will be set to | 253 // If |did_escalate| is true, the preferences for |extension| will be set to |
255 // require the install warning when the user tries to enable. | 254 // require the install warning when the user tries to enable. |
256 void SetDidExtensionEscalatePermissions( | 255 void SetDidExtensionEscalatePermissions( |
257 const Extension* extension, | 256 const Extension* extension, |
258 bool did_escalate); | 257 bool did_escalate); |
259 | 258 |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
682 bool extensions_disabled_; | 681 bool extensions_disabled_; |
683 | 682 |
684 ObserverList<ExtensionPrefsObserver> observer_list_; | 683 ObserverList<ExtensionPrefsObserver> observer_list_; |
685 | 684 |
686 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs); | 685 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs); |
687 }; | 686 }; |
688 | 687 |
689 } // namespace extensions | 688 } // namespace extensions |
690 | 689 |
691 #endif // EXTENSIONS_BROWSER_EXTENSION_PREFS_H_ | 690 #endif // EXTENSIONS_BROWSER_EXTENSION_PREFS_H_ |
OLD | NEW |