OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_INTERSTITIALS_SECURITY_INTERSTITIAL_PAGE_H_ | 5 #ifndef CHROME_BROWSER_INTERSTITIALS_SECURITY_INTERSTITIAL_PAGE_H_ |
6 #define CHROME_BROWSER_INTERSTITIALS_SECURITY_INTERSTITIAL_PAGE_H_ | 6 #define CHROME_BROWSER_INTERSTITIALS_SECURITY_INTERSTITIAL_PAGE_H_ |
7 | 7 |
| 8 #include "base/callback.h" |
8 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
9 #include "content/public/browser/interstitial_page_delegate.h" | 10 #include "content/public/browser/interstitial_page_delegate.h" |
10 #include "url/gurl.h" | 11 #include "url/gurl.h" |
11 | 12 |
12 namespace base { | 13 namespace base { |
13 class DictionaryValue; | 14 class DictionaryValue; |
14 } | 15 } |
15 | 16 |
16 namespace content { | 17 namespace content { |
17 class InterstitialPage; | 18 class InterstitialPage; |
18 class WebContents; | 19 class WebContents; |
19 } | 20 } |
20 | 21 |
| 22 namespace interstitials { |
| 23 // Constants used to communicate with the JavaScript. |
| 24 extern const char kBoxChecked[]; |
| 25 extern const char kDisplayCheckBox[]; |
| 26 extern const char kOptInLink[]; |
| 27 extern const char kPrivacyLinkHtml[]; |
| 28 } |
| 29 |
| 30 class SecurityInterstitialMetricsHelper; |
| 31 |
21 class SecurityInterstitialPage : public content::InterstitialPageDelegate { | 32 class SecurityInterstitialPage : public content::InterstitialPageDelegate { |
22 public: | 33 public: |
23 // These represent the commands sent from the interstitial JavaScript. | 34 // These represent the commands sent from the interstitial JavaScript. |
24 // DO NOT reorder or change these without also changing the JavaScript! | 35 // DO NOT reorder or change these without also changing the JavaScript! |
25 // See chrome/browser/resources/security_warnings/interstitial_v2.js | 36 // See chrome/browser/resources/security_warnings/interstitial_v2.js |
26 enum SecurityInterstitialCommands { | 37 enum SecurityInterstitialCommands { |
27 // Decisions | 38 // Decisions |
28 CMD_DONT_PROCEED = 0, | 39 CMD_DONT_PROCEED = 0, |
29 CMD_PROCEED = 1, | 40 CMD_PROCEED = 1, |
30 // Ways for user to get more information | 41 // Ways for user to get more information |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 // InterstitialPageDelegate method: | 73 // InterstitialPageDelegate method: |
63 std::string GetHTMLContents() override; | 74 std::string GetHTMLContents() override; |
64 | 75 |
65 // Returns the formatted host name for the request url. | 76 // Returns the formatted host name for the request url. |
66 base::string16 GetFormattedHostName() const; | 77 base::string16 GetFormattedHostName() const; |
67 | 78 |
68 content::InterstitialPage* interstitial_page() const; | 79 content::InterstitialPage* interstitial_page() const; |
69 content::WebContents* web_contents() const; | 80 content::WebContents* web_contents() const; |
70 GURL request_url() const; | 81 GURL request_url() const; |
71 | 82 |
| 83 // Record the user's preference for reporting information about |
| 84 // malware and SSL errors. |
| 85 void SetReportingPreference(bool report); |
| 86 |
| 87 // Returns the boolean value of the given |pref| from the PrefService of the |
| 88 // Profile associated with |web_contents_|. |
| 89 bool IsPrefEnabled(const char* pref); |
| 90 |
| 91 // This callback is run when an extended reporting certificate chain |
| 92 // report has been sent, or when it is decided that it should not be |
| 93 // sent (for example, when in incognito mode). |
| 94 base::Closure certificate_report_callback_for_testing_; |
| 95 |
| 96 protected: |
| 97 void OpenExtendedReportingPrivacyPolicy(); |
| 98 |
| 99 scoped_ptr<SecurityInterstitialMetricsHelper> metrics_helper_; |
| 100 |
72 private: | 101 private: |
73 content::WebContents* web_contents_; | 102 content::WebContents* web_contents_; |
74 const GURL request_url_; | 103 const GURL request_url_; |
75 // Once shown, |interstitial_page| takes ownership of this | 104 // Once shown, |interstitial_page| takes ownership of this |
76 // SecurityInterstitialPage instance. | 105 // SecurityInterstitialPage instance. |
77 content::InterstitialPage* interstitial_page_; | 106 content::InterstitialPage* interstitial_page_; |
78 // Whether the interstitial should create a view. | 107 // Whether the interstitial should create a view. |
79 bool create_view_; | 108 bool create_view_; |
80 | 109 |
81 DISALLOW_COPY_AND_ASSIGN(SecurityInterstitialPage); | 110 DISALLOW_COPY_AND_ASSIGN(SecurityInterstitialPage); |
82 }; | 111 }; |
83 | 112 |
84 #endif // CHROME_BROWSER_INTERSTITIALS_SECURITY_INTERSTITIAL_PAGE_H_ | 113 #endif // CHROME_BROWSER_INTERSTITIALS_SECURITY_INTERSTITIAL_PAGE_H_ |
OLD | NEW |