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 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 ExtensionSystem* extension_system = ExtensionSystem::Get(browser_context_); | 375 ExtensionSystem* extension_system = ExtensionSystem::Get(browser_context_); |
376 QuotaService* quota = extension_system->quota_service(); | 376 QuotaService* quota = extension_system->quota_service(); |
377 std::string violation_error = quota->Assess(extension->id(), | 377 std::string violation_error = quota->Assess(extension->id(), |
378 function.get(), | 378 function.get(), |
379 ¶ms.arguments, | 379 ¶ms.arguments, |
380 base::TimeTicks::Now()); | 380 base::TimeTicks::Now()); |
381 | 381 |
382 if (violation_error.empty()) { | 382 if (violation_error.empty()) { |
383 scoped_ptr<base::ListValue> args(params.arguments.DeepCopy()); | 383 scoped_ptr<base::ListValue> args(params.arguments.DeepCopy()); |
384 | 384 |
| 385 // See crbug.com/39178. |
| 386 ExtensionsBrowserClient::Get()->PermitExternalProtocolHandler(); |
385 NotifyApiFunctionCalled( | 387 NotifyApiFunctionCalled( |
386 extension->id(), params.name, args.Pass(), browser_context_); | 388 extension->id(), params.name, args.Pass(), browser_context_); |
387 UMA_HISTOGRAM_SPARSE_SLOWLY("Extensions.FunctionCalls", | 389 UMA_HISTOGRAM_SPARSE_SLOWLY("Extensions.FunctionCalls", |
388 function->histogram_value()); | 390 function->histogram_value()); |
389 function->Run()->Execute(); | 391 function->Run()->Execute(); |
390 } else { | 392 } else { |
391 function->OnQuotaExceeded(violation_error); | 393 function->OnQuotaExceeded(violation_error); |
392 } | 394 } |
393 | 395 |
394 // Note: do not access |this| after this point. We may have been deleted | 396 // Note: do not access |this| after this point. We may have been deleted |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 | 529 |
528 // static | 530 // static |
529 void ExtensionFunctionDispatcher::SendAccessDenied( | 531 void ExtensionFunctionDispatcher::SendAccessDenied( |
530 const ExtensionFunction::ResponseCallback& callback) { | 532 const ExtensionFunction::ResponseCallback& callback) { |
531 base::ListValue empty_list; | 533 base::ListValue empty_list; |
532 callback.Run(ExtensionFunction::FAILED, empty_list, | 534 callback.Run(ExtensionFunction::FAILED, empty_list, |
533 "Access to extension API denied."); | 535 "Access to extension API denied."); |
534 } | 536 } |
535 | 537 |
536 } // namespace extensions | 538 } // namespace extensions |
OLD | NEW |