From e24be072268be5ca69f68b9fffdc872e3444c320 Mon Sep 17 00:00:00 2001 From: "koz@chromium.org" Date: Fri, 22 Jul 2011 15:45:31 +0000 Subject: Makes it so that when a user clicks "No" in the infobar that asks if they want to register a protocol handler, it adds the protocol to the ignored list for that user, which means it won't show up in their right-click menu for links with that protocol, and appears in an ignored list in the settings at chrome://settings/handlers TEST=Manual testing Review URL: http://codereview.chromium.org/7358012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@93636 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/custom_handlers/protocol_handler_registry.cc | 6 ++++++ chrome/browser/custom_handlers/protocol_handler_registry.h | 3 +++ .../custom_handlers/register_protocol_handler_infobar_delegate.cc | 4 ++-- 3 files changed, 11 insertions(+), 2 deletions(-) (limited to 'chrome/browser/custom_handlers') diff --git a/chrome/browser/custom_handlers/protocol_handler_registry.cc b/chrome/browser/custom_handlers/protocol_handler_registry.cc index 0418a4fa..745e2af 100644 --- a/chrome/browser/custom_handlers/protocol_handler_registry.cc +++ b/chrome/browser/custom_handlers/protocol_handler_registry.cc @@ -74,6 +74,11 @@ ProtocolHandlerRegistry::GetHandlersFor( return p->second; } +ProtocolHandlerRegistry::ProtocolHandlerList +ProtocolHandlerRegistry::GetIgnoredHandlers() { + return ignored_protocol_handlers_; +} + void ProtocolHandlerRegistry::RegisterProtocolHandler( const ProtocolHandler& handler) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -416,6 +421,7 @@ void ProtocolHandlerRegistry::OnIgnoreRegisterProtocolHandler( DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); IgnoreProtocolHandler(handler); Save(); + NotifyChanged(); } // static diff --git a/chrome/browser/custom_handlers/protocol_handler_registry.h b/chrome/browser/custom_handlers/protocol_handler_registry.h index 776078d..445751d 100644 --- a/chrome/browser/custom_handlers/protocol_handler_registry.h +++ b/chrome/browser/custom_handlers/protocol_handler_registry.h @@ -112,6 +112,9 @@ class ProtocolHandlerRegistry // Get the list of protocol handlers for the given scheme. ProtocolHandlerList GetHandlersFor(const std::string& scheme) const; + // Get the list of ignored protocol handlers. + ProtocolHandlerList GetIgnoredHandlers(); + // Yields a list of the protocols that have handlers registered in this // registry. void GetRegisteredProtocols(std::vector* output) const; diff --git a/chrome/browser/custom_handlers/register_protocol_handler_infobar_delegate.cc b/chrome/browser/custom_handlers/register_protocol_handler_infobar_delegate.cc index d78e159..d614e43 100644 --- a/chrome/browser/custom_handlers/register_protocol_handler_infobar_delegate.cc +++ b/chrome/browser/custom_handlers/register_protocol_handler_infobar_delegate.cc @@ -30,7 +30,7 @@ bool RegisterProtocolHandlerInfoBarDelegate::ShouldExpire( } InfoBarDelegate::Type - RegisterProtocolHandlerInfoBarDelegate::GetInfoBarType() const { +RegisterProtocolHandlerInfoBarDelegate::GetInfoBarType() const { return PAGE_ACTION_TYPE; } @@ -68,7 +68,7 @@ bool RegisterProtocolHandlerInfoBarDelegate::Accept() { } bool RegisterProtocolHandlerInfoBarDelegate::Cancel() { - registry_->OnDenyRegisterProtocolHandler(handler_); + registry_->OnIgnoreRegisterProtocolHandler(handler_); return true; } -- cgit v1.1