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 |