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 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
346 | 346 |
347 // A bit we use for determining if we should send the "days since active" | 347 // A bit we use for determining if we should send the "days since active" |
348 // ping. A value of true means the item has been active (launched) since the | 348 // ping. A value of true means the item has been active (launched) since the |
349 // last update check. | 349 // last update check. |
350 bool GetActiveBit(const std::string& extension_id) const; | 350 bool GetActiveBit(const std::string& extension_id) const; |
351 void SetActiveBit(const std::string& extension_id, bool active); | 351 void SetActiveBit(const std::string& extension_id, bool active); |
352 | 352 |
353 // Returns the granted permission set for the extension with |extension_id|, | 353 // Returns the granted permission set for the extension with |extension_id|, |
354 // and NULL if no preferences were found for |extension_id|. | 354 // and NULL if no preferences were found for |extension_id|. |
355 // This passes ownership of the returned set to the caller. | 355 // This passes ownership of the returned set to the caller. |
356 scoped_refptr<const PermissionSet> GetGrantedPermissions( | 356 scoped_ptr<const PermissionSet> GetGrantedPermissions( |
357 const std::string& extension_id) const; | 357 const std::string& extension_id) const; |
358 | 358 |
359 // Adds |permissions| to the granted permissions set for the extension with | 359 // Adds |permissions| to the granted permissions set for the extension with |
360 // |extension_id|. The new granted permissions set will be the union of | 360 // |extension_id|. The new granted permissions set will be the union of |
361 // |permissions| and the already granted permissions. | 361 // |permissions| and the already granted permissions. |
362 void AddGrantedPermissions(const std::string& extension_id, | 362 void AddGrantedPermissions(const std::string& extension_id, |
363 const PermissionSet* permissions); | 363 const PermissionSet* permissions); |
not at google - send to devlin
2015/09/22 21:51:26
(noting places which should be a reference)
| |
364 | 364 |
365 // As above, but subtracts the given |permissions| from the granted set. | 365 // As above, but subtracts the given |permissions| from the granted set. |
366 void RemoveGrantedPermissions(const std::string& extension_id, | 366 void RemoveGrantedPermissions(const std::string& extension_id, |
367 const PermissionSet* permissions); | 367 const PermissionSet* permissions); |
368 | 368 |
369 // Gets the active permission set for the specified extension. This may | 369 // Gets the active permission set for the specified extension. This may |
370 // differ from the permissions in the manifest due to the optional | 370 // differ from the permissions in the manifest due to the optional |
371 // permissions API. This passes ownership of the set to the caller. | 371 // permissions API. This passes ownership of the set to the caller. |
372 scoped_refptr<const PermissionSet> GetActivePermissions( | 372 scoped_ptr<const PermissionSet> GetActivePermissions( |
373 const std::string& extension_id) const; | 373 const std::string& extension_id) const; |
374 | 374 |
375 // Sets the active |permissions| for the extension with |extension_id|. | 375 // Sets the active |permissions| for the extension with |extension_id|. |
376 void SetActivePermissions(const std::string& extension_id, | 376 void SetActivePermissions(const std::string& extension_id, |
377 const PermissionSet* permissions); | 377 const PermissionSet* permissions); |
378 | 378 |
379 // Records whether or not this extension is currently running. | 379 // Records whether or not this extension is currently running. |
380 void SetExtensionRunning(const std::string& extension_id, bool is_running); | 380 void SetExtensionRunning(const std::string& extension_id, bool is_running); |
381 | 381 |
382 // Returns whether or not this extension is marked as running. This is used to | 382 // Returns whether or not this extension is marked as running. This is used to |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
598 const std::string& pref_key, | 598 const std::string& pref_key, |
599 const URLPatternSet& new_value); | 599 const URLPatternSet& new_value); |
600 | 600 |
601 // Read the boolean preference entry and return true if the preference exists | 601 // Read the boolean preference entry and return true if the preference exists |
602 // and the preference's value is true; false otherwise. | 602 // and the preference's value is true; false otherwise. |
603 bool ReadPrefAsBooleanAndReturn(const std::string& extension_id, | 603 bool ReadPrefAsBooleanAndReturn(const std::string& extension_id, |
604 const std::string& key) const; | 604 const std::string& key) const; |
605 | 605 |
606 // Interprets |pref_key| in |extension_id|'s preferences as an | 606 // Interprets |pref_key| in |extension_id|'s preferences as an |
607 // PermissionSet, and passes ownership of the set to the caller. | 607 // PermissionSet, and passes ownership of the set to the caller. |
608 scoped_refptr<const PermissionSet> ReadPrefAsPermissionSet( | 608 scoped_ptr<const PermissionSet> ReadPrefAsPermissionSet( |
609 const std::string& extension_id, | 609 const std::string& extension_id, |
610 const std::string& pref_key) const; | 610 const std::string& pref_key) const; |
611 | 611 |
612 // Converts the |new_value| to its value and sets the |pref_key| pref | 612 // Converts the |new_value| to its value and sets the |pref_key| pref |
613 // belonging to |extension_id|. | 613 // belonging to |extension_id|. |
614 void SetExtensionPrefPermissionSet(const std::string& extension_id, | 614 void SetExtensionPrefPermissionSet(const std::string& extension_id, |
615 const std::string& pref_key, | 615 const std::string& pref_key, |
616 const PermissionSet* new_value); | 616 const PermissionSet* new_value); |
617 | 617 |
618 // Returns an immutable dictionary for extension |id|'s prefs, or NULL if it | 618 // Returns an immutable dictionary for extension |id|'s prefs, or NULL if it |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
701 bool extensions_disabled_; | 701 bool extensions_disabled_; |
702 | 702 |
703 base::ObserverList<ExtensionPrefsObserver> observer_list_; | 703 base::ObserverList<ExtensionPrefsObserver> observer_list_; |
704 | 704 |
705 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs); | 705 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs); |
706 }; | 706 }; |
707 | 707 |
708 } // namespace extensions | 708 } // namespace extensions |
709 | 709 |
710 #endif // EXTENSIONS_BROWSER_EXTENSION_PREFS_H_ | 710 #endif // EXTENSIONS_BROWSER_EXTENSION_PREFS_H_ |
OLD | NEW |