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 "chrome/browser/infobars/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 virtual ~InsecureContentInfoBarDelegate();
43 // ConfirmInfoBarDelegate:
44 virtual void InfoBarDismissed() OVERRIDE;
45 virtual InsecureContentInfoBarDelegate*
46 AsInsecureContentInfoBarDelegate() OVERRIDE;
47 virtual base::string16 GetMessageText() const OVERRIDE;
48 virtual base::string16 GetButtonLabel(InfoBarButton button) const OVERRIDE;
49 virtual bool Accept() OVERRIDE;
50 virtual bool Cancel() OVERRIDE;
51 virtual base::string16 GetLinkText() const OVERRIDE;
52 virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE;
56 DISALLOW_IMPLICIT_CONSTRUCTORS(InsecureContentInfoBarDelegate);
59 #endif // CHROME_BROWSER_INFOBARS_INSECURE_CONTENT_INFOBAR_DELEGATE_H_