Chromium Code Reviews| Index: chrome/browser/ui/browser.cc |
| diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc |
| index de040df806f5faa506336956155b4d902f9632ed..50f242f63f1245464f8cc16d85ce106791b779bf 100644 |
| --- a/chrome/browser/ui/browser.cc |
| +++ b/chrome/browser/ui/browser.cc |
| @@ -37,6 +37,7 @@ |
| #include "chrome/browser/character_encoding.h" |
| #include "chrome/browser/chrome_page_zoom.h" |
| #include "chrome/browser/content_settings/host_content_settings_map.h" |
| +#include "chrome/browser/content_settings/tab_specific_content_settings.h" |
| #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
| #include "chrome/browser/custom_handlers/register_protocol_handler_infobar_delegate.h" |
| #include "chrome/browser/debugger/devtools_toggle_action.h" |
| @@ -1980,7 +1981,8 @@ void Browser::RegisterProtocolHandlerHelper(WebContents* web_contents, |
| const std::string& protocol, |
| const GURL& url, |
| const string16& title, |
| - bool user_gesture) { |
| + bool user_gesture, |
| + BrowserWindow* window) { |
| TabContents* tab_contents = TabContents::FromWebContents(web_contents); |
| if (!tab_contents || tab_contents->profile()->IsOffTheRecord()) |
| return; |
| @@ -1990,6 +1992,21 @@ void Browser::RegisterProtocolHandlerHelper(WebContents* web_contents, |
| ProtocolHandlerRegistry* registry = |
| tab_contents->profile()->GetProtocolHandlerRegistry(); |
| + TabSpecificContentSettings* content_settings = |
| + tab_contents->content_settings(); |
| + |
| + if (!user_gesture && window) { |
|
Peter Kasting
2012/06/25 23:55:30
It worries me that you NULL-check |window| here an
Greg Billock
2012/06/26 19:17:04
You're right, that is an error. (It can be null fo
|
| + content_settings->SetPendingProtocolHandler(handler); |
| + content_settings->SetPreviousProtocolHandler( |
| + registry->GetHandlerFor(handler.protocol())); |
| + window->GetLocationBar()->UpdateContentSettingsIcons(); |
| + return; |
| + } |
| + |
| + // Make sure content-setting icon is turned off in case the page does |
| + // ungestured and gestured RPH calls. |
| + content_settings->ClearPendingProtocolHandler(); |
| + window->GetLocationBar()->UpdateContentSettingsIcons(); |
| if (!registry->SilentlyHandleRegisterHandlerRequest(handler)) { |
| content::RecordAction( |
| @@ -3361,7 +3378,7 @@ void Browser::RegisterProtocolHandler(WebContents* web_contents, |
| const string16& title, |
| bool user_gesture) { |
| RegisterProtocolHandlerHelper( |
| - web_contents, protocol, url, title, user_gesture); |
| + web_contents, protocol, url, title, user_gesture, window()); |
| } |
| void Browser::RegisterIntentHandler( |