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