Chromium Code Reviews| 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 "components/infobars/core/confirm_infobar_delegate.h" | 8 #include "components/infobars/core/confirm_infobar_delegate.h" |
| 9 | 9 |
| 10 class InfoBarService; | 10 class InfoBarService; |
| 11 | 11 |
| 12 // 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 |
| 13 // display or run insecure content. | 13 // display or run insecure content. |
| 14 class InsecureContentInfoBarDelegate : public ConfirmInfoBarDelegate { | 14 class InsecureContentInfoBarDelegate : public ConfirmInfoBarDelegate { |
| 15 public: | 15 public: |
| 16 enum InfoBarType { | 16 // Depending on whether an insecure content infobar is already present in |
| 17 DISPLAY, // Shown when "inactive" content (e.g. images) has been blocked. | 17 // |infobar_service|, may do nothing; otherwise, creates |
|
Peter Kasting
2015/01/27 19:25:22
This comment is no longer accurate, since Create()
Robert Sesek
2015/01/27 20:33:21
Done.
| |
| 18 RUN, // Shown when "active" content (e.g. script) has been blocked. | |
| 19 }; | |
| 20 | |
| 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 | 18 // an insecure content infobar and delegate and either adds the infobar to |
| 24 // |infobar_service| or replaces the existing infobar. | 19 // |infobar_service| or replaces the existing infobar. |
| 25 static void Create(InfoBarService* infobar_service, InfoBarType type); | 20 static void Create(InfoBarService* infobar_service); |
| 26 | 21 |
| 27 private: | 22 private: |
| 28 enum HistogramEvents { | 23 enum HistogramEvents { |
| 29 DISPLAY_INFOBAR_SHOWN = 0, // Infobar was displayed. | 24 DISPLAY_INFOBAR_SHOWN = 0, // Infobar was displayed. |
| 30 DISPLAY_USER_OVERRIDE, // User clicked allow anyway button. | 25 DISPLAY_USER_OVERRIDE, // User clicked allow anyway button. |
| 31 DISPLAY_USER_DID_NOT_LOAD, // User clicked the don't load button. | 26 DISPLAY_USER_DID_NOT_LOAD, // User clicked the don't load button. |
| 32 DISPLAY_INFOBAR_DISMISSED, // User clicked close button. | 27 DISPLAY_INFOBAR_DISMISSED, // User clicked close button. |
| 33 RUN_INFOBAR_SHOWN, | |
| 34 RUN_USER_OVERRIDE, | |
| 35 RUN_USER_DID_NOT_LOAD, | |
| 36 RUN_INFOBAR_DISMISSED, | |
| 37 NUM_EVENTS | 28 NUM_EVENTS |
| 38 }; | 29 }; |
| 39 | 30 |
| 40 explicit InsecureContentInfoBarDelegate(InfoBarType type); | 31 InsecureContentInfoBarDelegate(); |
| 41 ~InsecureContentInfoBarDelegate() override; | 32 ~InsecureContentInfoBarDelegate() override; |
| 42 | 33 |
| 43 // ConfirmInfoBarDelegate: | 34 // ConfirmInfoBarDelegate: |
| 44 void InfoBarDismissed() override; | 35 void InfoBarDismissed() override; |
| 45 InsecureContentInfoBarDelegate* AsInsecureContentInfoBarDelegate() override; | 36 InsecureContentInfoBarDelegate* AsInsecureContentInfoBarDelegate() override; |
| 46 base::string16 GetMessageText() const override; | 37 base::string16 GetMessageText() const override; |
| 47 base::string16 GetButtonLabel(InfoBarButton button) const override; | 38 base::string16 GetButtonLabel(InfoBarButton button) const override; |
| 48 bool Accept() override; | 39 bool Accept() override; |
| 49 bool Cancel() override; | 40 bool Cancel() override; |
| 50 base::string16 GetLinkText() const override; | 41 base::string16 GetLinkText() const override; |
| 51 bool LinkClicked(WindowOpenDisposition disposition) override; | 42 bool LinkClicked(WindowOpenDisposition disposition) override; |
| 52 | 43 |
| 53 InfoBarType type_; | 44 DISALLOW_COPY_AND_ASSIGN(InsecureContentInfoBarDelegate); |
| 54 | |
| 55 DISALLOW_IMPLICIT_CONSTRUCTORS(InsecureContentInfoBarDelegate); | |
| 56 }; | 45 }; |
| 57 | 46 |
| 58 #endif // CHROME_BROWSER_INFOBARS_INSECURE_CONTENT_INFOBAR_DELEGATE_H_ | 47 #endif // CHROME_BROWSER_INFOBARS_INSECURE_CONTENT_INFOBAR_DELEGATE_H_ |
| 59 | 48 |
| OLD | NEW |