diff options
author | jstritar@chromium.org <jstritar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-28 23:58:54 +0000 |
---|---|---|
committer | jstritar@chromium.org <jstritar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-28 23:58:54 +0000 |
commit | fdf6801902413c5662d071fba731e013e04f5181 (patch) | |
tree | d10a4ff3ed55e7ba76da3f173466b64b6b62c224 /chrome/common/extensions/extension.h | |
parent | 93939461bcb7d8732d60f1cd70965c25b8617c4a (diff) | |
download | chromium_src-fdf6801902413c5662d071fba731e013e04f5181.zip chromium_src-fdf6801902413c5662d071fba731e013e04f5181.tar.gz chromium_src-fdf6801902413c5662d071fba731e013e04f5181.tar.bz2 |
Adds a section to the extension preferences to store the recognized permissions that the user has granted the extension.
Ignores unknown permissions when installing extensions.
Disables extension and prompts user to re-enable when unknown permissions become recognized (e.g., through browser upgrade).
Allows extensions to remove a permission in one version, then add them back in the next without prompting the user.
BUG=42742
TEST=ExtensionsServiceTest, ExtensionPrefsGrantedPermissions, ExtensionTest
Review URL: http://codereview.chromium.org/4687005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67500 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/extensions/extension.h')
-rw-r--r-- | chrome/common/extensions/extension.h | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/chrome/common/extensions/extension.h b/chrome/common/extensions/extension.h index 13b7cc1..29bc888 100644 --- a/chrome/common/extensions/extension.h +++ b/chrome/common/extensions/extension.h @@ -163,6 +163,9 @@ class Extension : public base::RefCountedThreadSafe<Extension> { // still accepted as meaning the same thing as kUnlimitedStoragePermission. static const char kOldUnlimitedStoragePermission[]; + // Valid schemes for web extent URLPatterns. + static const int kValidWebExtentSchemes; + // Returns true if the string is one of the known hosted app permissions (see // kHostedAppPermissionNames). static bool IsHostedAppPermission(const std::string& permission); @@ -250,8 +253,11 @@ class Extension : public base::RefCountedThreadSafe<Extension> { std::string* output, bool is_public); // Determine whether |new_extension| has increased privileges compared to - // |old_extension|. - static bool IsPrivilegeIncrease(const Extension* old_extension, + // its previously granted permissions, specified by |granted_apis|, + // |granted_extent| and |granted_full_access|. + static bool IsPrivilegeIncrease(const bool granted_full_access, + const std::set<std::string>& granted_apis, + const ExtensionExtent& granted_extent, const Extension* new_extension); // Given an extension and icon size, read it if present and decode it into @@ -301,6 +307,13 @@ class Extension : public base::RefCountedThreadSafe<Extension> { static bool HasApiPermission(const std::set<std::string>& api_permissions, const std::string& function_name); + // Whether the |effective_host_permissions| and |api_permissions| include + // effective access to all hosts. See the non-static version of the method + // for more details. + static bool HasEffectiveAccessToAllHosts( + const ExtensionExtent& effective_host_permissions, + const std::set<std::string>& api_permissions); + bool HasApiPermission(const std::string& function_name) const { return HasApiPermission(this->api_permissions(), function_name); } @@ -325,6 +338,10 @@ class Extension : public base::RefCountedThreadSafe<Extension> { // network, etc.) bool HasEffectiveAccessToAllHosts() const; + // Whether the extension effectively has all permissions (for example, by + // having an NPAPI plugin). + bool HasFullPermissions() const; + // Returns the Homepage URL for this extension. If homepage_url was not // specified in the manifest, this returns the Google Gallery URL. For // third-party extensions, this returns a blank GURL. |