summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions/extension.h
diff options
context:
space:
mode:
authormpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-07 18:58:19 +0000
committermpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-07 18:58:19 +0000
commit35506359934707a1dc47e0b26684a145835dd9c3 (patch)
treea4c148fec23792743e3f5f024c852f6d668f173d /chrome/common/extensions/extension.h
parentd4d9025c103adaa1b89b130ed229e61947ec40cc (diff)
downloadchromium_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/common/extensions/extension.h')
-rw-r--r--chrome/common/extensions/extension.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/chrome/common/extensions/extension.h b/chrome/common/extensions/extension.h
index 550fbba..7969e96 100644
--- a/chrome/common/extensions/extension.h
+++ b/chrome/common/extensions/extension.h
@@ -58,6 +58,10 @@ class Extension {
// Icon sizes used by the extension system.
static const int kIconSizes[];
+ // Each permission is a module that the extension is permitted to use.
+ static const char* kPermissionNames[];
+ static const size_t kNumPermissions;
+
// An NPAPI plugin included in the extension.
struct PluginInfo {
FilePath path; // Path to the plugin.
@@ -172,7 +176,12 @@ class Extension {
const std::vector<PluginInfo>& plugins() const { return plugins_; }
const GURL& background_url() const { return background_url_; }
const std::vector<ToolstripInfo>& toolstrips() const { return toolstrips_; }
- const std::vector<URLPattern>& permissions() const { return permissions_; }
+ const std::vector<URLPattern>& host_permissions() const {
+ return host_permissions_;
+ }
+ const std::vector<std::string>& api_permissions() const {
+ return api_permissions_;
+ }
const GURL& update_url() const { return update_url_; }
const std::map<int, std::string>& icons() { return icons_; }
@@ -293,8 +302,11 @@ class Extension {
// Whether the extension is a theme - if it is, certain things are disabled.
bool is_theme_;
+ // The set of module-level APIs this extension can use.
+ std::vector<std::string> api_permissions_;
+
// The sites this extension has permission to talk to (using XHR, etc).
- std::vector<URLPattern> permissions_;
+ std::vector<URLPattern> host_permissions_;
// The paths to the icons the extension contains mapped by their width.
std::map<int, std::string> icons_;