Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(893)

Side by Side Diff: chrome/browser/extensions/extension_prefs.h

Issue 7432006: Add an experimental permissions API for extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix clang Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 const std::string& pref_key, 412 const std::string& pref_key,
403 URLPatternSet* result, 413 URLPatternSet* result,
404 int valid_schemes); 414 int valid_schemes);
405 415
406 // Converts |new_value| to a list of strings and sets the |pref_key| pref 416 // Converts |new_value| to a list of strings and sets the |pref_key| pref
407 // belonging to |extension_id|. 417 // belonging to |extension_id|.
408 void SetExtensionPrefURLPatternSet(const std::string& extension_id, 418 void SetExtensionPrefURLPatternSet(const std::string& extension_id,
409 const std::string& pref_key, 419 const std::string& pref_key,
410 const URLPatternSet& new_value); 420 const URLPatternSet& new_value);
411 421
422 // Interprets |pref_key| in |extension_id|'s preferences as an
423 // ExtensionPermissionSet, and passes ownership of the set to the caller.
424 ExtensionPermissionSet* ReadExtensionPrefPermissionSet(
425 const std::string& extension_id,
426 const std::string& pref_key);
427
428 // Converts the |new_value| to its value and sets the |pref_key| pref
429 // belonging to |extension_id|.
430 void SetExtensionPrefPermissionSet(const std::string& extension_id,
431 const std::string& pref_key,
432 const ExtensionPermissionSet* new_value);
433
412 // Returns a dictionary for extension |id|'s prefs or NULL if it doesn't 434 // Returns a dictionary for extension |id|'s prefs or NULL if it doesn't
413 // exist. 435 // exist.
414 const base::DictionaryValue* GetExtensionPref(const std::string& id) const; 436 const base::DictionaryValue* GetExtensionPref(const std::string& id) const;
415 437
416 // Returns the dictionary of preferences controlled by the specified extension 438 // Returns the dictionary of preferences controlled by the specified extension
417 // or creates a new one. All entries in the dictionary contain non-expanded 439 // or creates a new one. All entries in the dictionary contain non-expanded
418 // paths. 440 // paths.
419 const base::DictionaryValue* GetExtensionControlledPrefs( 441 const base::DictionaryValue* GetExtensionControlledPrefs(
420 const std::string& id, 442 const std::string& id,
421 bool incognito) const; 443 bool incognito) const;
(...skipping 30 matching lines...) Expand all
452 474
453 scoped_refptr<ExtensionContentSettingsStore> content_settings_store_; 475 scoped_refptr<ExtensionContentSettingsStore> content_settings_store_;
454 476
455 // The URLs of all of the toolstrips. 477 // The URLs of all of the toolstrips.
456 URLList shelf_order_; 478 URLList shelf_order_;
457 479
458 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs); 480 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs);
459 }; 481 };
460 482
461 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_ 483 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_permissions_api_constants.cc ('k') | chrome/browser/extensions/extension_prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698