summaryrefslogtreecommitdiffstats
path: root/extensions/common/manifest_handlers
diff options
context:
space:
mode:
authorkalman <kalman@chromium.org>2014-12-12 14:04:23 -0800
committerCommit bot <commit-bot@chromium.org>2014-12-12 22:04:50 +0000
commitae342c9a0fa8a3c55bc89bf9a1543ad85f7d404f (patch)
tree55eaca44eec5fb3bad91de53987b5b701d8119ea /extensions/common/manifest_handlers
parent7547705543d6b711a166e513a43a4e43f93fd254 (diff)
downloadchromium_src-ae342c9a0fa8a3c55bc89bf9a1543ad85f7d404f.zip
chromium_src-ae342c9a0fa8a3c55bc89bf9a1543ad85f7d404f.tar.gz
chromium_src-ae342c9a0fa8a3c55bc89bf9a1543ad85f7d404f.tar.bz2
Add support for command line switches to Features, and as proof that it works,
use it for the experimental permission. BUG=440194 R=rockot@chromium.org Review URL: https://codereview.chromium.org/801603002 Cr-Commit-Position: refs/heads/master@{#308176}
Diffstat (limited to 'extensions/common/manifest_handlers')
-rw-r--r--extensions/common/manifest_handlers/permissions_parser.cc37
1 files changed, 10 insertions, 27 deletions
diff --git a/extensions/common/manifest_handlers/permissions_parser.cc b/extensions/common/manifest_handlers/permissions_parser.cc
index 0b08ef9..42d5c61 100644
--- a/extensions/common/manifest_handlers/permissions_parser.cc
+++ b/extensions/common/manifest_handlers/permissions_parser.cc
@@ -46,26 +46,6 @@ ManifestPermissions::ManifestPermissions(
ManifestPermissions::~ManifestPermissions() {
}
-// Custom checks for the experimental permission that can't be expressed in
-// _permission_features.json.
-bool CanSpecifyExperimentalPermission(const Extension* extension) {
- if (extension->location() == Manifest::COMPONENT)
- return true;
-
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableExperimentalExtensionApis)) {
- return true;
- }
-
- // We rely on the webstore to check access to experimental. This way we can
- // whitelist extensions to have access to experimental in just the store, and
- // not have to push a new version of the client.
- if (extension->from_webstore())
- return true;
-
- return false;
-}
-
// Checks whether the host |pattern| is allowed for the given |extension|,
// given API permissions |permissions|.
bool CanSpecifyHostPermission(const Extension* extension,
@@ -146,6 +126,16 @@ bool ParseHelper(Extension* extension,
continue;
}
+ // Sneaky check for "experimental", which we always allow for extensions
+ // installed from the Webstore. This way we can whitelist extensions to
+ // have access to experimental in just the store, and not have to push a
+ // new version of the client. Otherwise, experimental goes through the
+ // usual features check.
+ if (iter->id() == APIPermission::kExperimental &&
+ extension->from_webstore()) {
+ continue;
+ }
+
Feature::Availability availability =
feature->IsAvailableToExtension(extension);
if (!availability.is_available()) {
@@ -157,13 +147,6 @@ bool ParseHelper(Extension* extension,
to_remove.push_back(iter->id());
continue;
}
-
- if (iter->id() == APIPermission::kExperimental) {
- if (!CanSpecifyExperimentalPermission(extension)) {
- *error = base::ASCIIToUTF16(errors::kExperimentalFlagRequired);
- return false;
- }
- }
}
api_permissions->AddImpliedPermissions();