OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_INFOBARS_INSECURE_CONTENT_INFOBAR_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_INFOBARS_INSECURE_CONTENT_INFOBAR_DELEGATE_H_ |
6 #define CHROME_BROWSER_INFOBARS_INSECURE_CONTENT_INFOBAR_DELEGATE_H_ | 6 #define CHROME_BROWSER_INFOBARS_INSECURE_CONTENT_INFOBAR_DELEGATE_H_ |
7 | 7 |
8 #include "chrome/browser/infobars/confirm_infobar_delegate.h" | 8 #include "chrome/browser/infobars/content_confirm_infobar_delegate.h" |
| 9 |
| 10 class InfoBarService; |
9 | 11 |
10 // Base class for delegates that show warnings on HTTPS pages which try to | 12 // Base class for delegates that show warnings on HTTPS pages which try to |
11 // display or run insecure content. | 13 // display or run insecure content. |
12 class InsecureContentInfoBarDelegate : public ConfirmInfoBarDelegate { | 14 class InsecureContentInfoBarDelegate : public ContentConfirmInfoBarDelegate { |
13 public: | 15 public: |
14 enum InfoBarType { | 16 enum InfoBarType { |
15 DISPLAY, // Shown when "inactive" content (e.g. images) has been blocked. | 17 DISPLAY, // Shown when "inactive" content (e.g. images) has been blocked. |
16 RUN, // Shown when "active" content (e.g. script) has been blocked. | 18 RUN, // Shown when "active" content (e.g. script) has been blocked. |
17 }; | 19 }; |
18 | 20 |
19 // Depending on the |type| requested and whether an insecure content infobar | 21 // Depending on the |type| requested and whether an insecure content infobar |
20 // is already present in |infobar_service|, may do nothing; otherwise, creates | 22 // is already present in |infobar_service|, may do nothing; otherwise, creates |
21 // an insecure content infobar and delegate and either adds the infobar to | 23 // an insecure content infobar and delegate and either adds the infobar to |
22 // |infobar_service| or replaces the existing infobar. | 24 // |infobar_service| or replaces the existing infobar. |
23 static void Create(InfoBarService* infobar_service, InfoBarType type); | 25 static void Create(InfoBarService* infobar_service, InfoBarType type); |
24 | 26 |
25 private: | 27 private: |
26 enum HistogramEvents { | 28 enum HistogramEvents { |
27 DISPLAY_INFOBAR_SHOWN = 0, // Infobar was displayed. | 29 DISPLAY_INFOBAR_SHOWN = 0, // Infobar was displayed. |
28 DISPLAY_USER_OVERRIDE, // User clicked allow anyway button. | 30 DISPLAY_USER_OVERRIDE, // User clicked allow anyway button. |
29 DISPLAY_USER_DID_NOT_LOAD, // User clicked the don't load button. | 31 DISPLAY_USER_DID_NOT_LOAD, // User clicked the don't load button. |
30 DISPLAY_INFOBAR_DISMISSED, // User clicked close button. | 32 DISPLAY_INFOBAR_DISMISSED, // User clicked close button. |
31 RUN_INFOBAR_SHOWN, | 33 RUN_INFOBAR_SHOWN, |
32 RUN_USER_OVERRIDE, | 34 RUN_USER_OVERRIDE, |
33 RUN_USER_DID_NOT_LOAD, | 35 RUN_USER_DID_NOT_LOAD, |
34 RUN_INFOBAR_DISMISSED, | 36 RUN_INFOBAR_DISMISSED, |
35 NUM_EVENTS | 37 NUM_EVENTS |
36 }; | 38 }; |
37 | 39 |
38 explicit InsecureContentInfoBarDelegate(InfoBarType type); | 40 explicit InsecureContentInfoBarDelegate(content::WebContents* web_contents, |
| 41 InfoBarType type); |
39 virtual ~InsecureContentInfoBarDelegate(); | 42 virtual ~InsecureContentInfoBarDelegate(); |
40 | 43 |
41 // ConfirmInfoBarDelegate: | 44 // ConfirmInfoBarDelegate: |
42 virtual void InfoBarDismissed() OVERRIDE; | 45 virtual void InfoBarDismissed() OVERRIDE; |
43 virtual InsecureContentInfoBarDelegate* | 46 virtual InsecureContentInfoBarDelegate* |
44 AsInsecureContentInfoBarDelegate() OVERRIDE; | 47 AsInsecureContentInfoBarDelegate() OVERRIDE; |
45 virtual base::string16 GetMessageText() const OVERRIDE; | 48 virtual base::string16 GetMessageText() const OVERRIDE; |
46 virtual base::string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; | 49 virtual base::string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; |
47 virtual bool Accept() OVERRIDE; | 50 virtual bool Accept() OVERRIDE; |
48 virtual bool Cancel() OVERRIDE; | 51 virtual bool Cancel() OVERRIDE; |
49 virtual base::string16 GetLinkText() const OVERRIDE; | 52 virtual base::string16 GetLinkText() const OVERRIDE; |
50 virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE; | 53 virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE; |
51 | 54 |
52 InfoBarType type_; | 55 InfoBarType type_; |
53 | 56 |
54 DISALLOW_IMPLICIT_CONSTRUCTORS(InsecureContentInfoBarDelegate); | 57 DISALLOW_IMPLICIT_CONSTRUCTORS(InsecureContentInfoBarDelegate); |
55 }; | 58 }; |
56 | 59 |
57 #endif // CHROME_BROWSER_INFOBARS_INSECURE_CONTENT_INFOBAR_DELEGATE_H_ | 60 #endif // CHROME_BROWSER_INFOBARS_INSECURE_CONTENT_INFOBAR_DELEGATE_H_ |
58 | 61 |
OLD | NEW |