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

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

Issue 10584042: Bring up a content settings icon for ungestured registerProtocolHandler call. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Repair merge to head Created 8 years, 6 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
Index: chrome/browser/ui/browser.cc
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index d4f7c015d5dbdcc1cd42f6e08fe9946c8132887e..492ac689e35c41b3e170095a62dc5585fea355ca 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"
@@ -927,7 +928,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;
@@ -937,6 +939,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->set_pending_protocol_handler(handler);
+ content_settings->set_previous_protocol_handler(
+ 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.
+ if (window) {
+ content_settings->ClearPendingProtocolHandler();
+ window->GetLocationBar()->UpdateContentSettingsIcons();
+ }
if (!registry->SilentlyHandleRegisterHandlerRequest(handler)) {
content::RecordAction(
@@ -1886,7 +1905,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(

Powered by Google App Engine
This is Rietveld 408576698