1 // Copyright (c) 2011 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_INFOBARS_INSECURE_CONTENT_INFOBAR_DELEGATE_H_
6 #define CHROME_BROWSER_INFOBARS_INSECURE_CONTENT_INFOBAR_DELEGATE_H_
8 #include "components/infobars/core/confirm_infobar_delegate.h"
12 // Base class for delegates that show warnings on HTTPS pages which try to
13 // display or run insecure content.
14 class InsecureContentInfoBarDelegate : public ConfirmInfoBarDelegate {
17 DISPLAY, // Shown when "inactive" content (e.g. images) has been blocked.
18 RUN, // Shown when "active" content (e.g. script) has been blocked.
21 // Depending on the |type| requested and whether an insecure content infobar
22 // is already present in |infobar_service|, may do nothing; otherwise, creates
23 // an insecure content infobar and delegate and either adds the infobar to
24 // |infobar_service| or replaces the existing infobar.
25 static void Create(InfoBarService* infobar_service, InfoBarType type);
28 enum HistogramEvents {
29 DISPLAY_INFOBAR_SHOWN = 0, // Infobar was displayed.
30 DISPLAY_USER_OVERRIDE, // User clicked allow anyway button.
31 DISPLAY_USER_DID_NOT_LOAD, // User clicked the don't load button.
32 DISPLAY_INFOBAR_DISMISSED, // User clicked close button.
35 RUN_USER_DID_NOT_LOAD,
36 RUN_INFOBAR_DISMISSED,
40 explicit InsecureContentInfoBarDelegate(InfoBarType type);
41 ~InsecureContentInfoBarDelegate() override;
43 // ConfirmInfoBarDelegate:
44 void InfoBarDismissed() override;
45 InsecureContentInfoBarDelegate* AsInsecureContentInfoBarDelegate() override;
46 base::string16 GetMessageText() const override;
47 base::string16 GetButtonLabel(InfoBarButton button) const override;
48 bool Accept() override;
49 bool Cancel() override;
50 base::string16 GetLinkText() const override;
51 bool LinkClicked(WindowOpenDisposition disposition) override;
55 DISALLOW_IMPLICIT_CONSTRUCTORS(InsecureContentInfoBarDelegate);
58 #endif // CHROME_BROWSER_INFOBARS_INSECURE_CONTENT_INFOBAR_DELEGATE_H_