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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 // This passes ownership of the returned set to the caller. | 180 // This passes ownership of the returned set to the caller. |
181 ExtensionPermissionSet* GetGrantedPermissions( | 181 ExtensionPermissionSet* GetGrantedPermissions( |
182 const std::string& extension_id); | 182 const std::string& extension_id); |
183 | 183 |
184 // Adds |permissions| to the granted permissions set for the extension with | 184 // Adds |permissions| to the granted permissions set for the extension with |
185 // |extension_id|. The new granted permissions set will be the union of | 185 // |extension_id|. The new granted permissions set will be the union of |
186 // |permissions| and the already granted permissions. | 186 // |permissions| and the already granted permissions. |
187 void AddGrantedPermissions(const std::string& extension_id, | 187 void AddGrantedPermissions(const std::string& extension_id, |
188 const ExtensionPermissionSet* permissions); | 188 const ExtensionPermissionSet* permissions); |
189 | 189 |
| 190 // Gets the active permission set for the specified extension. This may |
| 191 // differ from the permissions in the manifest due to the optional |
| 192 // permissions API. This passes ownership of the set to the caller. |
| 193 ExtensionPermissionSet* GetActivePermissions( |
| 194 const std::string& extension_id); |
| 195 |
| 196 // Sets the active |permissions| for the extension with |extension_id|. |
| 197 void SetActivePermissions(const std::string& extension_id, |
| 198 const ExtensionPermissionSet* permissions); |
| 199 |
190 // Returns true if the user enabled this extension to be loaded in incognito | 200 // Returns true if the user enabled this extension to be loaded in incognito |
191 // mode. | 201 // mode. |
192 bool IsIncognitoEnabled(const std::string& extension_id); | 202 bool IsIncognitoEnabled(const std::string& extension_id); |
193 void SetIsIncognitoEnabled(const std::string& extension_id, bool enabled); | 203 void SetIsIncognitoEnabled(const std::string& extension_id, bool enabled); |
194 | 204 |
195 // Returns true if the user has chosen to allow this extension to inject | 205 // Returns true if the user has chosen to allow this extension to inject |
196 // scripts into pages with file URLs. | 206 // scripts into pages with file URLs. |
197 bool AllowFileAccess(const std::string& extension_id); | 207 bool AllowFileAccess(const std::string& extension_id); |
198 void SetAllowFileAccess(const std::string& extension_id, bool allow); | 208 void SetAllowFileAccess(const std::string& extension_id, bool allow); |
199 bool HasAllowFileAccessSetting(const std::string& extension_id) const; | 209 bool HasAllowFileAccessSetting(const std::string& extension_id) const; |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 const std::string& pref_key, | 408 const std::string& pref_key, |
399 URLPatternSet* result, | 409 URLPatternSet* result, |
400 int valid_schemes); | 410 int valid_schemes); |
401 | 411 |
402 // Converts |new_value| to a list of strings and sets the |pref_key| pref | 412 // Converts |new_value| to a list of strings and sets the |pref_key| pref |
403 // belonging to |extension_id|. | 413 // belonging to |extension_id|. |
404 void SetExtensionPrefURLPatternSet(const std::string& extension_id, | 414 void SetExtensionPrefURLPatternSet(const std::string& extension_id, |
405 const std::string& pref_key, | 415 const std::string& pref_key, |
406 const URLPatternSet& new_value); | 416 const URLPatternSet& new_value); |
407 | 417 |
| 418 // Interprets |pref_key| in |extension_id|'s preferences as an |
| 419 // ExtensionPermissionSet, and passes ownership of the set to the caller. |
| 420 ExtensionPermissionSet* ReadExtensionPrefPermissionSet( |
| 421 const std::string& extension_id, |
| 422 const std::string& pref_key); |
| 423 |
| 424 // Converts the |new_value| to its value and sets the |pref_key| pref |
| 425 // belonging to |extension_id|. |
| 426 void SetExtensionPrefPermissionSet(const std::string& extension_id, |
| 427 const std::string& pref_key, |
| 428 const ExtensionPermissionSet* new_value); |
| 429 |
408 // Returns a dictionary for extension |id|'s prefs or NULL if it doesn't | 430 // Returns a dictionary for extension |id|'s prefs or NULL if it doesn't |
409 // exist. | 431 // exist. |
410 const base::DictionaryValue* GetExtensionPref(const std::string& id) const; | 432 const base::DictionaryValue* GetExtensionPref(const std::string& id) const; |
411 | 433 |
412 // Returns the dictionary of preferences controlled by the specified extension | 434 // Returns the dictionary of preferences controlled by the specified extension |
413 // or creates a new one. All entries in the dictionary contain non-expanded | 435 // or creates a new one. All entries in the dictionary contain non-expanded |
414 // paths. | 436 // paths. |
415 const base::DictionaryValue* GetExtensionControlledPrefs( | 437 const base::DictionaryValue* GetExtensionControlledPrefs( |
416 const std::string& id, | 438 const std::string& id, |
417 bool incognito) const; | 439 bool incognito) const; |
(...skipping 30 matching lines...) Expand all Loading... |
448 | 470 |
449 scoped_refptr<ExtensionContentSettingsStore> content_settings_store_; | 471 scoped_refptr<ExtensionContentSettingsStore> content_settings_store_; |
450 | 472 |
451 // The URLs of all of the toolstrips. | 473 // The URLs of all of the toolstrips. |
452 URLList shelf_order_; | 474 URLList shelf_order_; |
453 | 475 |
454 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs); | 476 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs); |
455 }; | 477 }; |
456 | 478 |
457 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_ | 479 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_ |
OLD | NEW |