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 // Controls the omnibox default suggestion as set by the extension. | 278 // Controls the omnibox default suggestion as set by the extension. |
279 extensions::ExtensionOmniboxSuggestion GetOmniboxDefaultSuggestion( | 279 extensions::ExtensionOmniboxSuggestion GetOmniboxDefaultSuggestion( |
280 const std::string& extension_id); | 280 const std::string& extension_id); |
281 void SetOmniboxDefaultSuggestion( | 281 void SetOmniboxDefaultSuggestion( |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 URLPatternSet* result, | 485 URLPatternSet* result, |
486 int valid_schemes); | 486 int valid_schemes); |
487 | 487 |
488 // Converts |new_value| to a list of strings and sets the |pref_key| pref | 488 // Converts |new_value| to a list of strings and sets the |pref_key| pref |
489 // belonging to |extension_id|. | 489 // belonging to |extension_id|. |
490 void SetExtensionPrefURLPatternSet(const std::string& extension_id, | 490 void SetExtensionPrefURLPatternSet(const std::string& extension_id, |
491 const std::string& pref_key, | 491 const std::string& pref_key, |
492 const URLPatternSet& new_value); | 492 const URLPatternSet& new_value); |
493 | 493 |
494 // Interprets |pref_key| in |extension_id|'s preferences as an | 494 // Interprets |pref_key| in |extension_id|'s preferences as an |
495 // ExtensionPermissionSet, and passes ownership of the set to the caller. | 495 // PermissionSet, and passes ownership of the set to the caller. |
496 ExtensionPermissionSet* ReadExtensionPrefPermissionSet( | 496 extensions::PermissionSet* ReadExtensionPrefPermissionSet( |
497 const std::string& extension_id, | 497 const std::string& extension_id, |
498 const std::string& pref_key); | 498 const std::string& pref_key); |
499 | 499 |
500 // Converts the |new_value| to its value and sets the |pref_key| pref | 500 // Converts the |new_value| to its value and sets the |pref_key| pref |
501 // belonging to |extension_id|. | 501 // belonging to |extension_id|. |
502 void SetExtensionPrefPermissionSet(const std::string& extension_id, | 502 void SetExtensionPrefPermissionSet( |
503 const std::string& pref_key, | 503 const std::string& extension_id, |
504 const ExtensionPermissionSet* new_value); | 504 const std::string& pref_key, |
| 505 const extensions::PermissionSet* new_value); |
505 | 506 |
506 // Returns a dictionary for extension |id|'s prefs or NULL if it doesn't | 507 // Returns a dictionary for extension |id|'s prefs or NULL if it doesn't |
507 // exist. | 508 // exist. |
508 const base::DictionaryValue* GetExtensionPref(const std::string& id) const; | 509 const base::DictionaryValue* GetExtensionPref(const std::string& id) const; |
509 | 510 |
510 // Loads the preferences controlled by the specified extension from their | 511 // Loads the preferences controlled by the specified extension from their |
511 // dictionary and sets them in the |pref_value_map_|. | 512 // dictionary and sets them in the |pref_value_map_|. |
512 void LoadExtensionControlledPrefs(const std::string& id, | 513 void LoadExtensionControlledPrefs(const std::string& id, |
513 ExtensionPrefsScope scope); | 514 ExtensionPrefsScope scope); |
514 | 515 |
(...skipping 30 matching lines...) Expand all Loading... |
545 // Contains all the logic for handling the order for various extension | 546 // Contains all the logic for handling the order for various extension |
546 // properties. | 547 // properties. |
547 scoped_ptr<ExtensionSorting> extension_sorting_; | 548 scoped_ptr<ExtensionSorting> extension_sorting_; |
548 | 549 |
549 scoped_refptr<extensions::ContentSettingsStore> content_settings_store_; | 550 scoped_refptr<extensions::ContentSettingsStore> content_settings_store_; |
550 | 551 |
551 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs); | 552 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs); |
552 }; | 553 }; |
553 | 554 |
554 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_ | 555 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_ |
OLD | NEW |