Chromium Code Reviews| Index: chrome/browser/ui/browser.cc |
| diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc |
| index 5aa2819e704137e8fe31877301e7c08f893648df..0c3d646f1137a37f2bab54beeb48c5e45b5f5b31 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" |
| @@ -2268,7 +2269,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; |
| @@ -2278,6 +2280,23 @@ void Browser::RegisterProtocolHandlerHelper(WebContents* web_contents, |
| ProtocolHandlerRegistry* registry = |
| tab_contents->profile()->GetProtocolHandlerRegistry(); |
| + TabSpecificContentSettings* content_settings = |
| + tab_contents->content_settings(); |
| + |
| + if (!user_gesture && window) { |
| + content_settings->SetRegisterProtocolHandlerCalledUngestured(handler); |
| + ProtocolHandler old_handler = registry->GetHandlerFor(handler.protocol()); |
| + if (!old_handler.IsEmpty()) |
| + content_settings->SetOldRegisterProtocolHandlerTitle(old_handler.title()); |
| + window->GetLocationBar()->UpdateContentSettingsIcons(); |
| + return; |
| + } |
| + |
| + // Make sure content-settings are turned off in case the page does ungestured |
| + // and gestured RPH calls. |
| + content_settings->SetRegisterProtocolHandlerCalledUngestured( |
|
koz (OOO until 15th September)
2012/06/21 01:50:53
Could change to
content_settings->ClearPendingReg
Greg Billock
2012/06/21 19:59:11
You think the extra method is worth it?
koz (OOO until 15th September)
2012/06/21 23:03:50
Yeah, I don't think it's a big cost, up to you tho
Greg Billock
2012/06/21 23:10:59
Ok. Adding.
On 2012/06/21 23:03:50, koz wrote:
|
| + ProtocolHandler::EmptyProtocolHandler()); |
| + window->GetLocationBar()->UpdateContentSettingsIcons(); |
| if (!registry->SilentlyHandleRegisterHandlerRequest(handler)) { |
| content::RecordAction( |
| @@ -3638,7 +3657,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( |