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