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

Unified Diff: chrome/browser/ui/browser.cc

Issue 10808059: Fix up code to check whether we can silently handle RPH calls before gesture check. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/browser.cc
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index d97dc29d64f3d8ffe0c59e5098fb9808912dd02a..777e9a9b42300b47d4ae87bd77b12142817a46a9 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -867,6 +867,9 @@ void Browser::RegisterProtocolHandlerHelper(WebContents* web_contents,
TabSpecificContentSettings* content_settings =
tab_contents->content_settings();
+ if (registry->SilentlyHandleRegisterHandlerRequest(handler))
+ return;
+
if (!user_gesture && window) {
content_settings->set_pending_protocol_handler(handler);
content_settings->set_previous_protocol_handler(
@@ -882,30 +885,28 @@ void Browser::RegisterProtocolHandlerHelper(WebContents* web_contents,
window->GetLocationBar()->UpdateContentSettingsIcons();
}
- if (!registry->SilentlyHandleRegisterHandlerRequest(handler)) {
- content::RecordAction(
- UserMetricsAction("RegisterProtocolHandler.InfoBar_Shown"));
- InfoBarTabHelper* infobar_helper = tab_contents->infobar_tab_helper();
-
- RegisterProtocolHandlerInfoBarDelegate* rph_delegate =
- new RegisterProtocolHandlerInfoBarDelegate(infobar_helper,
- registry,
- handler);
-
- for (size_t i = 0; i < infobar_helper->infobar_count(); i++) {
- InfoBarDelegate* delegate = infobar_helper->GetInfoBarDelegateAt(i);
- RegisterProtocolHandlerInfoBarDelegate* cast_delegate =
- delegate->AsRegisterProtocolHandlerInfoBarDelegate();
- if (cast_delegate != NULL && cast_delegate->IsReplacedBy(rph_delegate)) {
- infobar_helper->ReplaceInfoBar(cast_delegate, rph_delegate);
- rph_delegate = NULL;
- break;
- }
- }
+ content::RecordAction(
+ UserMetricsAction("RegisterProtocolHandler.InfoBar_Shown"));
+ InfoBarTabHelper* infobar_helper = tab_contents->infobar_tab_helper();
- if (rph_delegate != NULL)
- infobar_helper->AddInfoBar(rph_delegate);
+ RegisterProtocolHandlerInfoBarDelegate* rph_delegate =
+ new RegisterProtocolHandlerInfoBarDelegate(infobar_helper,
+ registry,
+ handler);
+
+ for (size_t i = 0; i < infobar_helper->infobar_count(); i++) {
+ InfoBarDelegate* delegate = infobar_helper->GetInfoBarDelegateAt(i);
+ RegisterProtocolHandlerInfoBarDelegate* cast_delegate =
+ delegate->AsRegisterProtocolHandlerInfoBarDelegate();
+ if (cast_delegate != NULL && cast_delegate->IsReplacedBy(rph_delegate)) {
+ infobar_helper->ReplaceInfoBar(cast_delegate, rph_delegate);
+ rph_delegate = NULL;
+ break;
+ }
}
+
+ if (rph_delegate != NULL)
+ infobar_helper->AddInfoBar(rph_delegate);
}
// static
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698