| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 base::Time LastActivePingDay(const std::string& extension_id); | 166 base::Time LastActivePingDay(const std::string& extension_id); |
| 167 void SetLastActivePingDay(const std::string& extension_id, | 167 void SetLastActivePingDay(const std::string& extension_id, |
| 168 const base::Time& time); | 168 const base::Time& time); |
| 169 | 169 |
| 170 // A bit we use for determining if we should send the "days since active" | 170 // A bit we use for determining if we should send the "days since active" |
| 171 // ping. A value of true means the item has been active (launched) since the | 171 // ping. A value of true means the item has been active (launched) since the |
| 172 // last update check. | 172 // last update check. |
| 173 bool GetActiveBit(const std::string& extension_id); | 173 bool GetActiveBit(const std::string& extension_id); |
| 174 void SetActiveBit(const std::string& extension_id, bool active); | 174 void SetActiveBit(const std::string& extension_id, bool active); |
| 175 | 175 |
| 176 // Gets the permissions (|api_permissions|, |host_extent| and |full_access|) | 176 // Returns the granted permission set for the extension with |extension_id|. |
| 177 // granted to the extension with |extension_id|. |full_access| will be true | 177 // This sets |initialized| to true (when not NULL) if the extension's granted |
| 178 // if the extension has all effective permissions (like from an NPAPI plugin). | 178 // permissions have been initialized (to help distinguish between empty |
| 179 // Returns false if the granted permissions haven't been initialized yet. | 179 // permission sets and new extensions). |
| 180 // TODO(jstritar): Refactor the permissions into a class that encapsulates | 180 // This passes ownership of the returned set to the caller. |
| 181 // all granted permissions, can be initialized from preferences or | 181 ExtensionPermissionSet* GetGrantedPermissions( |
| 182 // a manifest file, and can be compared to each other. | 182 const std::string& extension_id, bool* initialized); |
| 183 bool GetGrantedPermissions(const std::string& extension_id, | |
| 184 bool* full_access, | |
| 185 std::set<std::string>* api_permissions, | |
| 186 URLPatternSet* host_extent); | |
| 187 | 183 |
| 188 // Adds the specified |api_permissions|, |host_extent| and |full_access| | 184 // Adds the |permissions| to the granted permissions set for the extension |
| 189 // to the granted permissions for extension with |extension_id|. | 185 // with |extension_id|. The new granted permissions set will be the union |
| 190 // |full_access| should be set to true if the extension effectively has all | 186 // of the already granted permissions and |permissions|. |
| 191 // permissions (such as by having an NPAPI plugin). | |
| 192 void AddGrantedPermissions(const std::string& extension_id, | 187 void AddGrantedPermissions(const std::string& extension_id, |
| 193 const bool full_access, | 188 const ExtensionPermissionSet& permissions); |
| 194 const std::set<std::string>& api_permissions, | |
| 195 const URLPatternSet& host_extent); | |
| 196 | 189 |
| 197 // Returns true if the user enabled this extension to be loaded in incognito | 190 // Returns true if the user enabled this extension to be loaded in incognito |
| 198 // mode. | 191 // mode. |
| 199 bool IsIncognitoEnabled(const std::string& extension_id); | 192 bool IsIncognitoEnabled(const std::string& extension_id); |
| 200 void SetIsIncognitoEnabled(const std::string& extension_id, bool enabled); | 193 void SetIsIncognitoEnabled(const std::string& extension_id, bool enabled); |
| 201 | 194 |
| 202 // Returns true if the user has chosen to allow this extension to inject | 195 // Returns true if the user has chosen to allow this extension to inject |
| 203 // scripts into pages with file URLs. | 196 // scripts into pages with file URLs. |
| 204 bool AllowFileAccess(const std::string& extension_id); | 197 bool AllowFileAccess(const std::string& extension_id); |
| 205 void SetAllowFileAccess(const std::string& extension_id, bool allow); | 198 void SetAllowFileAccess(const std::string& extension_id, bool allow); |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 | 393 |
| 401 // Reads a list pref |pref_key| as a string set from the extension with | 394 // Reads a list pref |pref_key| as a string set from the extension with |
| 402 // id |extension_id|. | 395 // id |extension_id|. |
| 403 bool ReadExtensionPrefStringSet(const std::string& extension_id, | 396 bool ReadExtensionPrefStringSet(const std::string& extension_id, |
| 404 const std::string& pref_key, | 397 const std::string& pref_key, |
| 405 std::set<std::string>* result); | 398 std::set<std::string>* result); |
| 406 | 399 |
| 407 // Adds the |added_values| to the value of |pref_key| for the extension | 400 // Adds the |added_values| to the value of |pref_key| for the extension |
| 408 // with id |extension_id| (the new value will be the union of the existing | 401 // with id |extension_id| (the new value will be the union of the existing |
| 409 // value and |added_values|). | 402 // value and |added_values|). |
| 410 void AddToExtensionPrefStringSet(const std::string& extension_id, | 403 void SetExtensionPrefStringSet(const std::string& extension_id, |
| 411 const std::string& pref_key, | 404 const std::string& pref_key, |
| 412 const std::set<std::string>& added_values); | 405 const std::set<std::string>& added_values); |
| 413 | 406 |
| 414 // Returns a dictionary for extension |id|'s prefs or NULL if it doesn't | 407 // Returns a dictionary for extension |id|'s prefs or NULL if it doesn't |
| 415 // exist. | 408 // exist. |
| 416 const DictionaryValue* GetExtensionPref(const std::string& id) const; | 409 const DictionaryValue* GetExtensionPref(const std::string& id) const; |
| 417 | 410 |
| 418 // Returns the dictionary of preferences controlled by the specified extension | 411 // Returns the dictionary of preferences controlled by the specified extension |
| 419 // or creates a new one. All entries in the dictionary contain non-expanded | 412 // or creates a new one. All entries in the dictionary contain non-expanded |
| 420 // paths. | 413 // paths. |
| 421 const DictionaryValue* GetExtensionControlledPrefs( | 414 const DictionaryValue* GetExtensionControlledPrefs( |
| 422 const std::string& id, | 415 const std::string& id, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 451 | 444 |
| 452 scoped_ptr<ExtensionContentSettingsStore> content_settings_store_; | 445 scoped_ptr<ExtensionContentSettingsStore> content_settings_store_; |
| 453 | 446 |
| 454 // The URLs of all of the toolstrips. | 447 // The URLs of all of the toolstrips. |
| 455 URLList shelf_order_; | 448 URLList shelf_order_; |
| 456 | 449 |
| 457 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs); | 450 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs); |
| 458 }; | 451 }; |
| 459 | 452 |
| 460 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_ | 453 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_ |
| OLD | NEW |