summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions/extension.h
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-27 06:47:46 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-27 06:47:46 +0000
commitb24d831bff725a59e472f0aaa4547dfb31344490 (patch)
tree90d92f9fb363696c1dbd37b297068624ed4af6ea /chrome/common/extensions/extension.h
parenta0a04ee4b35d3abb9b4d0bf093fcaead55821473 (diff)
downloadchromium_src-b24d831bff725a59e472f0aaa4547dfb31344490.zip
chromium_src-b24d831bff725a59e472f0aaa4547dfb31344490.tar.gz
chromium_src-b24d831bff725a59e472f0aaa4547dfb31344490.tar.bz2
Update of the extension install UI:
- Give the user more information about which hosts an extension can access. - Remove the red severe warning because it doesn't play well with themes and because it adds nothing when the other text is more specific. - Make the image a bit smaller. Also integrate this new idea with the silent/not-silent update flow. BUG=12129,12140,19582 Review URL: http://codereview.chromium.org/173463 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24599 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/extensions/extension.h')
-rw-r--r--chrome/common/extensions/extension.h34
1 files changed, 20 insertions, 14 deletions
diff --git a/chrome/common/extensions/extension.h b/chrome/common/extensions/extension.h
index 34685fc..ab68d60 100644
--- a/chrome/common/extensions/extension.h
+++ b/chrome/common/extensions/extension.h
@@ -23,6 +23,8 @@
// Represents a Chrome extension.
class Extension {
public:
+ typedef std::vector<URLPattern> HostPermissions;
+
// What an extension was loaded from.
enum Location {
INVALID,
@@ -65,15 +67,6 @@ class Extension {
static const char* kPermissionNames[];
static const size_t kNumPermissions;
- // A classification of how dangerous an extension can be, based on what it has
- // access to.
- enum PermissionClass {
- PERMISSION_CLASS_LOW = 0, // green
- PERMISSION_CLASS_MEDIUM, // yellow
- PERMISSION_CLASS_HIGH, // orange
- PERMISSION_CLASS_FULL, // red
- };
-
struct PrivacyBlacklistInfo {
FilePath path; // Path to the plain-text blacklist.
};
@@ -175,6 +168,11 @@ class Extension {
static bool FormatPEMForFileOutput(const std::string input,
std::string* output, bool is_public);
+ // Determine whether we should allow a silent upgrade from |old_extension| to
+ // |new_extension|. If not, the user will have to approve the upgrade.
+ static bool AllowSilentUpgrade(Extension* old_extension,
+ Extension* new_extension);
+
// Initialize the extension from a parsed manifest.
// If |require_id| is true, will return an error if the "id" key is missing
// from the value.
@@ -201,12 +199,23 @@ 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>& host_permissions() const {
+ const HostPermissions& host_permissions() const {
return host_permissions_;
}
const std::vector<std::string>& api_permissions() const {
return api_permissions_;
}
+
+ // Returns the set of hosts that the extension effectively has access to. This
+ // is used in the permissions UI and is a combination of the hosts accessible
+ // through content scripts and the hosts accessible through XHR.
+ const std::set<std::string> GetEffectiveHostPermissions() const;
+
+ // Whether the extension has access to all hosts. This is true if there is
+ // a content script that matches all hosts, or if there is a host permission
+ // for all hosts.
+ bool HasAccessToAllHosts() const;
+
const GURL& update_url() const { return update_url_; }
const std::map<int, std::string>& icons() { return icons_; }
@@ -230,9 +239,6 @@ class Extension {
// the browser might load (like themes and page action icons).
std::set<FilePath> GetBrowserImages();
- // Calculates and returns the permission class this extension is in.
- PermissionClass GetPermissionClass();
-
// Returns an absolute path to the given icon inside of the extension. Returns
// an empty FilePath if the extension does not have that icon.
FilePath GetIconPath(Icons icon);
@@ -359,7 +365,7 @@ class Extension {
std::vector<std::string> api_permissions_;
// The sites this extension has permission to talk to (using XHR, etc).
- std::vector<URLPattern> host_permissions_;
+ HostPermissions host_permissions_;
// The paths to the icons the extension contains mapped by their width.
std::map<int, std::string> icons_;