Chromium Code Reviews| 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, ¶ms.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, ¶ms.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(¶ms.arguments); |