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 <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
12 #include "content/public/browser/interstitial_page_delegate.h" | 12 #include "content/public/browser/interstitial_page_delegate.h" |
13 #include "url/gurl.h" | 13 #include "url/gurl.h" |
14 | 14 |
15 namespace base { | 15 namespace base { |
16 class DictionaryValue; | 16 class DictionaryValue; |
17 } | 17 } |
18 | 18 |
19 namespace content { | 19 namespace content { |
20 class InterstitialPage; | 20 class InterstitialPage; |
21 class WebContents; | 21 class WebContents; |
22 } | 22 } |
23 | 23 |
24 namespace security_interstitials { | 24 namespace security_interstitials { |
25 class MetricsHelper; | 25 class MetricsHelper; |
26 } | 26 } |
27 | 27 |
28 class ChromeControllerClient; | 28 class ChromeControllerClient; |
| 29 class Profile; |
29 | 30 |
30 class SecurityInterstitialPage : public content::InterstitialPageDelegate { | 31 class SecurityInterstitialPage : public content::InterstitialPageDelegate { |
31 public: | 32 public: |
32 SecurityInterstitialPage( | 33 SecurityInterstitialPage( |
33 content::WebContents* web_contents, | 34 content::WebContents* web_contents, |
34 const GURL& url, | 35 const GURL& url, |
35 std::unique_ptr<security_interstitials::MetricsHelper> metrics_helper); | 36 std::unique_ptr<security_interstitials::MetricsHelper> metrics_helper); |
36 ~SecurityInterstitialPage() override; | 37 ~SecurityInterstitialPage() override; |
37 | 38 |
38 // Creates an interstitial and shows it. | 39 // Creates an interstitial and shows it. |
(...skipping 17 matching lines...) Expand all Loading... |
56 // InterstitialPageDelegate method: | 57 // InterstitialPageDelegate method: |
57 std::string GetHTMLContents() override; | 58 std::string GetHTMLContents() override; |
58 | 59 |
59 // Returns the formatted host name for the request url. | 60 // Returns the formatted host name for the request url. |
60 base::string16 GetFormattedHostName() const; | 61 base::string16 GetFormattedHostName() const; |
61 | 62 |
62 content::InterstitialPage* interstitial_page() const; | 63 content::InterstitialPage* interstitial_page() const; |
63 content::WebContents* web_contents() const; | 64 content::WebContents* web_contents() const; |
64 GURL request_url() const; | 65 GURL request_url() const; |
65 | 66 |
| 67 // Returns a pointer to the Profile associated with |web_contents_|. |
| 68 Profile* profile(); |
| 69 |
66 // Returns the boolean value of the given |pref| from the PrefService of the | 70 // Returns the boolean value of the given |pref| from the PrefService of the |
67 // Profile associated with |web_contents_|. | 71 // Profile associated with |web_contents_|. |
68 bool IsPrefEnabled(const char* pref); | 72 bool IsPrefEnabled(const char* pref); |
69 | 73 |
70 ChromeControllerClient* controller(); | 74 ChromeControllerClient* controller(); |
71 | 75 |
72 security_interstitials::MetricsHelper* metrics_helper(); | 76 security_interstitials::MetricsHelper* metrics_helper(); |
73 | 77 |
74 private: | 78 private: |
75 // The WebContents with which this interstitial page is | 79 // The WebContents with which this interstitial page is |
76 // associated. Not available in ~SecurityInterstitialPage, since it | 80 // associated. Not available in ~SecurityInterstitialPage, since it |
77 // can be destroyed before this class is destroyed. | 81 // can be destroyed before this class is destroyed. |
78 content::WebContents* web_contents_; | 82 content::WebContents* web_contents_; |
79 const GURL request_url_; | 83 const GURL request_url_; |
80 // Once shown, |interstitial_page| takes ownership of this | 84 // Once shown, |interstitial_page| takes ownership of this |
81 // SecurityInterstitialPage instance. | 85 // SecurityInterstitialPage instance. |
82 content::InterstitialPage* interstitial_page_; | 86 content::InterstitialPage* interstitial_page_; |
83 // Whether the interstitial should create a view. | 87 // Whether the interstitial should create a view. |
84 bool create_view_; | 88 bool create_view_; |
85 // For subclasses that don't have their own ChromeControllerClients yet. | 89 // For subclasses that don't have their own ChromeControllerClients yet. |
86 std::unique_ptr<ChromeControllerClient> controller_; | 90 std::unique_ptr<ChromeControllerClient> controller_; |
87 | 91 |
88 std::unique_ptr<security_interstitials::MetricsHelper> metrics_helper_; | 92 std::unique_ptr<security_interstitials::MetricsHelper> metrics_helper_; |
89 | 93 |
90 DISALLOW_COPY_AND_ASSIGN(SecurityInterstitialPage); | 94 DISALLOW_COPY_AND_ASSIGN(SecurityInterstitialPage); |
91 }; | 95 }; |
92 | 96 |
93 #endif // CHROME_BROWSER_INTERSTITIALS_SECURITY_INTERSTITIAL_PAGE_H_ | 97 #endif // CHROME_BROWSER_INTERSTITIALS_SECURITY_INTERSTITIAL_PAGE_H_ |
OLD | NEW |