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 | 375 |
376 ExtensionSystem* extension_system = ExtensionSystem::Get(browser_context_); | 376 ExtensionSystem* extension_system = ExtensionSystem::Get(browser_context_); |
377 extensions::QuotaService* quota = extension_system->quota_service(); | 377 extensions::QuotaService* quota = extension_system->quota_service(); |
378 std::string violation_error = quota->Assess(extension->id(), | 378 std::string violation_error = quota->Assess(extension->id(), |
379 function.get(), | 379 function.get(), |
380 ¶ms.arguments, | 380 ¶ms.arguments, |
381 base::TimeTicks::Now()); | 381 base::TimeTicks::Now()); |
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 function->Run(); | 389 function->Run(); |
388 } else { | 390 } else { |
389 function->OnQuotaExceeded(violation_error); | 391 function->OnQuotaExceeded(violation_error); |
390 } | 392 } |
391 | 393 |
392 // Note: do not access |this| after this point. We may have been deleted | 394 // Note: do not access |this| after this point. We may have been deleted |
393 // if function->Run() ended up closing the tab that owns us. | 395 // if function->Run() ended up closing the tab that owns us. |
394 | 396 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 return function; | 510 return function; |
509 } | 511 } |
510 | 512 |
511 // static | 513 // static |
512 void ExtensionFunctionDispatcher::SendAccessDenied( | 514 void ExtensionFunctionDispatcher::SendAccessDenied( |
513 const ExtensionFunction::ResponseCallback& callback) { | 515 const ExtensionFunction::ResponseCallback& callback) { |
514 base::ListValue empty_list; | 516 base::ListValue empty_list; |
515 callback.Run(ExtensionFunction::FAILED, empty_list, | 517 callback.Run(ExtensionFunction::FAILED, empty_list, |
516 "Access to extension API denied."); | 518 "Access to extension API denied."); |
517 } | 519 } |
OLD | NEW |