OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_EXTENSIONS_EXTENSION_PREFS_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 | 244 |
245 // A bit we use for determining if we should send the "days since active" | 245 // A bit we use for determining if we should send the "days since active" |
246 // ping. A value of true means the item has been active (launched) since the | 246 // ping. A value of true means the item has been active (launched) since the |
247 // last update check. | 247 // last update check. |
248 bool GetActiveBit(const std::string& extension_id); | 248 bool GetActiveBit(const std::string& extension_id); |
249 void SetActiveBit(const std::string& extension_id, bool active); | 249 void SetActiveBit(const std::string& extension_id, bool active); |
250 | 250 |
251 // Returns the granted permission set for the extension with |extension_id|, | 251 // Returns the granted permission set for the extension with |extension_id|, |
252 // and NULL if no preferences were found for |extension_id|. | 252 // and NULL if no preferences were found for |extension_id|. |
253 // This passes ownership of the returned set to the caller. | 253 // This passes ownership of the returned set to the caller. |
254 ExtensionPermissionSet* GetGrantedPermissions( | 254 extensions::PermissionSet* GetGrantedPermissions( |
255 const std::string& extension_id); | 255 const std::string& extension_id); |
256 | 256 |
257 // Adds |permissions| to the granted permissions set for the extension with | 257 // Adds |permissions| to the granted permissions set for the extension with |
258 // |extension_id|. The new granted permissions set will be the union of | 258 // |extension_id|. The new granted permissions set will be the union of |
259 // |permissions| and the already granted permissions. | 259 // |permissions| and the already granted permissions. |
260 void AddGrantedPermissions(const std::string& extension_id, | 260 void AddGrantedPermissions(const std::string& extension_id, |
261 const ExtensionPermissionSet* permissions); | 261 const extensions::PermissionSet* permissions); |
262 | 262 |
263 // Gets the active permission set for the specified extension. This may | 263 // Gets the active permission set for the specified extension. This may |
264 // differ from the permissions in the manifest due to the optional | 264 // differ from the permissions in the manifest due to the optional |
265 // permissions API. This passes ownership of the set to the caller. | 265 // permissions API. This passes ownership of the set to the caller. |
266 ExtensionPermissionSet* GetActivePermissions( | 266 extensions::PermissionSet* GetActivePermissions( |
267 const std::string& extension_id); | 267 const std::string& extension_id); |
268 | 268 |
269 // Sets the active |permissions| for the extension with |extension_id|. | 269 // Sets the active |permissions| for the extension with |extension_id|. |
270 void SetActivePermissions(const std::string& extension_id, | 270 void SetActivePermissions(const std::string& extension_id, |
271 const ExtensionPermissionSet* permissions); | 271 const extensions::PermissionSet* permissions); |
272 | 272 |
273 // Returns the list of events that the given extension has registered for. | 273 // Returns the list of events that the given extension has registered for. |
274 std::set<std::string> GetRegisteredEvents(const std::string& extension_id); | 274 std::set<std::string> GetRegisteredEvents(const std::string& extension_id); |
275 void SetRegisteredEvents(const std::string& extension_id, | 275 void SetRegisteredEvents(const std::string& extension_id, |
276 const std::set<std::string>& events); | 276 const std::set<std::string>& events); |
277 | 277 |
278 // Adds a filter to an event. | 278 // Adds a filter to an event. |
279 void AddFilterToEvent(const std::string& event_name, | 279 void AddFilterToEvent(const std::string& event_name, |
280 const std::string& extension_id, | 280 const std::string& extension_id, |
281 const DictionaryValue* filter); | 281 const DictionaryValue* filter); |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 URLPatternSet* result, | 497 URLPatternSet* result, |
498 int valid_schemes); | 498 int valid_schemes); |
499 | 499 |
500 // Converts |new_value| to a list of strings and sets the |pref_key| pref | 500 // Converts |new_value| to a list of strings and sets the |pref_key| pref |
501 // belonging to |extension_id|. | 501 // belonging to |extension_id|. |
502 void SetExtensionPrefURLPatternSet(const std::string& extension_id, | 502 void SetExtensionPrefURLPatternSet(const std::string& extension_id, |
503 const std::string& pref_key, | 503 const std::string& pref_key, |
504 const URLPatternSet& new_value); | 504 const URLPatternSet& new_value); |
505 | 505 |
506 // Interprets |pref_key| in |extension_id|'s preferences as an | 506 // Interprets |pref_key| in |extension_id|'s preferences as an |
507 // ExtensionPermissionSet, and passes ownership of the set to the caller. | 507 // PermissionSet, and passes ownership of the set to the caller. |
508 ExtensionPermissionSet* ReadExtensionPrefPermissionSet( | 508 extensions::PermissionSet* ReadExtensionPrefPermissionSet( |
509 const std::string& extension_id, | 509 const std::string& extension_id, |
510 const std::string& pref_key); | 510 const std::string& pref_key); |
511 | 511 |
512 // Converts the |new_value| to its value and sets the |pref_key| pref | 512 // Converts the |new_value| to its value and sets the |pref_key| pref |
513 // belonging to |extension_id|. | 513 // belonging to |extension_id|. |
514 void SetExtensionPrefPermissionSet(const std::string& extension_id, | 514 void SetExtensionPrefPermissionSet( |
515 const std::string& pref_key, | 515 const std::string& extension_id, |
516 const ExtensionPermissionSet* new_value); | 516 const std::string& pref_key, |
| 517 const extensions::PermissionSet* new_value); |
517 | 518 |
518 // Returns a dictionary for extension |id|'s prefs or NULL if it doesn't | 519 // Returns a dictionary for extension |id|'s prefs or NULL if it doesn't |
519 // exist. | 520 // exist. |
520 const base::DictionaryValue* GetExtensionPref(const std::string& id) const; | 521 const base::DictionaryValue* GetExtensionPref(const std::string& id) const; |
521 | 522 |
522 // Loads the preferences controlled by the specified extension from their | 523 // Loads the preferences controlled by the specified extension from their |
523 // dictionary and sets them in the |pref_value_map_|. | 524 // dictionary and sets them in the |pref_value_map_|. |
524 void LoadExtensionControlledPrefs(const std::string& id, | 525 void LoadExtensionControlledPrefs(const std::string& id, |
525 ExtensionPrefsScope scope); | 526 ExtensionPrefsScope scope); |
526 | 527 |
(...skipping 30 matching lines...) Expand all Loading... |
557 // Contains all the logic for handling the order for various extension | 558 // Contains all the logic for handling the order for various extension |
558 // properties. | 559 // properties. |
559 scoped_ptr<ExtensionSorting> extension_sorting_; | 560 scoped_ptr<ExtensionSorting> extension_sorting_; |
560 | 561 |
561 scoped_refptr<extensions::ContentSettingsStore> content_settings_store_; | 562 scoped_refptr<extensions::ContentSettingsStore> content_settings_store_; |
562 | 563 |
563 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs); | 564 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs); |
564 }; | 565 }; |
565 | 566 |
566 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_ | 567 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_ |
OLD | NEW |