diff options
author | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-07 18:58:19 +0000 |
---|---|---|
committer | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-07 18:58:19 +0000 |
commit | 35506359934707a1dc47e0b26684a145835dd9c3 (patch) | |
tree | a4c148fec23792743e3f5f024c852f6d668f173d /chrome/renderer/extensions/extension_process_bindings.h | |
parent | d4d9025c103adaa1b89b130ed229e61947ec40cc (diff) | |
download | chromium_src-35506359934707a1dc47e0b26684a145835dd9c3.zip chromium_src-35506359934707a1dc47e0b26684a145835dd9c3.tar.gz chromium_src-35506359934707a1dc47e0b26684a145835dd9c3.tar.bz2 |
Add module-level permissions to extensions.
This first pass is fairly simple. If a permission is not specified in the
manifest, the corresponding module will not be exposed to script. For example,
without specifying the "tabs" permission, chrome.tabs and chrome.windows will
not be available.
BUG=12140
TEST=no
Review URL: http://codereview.chromium.org/164039
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22745 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/extensions/extension_process_bindings.h')
-rw-r--r-- | chrome/renderer/extensions/extension_process_bindings.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/chrome/renderer/extensions/extension_process_bindings.h b/chrome/renderer/extensions/extension_process_bindings.h index 1ce6b47..dd212c5 100644 --- a/chrome/renderer/extensions/extension_process_bindings.h +++ b/chrome/renderer/extensions/extension_process_bindings.h @@ -26,6 +26,20 @@ class ExtensionProcessBindings { // Sets the page action ids for a particular extension. static void SetPageActions(const std::string& extension_id, const std::vector<std::string>& page_actions); + + // Sets the permissions for a particular extension. + static void SetPermissions(const std::string& extension_id, + const std::vector<std::string>& permissions); + + // Check if the extension in the currently running context has permission to + // access the given extension function. Must be called with a valid V8 + // context in scope. + static bool CurrentContextHasPermission(const std::string& function_name); + + // Throw a V8 exception indicating that permission to access function_name was + // denied. Must be called with a valid V8 context in scope. + static v8::Handle<v8::Value> ThrowPermissionDeniedException( + const std::string& function_name); }; #endif // CHROME_RENDERER_EXTENSIONS_EXTENSION_PROCESS_BINDINGS_H_ |