Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(473)

Side by Side Diff: extensions/browser/extension_function_dispatcher.cc

Issue 131783012: Fix the handling of user gestures for external protocol handler dialogs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove unnecessary DCHECK Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 &params.arguments, 380 &params.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();
387 NotifyApiFunctionCalled( 385 NotifyApiFunctionCalled(
388 extension->id(), params.name, args.Pass(), browser_context_); 386 extension->id(), params.name, args.Pass(), browser_context_);
389 function->Run(); 387 function->Run();
390 } else { 388 } else {
391 function->OnQuotaExceeded(violation_error); 389 function->OnQuotaExceeded(violation_error);
392 } 390 }
393 391
394 // 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
395 // if function->Run() ended up closing the tab that owns us. 393 // if function->Run() ended up closing the tab that owns us.
396 394
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 return function; 508 return function;
511 } 509 }
512 510
513 // static 511 // static
514 void ExtensionFunctionDispatcher::SendAccessDenied( 512 void ExtensionFunctionDispatcher::SendAccessDenied(
515 const ExtensionFunction::ResponseCallback& callback) { 513 const ExtensionFunction::ResponseCallback& callback) {
516 base::ListValue empty_list; 514 base::ListValue empty_list;
517 callback.Run(ExtensionFunction::FAILED, empty_list, 515 callback.Run(ExtensionFunction::FAILED, empty_list,
518 "Access to extension API denied."); 516 "Access to extension API denied.");
519 } 517 }
OLDNEW
« no previous file with comments | « content/public/browser/resource_dispatcher_host_delegate.cc ('k') | extensions/browser/extensions_browser_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698