1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_CUSTOM_HANDLERS_REGISTER_PROTOCOL_HANDLER_INFOBAR_DELEGATE_H_
6 #define CHROME_BROWSER_CUSTOM_HANDLERS_REGISTER_PROTOCOL_HANDLER_INFOBAR_DELEGATE_H_
8 #include "base/strings/string16.h"
9 #include "chrome/common/custom_handlers/protocol_handler.h"
10 #include "components/infobars/core/confirm_infobar_delegate.h"
13 class ProtocolHandlerRegistry
;
15 // An InfoBar delegate that enables the user to allow or deny storing credit
16 // card information gathered from a form submission.
17 class RegisterProtocolHandlerInfoBarDelegate
: public ConfirmInfoBarDelegate
{
19 // Creates a new register protocol handler infobar and delegate. Searches
20 // |infobar_service| for an existing infobar for the same |handler|; replaces
21 // it with the new infobar if found, otherwise adds the new infobar to
23 static void Create(InfoBarService
* infobar_service
,
24 ProtocolHandlerRegistry
* registry
,
25 const ProtocolHandler
& handler
);
28 RegisterProtocolHandlerInfoBarDelegate(ProtocolHandlerRegistry
* registry
,
29 const ProtocolHandler
& handler
);
30 ~RegisterProtocolHandlerInfoBarDelegate() override
;
32 // ConfirmInfoBarDelegate:
33 Type
GetInfoBarType() const override
;
34 InfoBarAutomationType
GetInfoBarAutomationType() const override
;
35 RegisterProtocolHandlerInfoBarDelegate
*
36 AsRegisterProtocolHandlerInfoBarDelegate() override
;
37 base::string16
GetMessageText() const override
;
38 base::string16
GetButtonLabel(InfoBarButton button
) const override
;
39 bool OKButtonTriggersUACPrompt() const override
;
40 bool Accept() override
;
41 bool Cancel() override
;
42 base::string16
GetLinkText() const override
;
43 bool LinkClicked(WindowOpenDisposition disposition
) override
;
45 // Returns a user-friendly name for the protocol of this protocol handler.
46 base::string16
GetProtocolName(const ProtocolHandler
& handler
) const;
48 ProtocolHandlerRegistry
* registry_
;
49 ProtocolHandler handler_
;
51 DISALLOW_COPY_AND_ASSIGN(RegisterProtocolHandlerInfoBarDelegate
);
54 #endif // CHROME_BROWSER_CUSTOM_HANDLERS_REGISTER_PROTOCOL_HANDLER_INFOBAR_DELEGATE_H_