Chromium Code Reviews| Index: extensions/browser/extension_function_dispatcher.cc |
| diff --git a/extensions/browser/extension_function_dispatcher.cc b/extensions/browser/extension_function_dispatcher.cc |
| index f9bbec561b911df0eadb21606c01769ed0b4916f..43d3d0f0f566045afafb3b9acc1966052e3a68b9 100644 |
| --- a/extensions/browser/extension_function_dispatcher.cc |
| +++ b/extensions/browser/extension_function_dispatcher.cc |
| @@ -11,6 +11,7 @@ |
| #include "base/memory/ref_counted.h" |
| #include "base/metrics/sparse_histogram.h" |
| #include "base/process/process.h" |
| +#include "base/strings/string_util.h" |
| #include "base/values.h" |
| #include "build/build_config.h" |
| #include "content/public/browser/browser_thread.h" |
| @@ -229,8 +230,8 @@ void ExtensionFunctionDispatcher::DispatchOnIOThread( |
| const ExtensionHostMsg_Request_Params& params) { |
| const Extension* extension = |
| extension_info_map->extensions().GetByID(params.extension_id); |
| - if (!extension) |
| - return; |
| + const std::string& extension_id = extension ? |
| + extension->id() : base::EmptyString(); |
| ExtensionFunction::ResponseCallback callback( |
| base::Bind(&IOThreadResponseCallback, ipc_sender, routing_id, |
| @@ -255,20 +256,22 @@ void ExtensionFunctionDispatcher::DispatchOnIOThread( |
| } |
| function_io->set_ipc_sender(ipc_sender, routing_id); |
| function_io->set_extension_info_map(extension_info_map); |
| - function->set_include_incognito( |
| - extension_info_map->IsIncognitoEnabled(extension->id())); |
| + if (!extension_id.empty()) { |
|
not at google - send to devlin
2014/10/22 19:12:06
This isn't the same as the other code - see line 3
guohui
2014/10/22 19:53:47
Done.
|
| + function->set_include_incognito( |
| + extension_info_map->IsIncognitoEnabled(extension_id)); |
| + } |
| if (!CheckPermissions(function.get(), params, callback)) |
| return; |
| QuotaService* quota = extension_info_map->GetQuotaService(); |
| - std::string violation_error = quota->Assess(extension->id(), |
| - function.get(), |
| - ¶ms.arguments, |
| - base::TimeTicks::Now()); |
| + const std::string& violation_error = extension_id.empty() ? |
| + base::EmptyString() : |
| + quota->Assess(extension_id, function.get(), ¶ms.arguments, |
| + base::TimeTicks::Now()); |
| if (violation_error.empty()) { |
| scoped_ptr<base::ListValue> args(params.arguments.DeepCopy()); |
| - NotifyApiFunctionCalled(extension->id(), |
| + NotifyApiFunctionCalled(extension_id, |
| params.name, |
| args.Pass(), |
| static_cast<content::BrowserContext*>(profile_id)); |