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 kPrivacyLinkHtml[]; |
| 26 } |
| 27 |
21 class SecurityInterstitialPage : public content::InterstitialPageDelegate { | 28 class SecurityInterstitialPage : public content::InterstitialPageDelegate { |
22 public: | 29 public: |
23 SecurityInterstitialPage(content::WebContents* web_contents, | 30 SecurityInterstitialPage(content::WebContents* web_contents, |
24 const GURL& url); | 31 const GURL& url); |
25 ~SecurityInterstitialPage() override; | 32 ~SecurityInterstitialPage() override; |
26 | 33 |
27 // Creates an interstitial and shows it. | 34 // Creates an interstitial and shows it. |
28 virtual void Show(); | 35 virtual void Show(); |
29 | 36 |
30 // Returns interstitial type for testing. | 37 // Returns interstitial type for testing. |
(...skipping 13 matching lines...) Expand all Loading... |
44 // InterstitialPageDelegate method: | 51 // InterstitialPageDelegate method: |
45 std::string GetHTMLContents() override; | 52 std::string GetHTMLContents() override; |
46 | 53 |
47 // Returns the formatted host name for the request url. | 54 // Returns the formatted host name for the request url. |
48 base::string16 GetFormattedHostName() const; | 55 base::string16 GetFormattedHostName() const; |
49 | 56 |
50 content::InterstitialPage* interstitial_page() const; | 57 content::InterstitialPage* interstitial_page() const; |
51 content::WebContents* web_contents() const; | 58 content::WebContents* web_contents() const; |
52 GURL request_url() const; | 59 GURL request_url() const; |
53 | 60 |
| 61 // Record the user's preference for reporting information about |
| 62 // malware and SSL errors. |
| 63 void SetReportingPreference(bool report); |
| 64 |
| 65 // Fills the passed dictionary with the values to be passed to the template |
| 66 // when creating the HTML. |
| 67 virtual void PopulateExtendedReportingOption( |
| 68 base::DictionaryValue* load_time_data) = 0; |
| 69 |
| 70 // Returns the boolean value of the given |pref| from the PrefService of the |
| 71 // Profile associated with |web_contents_|. |
| 72 bool IsPrefEnabled(const char* pref); |
| 73 |
54 private: | 74 private: |
55 content::WebContents* web_contents_; | 75 content::WebContents* web_contents_; |
56 const GURL request_url_; | 76 const GURL request_url_; |
57 // Once shown, |interstitial_page| takes ownership of this | 77 // Once shown, |interstitial_page| takes ownership of this |
58 // SecurityInterstitialPage instance. | 78 // SecurityInterstitialPage instance. |
59 content::InterstitialPage* interstitial_page_; | 79 content::InterstitialPage* interstitial_page_; |
60 // Whether the interstitial should create a view. | 80 // Whether the interstitial should create a view. |
61 bool create_view_; | 81 bool create_view_; |
62 | 82 |
63 DISALLOW_COPY_AND_ASSIGN(SecurityInterstitialPage); | 83 DISALLOW_COPY_AND_ASSIGN(SecurityInterstitialPage); |
64 }; | 84 }; |
65 | 85 |
66 #endif // CHROME_BROWSER_INTERSTITIALS_SECURITY_INTERSTITIAL_PAGE_H_ | 86 #endif // CHROME_BROWSER_INTERSTITIALS_SECURITY_INTERSTITIAL_PAGE_H_ |
OLD | NEW |