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

Unified Diff: chrome/browser/extensions/api/permissions/permissions_api.cc

Issue 16085006: Allowing component extensions to request permissions NOT only from user's gestures (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: mpcomplete@ notes Created 7 years, 6 months 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/permissions/permissions_api.cc
diff --git a/chrome/browser/extensions/api/permissions/permissions_api.cc b/chrome/browser/extensions/api/permissions/permissions_api.cc
index cbaf1d9055f362b27f2567d2e3381f4fe7008bc3..c87b7e43c7d221898217bb62ee9e124d8870d7eb 100644
--- a/chrome/browser/extensions/api/permissions/permissions_api.cc
+++ b/chrome/browser/extensions/api/permissions/permissions_api.cc
@@ -147,7 +147,9 @@ PermissionsRequestFunction::~PermissionsRequestFunction() {}
bool PermissionsRequestFunction::RunImpl() {
results_ = Request::Results::Create(false);
- if (!user_gesture() && !ignore_user_gesture_for_tests) {
+ if (!user_gesture() &&
+ !ignore_user_gesture_for_tests &&
+ extension_->location() != Manifest::COMPONENT) {
error_ = kUserGestureRequiredError;
return false;
}
@@ -209,8 +211,9 @@ bool PermissionsRequestFunction::RunImpl() {
// We don't need to show the prompt if there are no new warnings, or if
// we're skipping the confirmation UI. All extension types but INTERNAL
// are allowed to silently increase their permission level.
- bool has_no_warnings = requested_permissions_->GetWarningMessages(
- GetExtension()->GetType()).empty();
+ bool has_no_warnings = extension_->location() == Manifest::COMPONENT ||
Matt Perry 2013/06/05 00:26:52 nit: this really belongs on the if statement below
vadimt 2013/06/05 00:33:07 Done.
+ requested_permissions_->GetWarningMessages(
+ GetExtension()->GetType()).empty();
if (auto_confirm_for_tests == PROCEED || has_no_warnings) {
InstallUIProceed();
} else if (auto_confirm_for_tests == ABORT) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698