Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Unified Diff: extensions/common/manifest_handlers/permissions_parser.cc

Issue 801603002: Add support for command line switches to Features, and as proof that it works, (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: test fixes Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « extensions/common/manifest_constants.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/common/manifest_handlers/permissions_parser.cc
diff --git a/extensions/common/manifest_handlers/permissions_parser.cc b/extensions/common/manifest_handlers/permissions_parser.cc
index 0b08ef9345673bb9d1ee0eed71b666592536214a..42d5c61258a54e330e9d602fc256d68a733df24a 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();
« no previous file with comments | « extensions/common/manifest_constants.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698