15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved. 25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file. 45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef CHROME_BROWSER_CUSTOM_HANDLERS_REGISTER_PROTOCOL_HANDLER_INFOBAR_DELEGATE_H_ 65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define CHROME_BROWSER_CUSTOM_HANDLERS_REGISTER_PROTOCOL_HANDLER_INFOBAR_DELEGATE_H_ 75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 8868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "base/strings/string16.h" 95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "chrome/common/custom_handlers/protocol_handler.h" 10cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#include "components/infobars/core/confirm_infobar_delegate.h" 115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class InfoBarService; 135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class ProtocolHandlerRegistry; 145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// An InfoBar delegate that enables the user to allow or deny storing credit 165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// card information gathered from a form submission. 175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class RegisterProtocolHandlerInfoBarDelegate : public ConfirmInfoBarDelegate { 185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public: 19a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) // Creates a new register protocol handler infobar and delegate. Searches 20a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) // |infobar_service| for an existing infobar for the same |handler|; replaces 21a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) // it with the new infobar if found, otherwise adds the new infobar to 22ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch // |infobar_service|. 232a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) static void Create(InfoBarService* infobar_service, 242a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) ProtocolHandlerRegistry* registry, 252a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const ProtocolHandler& handler); 265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 27c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) private: 28a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) RegisterProtocolHandlerInfoBarDelegate(ProtocolHandlerRegistry* registry, 29c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) const ProtocolHandler& handler); 307dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch virtual ~RegisterProtocolHandlerInfoBarDelegate(); 31c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) 325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // ConfirmInfoBarDelegate: 33c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) virtual InfoBarAutomationType GetInfoBarAutomationType() const OVERRIDE; 345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual Type GetInfoBarType() const OVERRIDE; 35c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) virtual RegisterProtocolHandlerInfoBarDelegate* 36c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) AsRegisterProtocolHandlerInfoBarDelegate() OVERRIDE; 37a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) virtual base::string16 GetMessageText() const OVERRIDE; 38a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) virtual base::string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; 395c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu virtual bool OKButtonTriggersUACPrompt() const OVERRIDE; 405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual bool Accept() OVERRIDE; 415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual bool Cancel() OVERRIDE; 42a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) virtual base::string16 GetLinkText() const OVERRIDE; 435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE; 445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Returns a user-friendly name for the protocol of this protocol handler. 46a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) base::string16 GetProtocolName(const ProtocolHandler& handler) const; 47c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) 485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) ProtocolHandlerRegistry* registry_; 495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) ProtocolHandler handler_; 505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) DISALLOW_COPY_AND_ASSIGN(RegisterProtocolHandlerInfoBarDelegate); 525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}; 535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif // CHROME_BROWSER_CUSTOM_HANDLERS_REGISTER_PROTOCOL_HANDLER_INFOBAR_DELEGATE_H_ 55