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

Unified Diff: chrome/browser/extensions/extension_function_dispatcher.cc

Issue 10815028: Make ActiveTabPermissionManager also grant the tabs permission. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup Created 8 years, 5 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
Index: chrome/browser/extensions/extension_function_dispatcher.cc
diff --git a/chrome/browser/extensions/extension_function_dispatcher.cc b/chrome/browser/extensions/extension_function_dispatcher.cc
index 2e2935ddbd1d5f60530411dc05658f4315860276..3cd440bca16de918f9dcbbee4f6c7f778473a14e 100644
--- a/chrome/browser/extensions/extension_function_dispatcher.cc
+++ b/chrome/browser/extensions/extension_function_dispatcher.cc
@@ -153,6 +153,12 @@ void ExtensionFunctionDispatcher::DispatchOnIOThread(
function->set_include_incognito(
extension_info_map->IsIncognitoEnabled(extension->id()));
+ if (!function->HasPermission()) {
+ LOG(ERROR) << "Extension " << extension->id() << " does not have "
+ << "permission to function: " << params.name;
+ SendAccessDenied(ipc_sender, routing_id, params.request_id);
+ }
+
ExtensionsQuotaService* quota = extension_info_map->GetQuotaService();
if (quota->Assess(extension->id(), function, &params.arguments,
base::TimeTicks::Now())) {
@@ -211,6 +217,14 @@ void ExtensionFunctionDispatcher::Dispatch(
function_ui->set_profile(profile_);
function->set_include_incognito(service->CanCrossIncognito(extension));
+ if (!function->HasPermission()) {
Aaron Boodman 2012/07/31 14:53:43 Bummer about the duplication. Why can't this go at
not at google - send to devlin 2012/07/31 15:09:05 Because of the extra initialization that this need
not at google - send to devlin 2012/08/01 13:57:04 Turns out I was wrong about this. Done.
+ LOG(ERROR) << "Extension " << extension->id() << " does not have "
+ << "permission to function: " << params.name;
+ SendAccessDenied(render_view_host,
+ render_view_host->GetRoutingID(),
+ params.request_id);
+ }
+
ExtensionsQuotaService* quota = service->quota_service();
if (quota->Assess(extension->id(), function, &params.arguments,
base::TimeTicks::Now())) {
@@ -267,13 +281,6 @@ ExtensionFunction* ExtensionFunctionDispatcher::CreateExtensionFunction(
return NULL;
}
- if (!extension->HasAPIPermission(params.name)) {
- LOG(ERROR) << "Extension " << extension->id() << " does not have "
- << "permission to function: " << params.name;
- SendAccessDenied(ipc_sender, routing_id, params.request_id);
- return NULL;
- }
-
ExtensionFunction* function =
ExtensionFunctionRegistry::GetInstance()->NewFunction(params.name);
function->SetArgs(&params.arguments);

Powered by Google App Engine
This is Rietveld 408576698