| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "extensions/browser/extension_function_dispatcher.h" | 5 #include "extensions/browser/extension_function_dispatcher.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/json/json_string_value_serializer.h" | 8 #include "base/json/json_string_value_serializer.h" |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 | 371 |
| 372 ExtensionSystem* extension_system = ExtensionSystem::Get(browser_context_); | 372 ExtensionSystem* extension_system = ExtensionSystem::Get(browser_context_); |
| 373 QuotaService* quota = extension_system->quota_service(); | 373 QuotaService* quota = extension_system->quota_service(); |
| 374 std::string violation_error = quota->Assess(extension->id(), | 374 std::string violation_error = quota->Assess(extension->id(), |
| 375 function.get(), | 375 function.get(), |
| 376 ¶ms.arguments, | 376 ¶ms.arguments, |
| 377 base::TimeTicks::Now()); | 377 base::TimeTicks::Now()); |
| 378 if (violation_error.empty()) { | 378 if (violation_error.empty()) { |
| 379 scoped_ptr<base::ListValue> args(params.arguments.DeepCopy()); | 379 scoped_ptr<base::ListValue> args(params.arguments.DeepCopy()); |
| 380 | 380 |
| 381 // See crbug.com/39178. |
| 382 ExtensionsBrowserClient::Get()->PermitExternalProtocolHandler(); |
| 381 NotifyApiFunctionCalled( | 383 NotifyApiFunctionCalled( |
| 382 extension->id(), params.name, args.Pass(), browser_context_); | 384 extension->id(), params.name, args.Pass(), browser_context_); |
| 383 UMA_HISTOGRAM_SPARSE_SLOWLY("Extensions.FunctionCalls", | 385 UMA_HISTOGRAM_SPARSE_SLOWLY("Extensions.FunctionCalls", |
| 384 function->histogram_value()); | 386 function->histogram_value()); |
| 385 function->Run()->Execute(); | 387 function->Run()->Execute(); |
| 386 } else { | 388 } else { |
| 387 function->OnQuotaExceeded(violation_error); | 389 function->OnQuotaExceeded(violation_error); |
| 388 } | 390 } |
| 389 | 391 |
| 390 // Note: do not access |this| after this point. We may have been deleted | 392 // Note: do not access |this| after this point. We may have been deleted |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 | 510 |
| 509 // static | 511 // static |
| 510 void ExtensionFunctionDispatcher::SendAccessDenied( | 512 void ExtensionFunctionDispatcher::SendAccessDenied( |
| 511 const ExtensionFunction::ResponseCallback& callback) { | 513 const ExtensionFunction::ResponseCallback& callback) { |
| 512 base::ListValue empty_list; | 514 base::ListValue empty_list; |
| 513 callback.Run(ExtensionFunction::FAILED, empty_list, | 515 callback.Run(ExtensionFunction::FAILED, empty_list, |
| 514 "Access to extension API denied."); | 516 "Access to extension API denied."); |
| 515 } | 517 } |
| 516 | 518 |
| 517 } // namespace extensions | 519 } // namespace extensions |
| OLD | NEW |