| 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" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 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 | 29 |
| 30 class SecurityInterstitialPage : public content::InterstitialPageDelegate { | 30 class SecurityInterstitialPage : public content::InterstitialPageDelegate { |
| 31 public: | 31 public: |
| 32 SecurityInterstitialPage(content::WebContents* web_contents, | 32 SecurityInterstitialPage( |
| 33 const GURL& url); | 33 content::WebContents* web_contents, |
| 34 const GURL& url, |
| 35 std::unique_ptr<security_interstitials::MetricsHelper> metrics_helper); |
| 34 ~SecurityInterstitialPage() override; | 36 ~SecurityInterstitialPage() override; |
| 35 | 37 |
| 36 // Creates an interstitial and shows it. | 38 // Creates an interstitial and shows it. |
| 37 virtual void Show(); | 39 virtual void Show(); |
| 38 | 40 |
| 39 // Prevents creating the actual interstitial view for testing. | 41 // Prevents creating the actual interstitial view for testing. |
| 40 void DontCreateViewForTesting(); | 42 void DontCreateViewForTesting(); |
| 41 | 43 |
| 42 protected: | 44 protected: |
| 43 // Returns true if the interstitial should create a new navigation entry. | 45 // Returns true if the interstitial should create a new navigation entry. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 58 base::string16 GetFormattedHostName() const; | 60 base::string16 GetFormattedHostName() const; |
| 59 | 61 |
| 60 content::InterstitialPage* interstitial_page() const; | 62 content::InterstitialPage* interstitial_page() const; |
| 61 content::WebContents* web_contents() const; | 63 content::WebContents* web_contents() const; |
| 62 GURL request_url() const; | 64 GURL request_url() const; |
| 63 | 65 |
| 64 // Returns the boolean value of the given |pref| from the PrefService of the | 66 // Returns the boolean value of the given |pref| from the PrefService of the |
| 65 // Profile associated with |web_contents_|. | 67 // Profile associated with |web_contents_|. |
| 66 bool IsPrefEnabled(const char* pref); | 68 bool IsPrefEnabled(const char* pref); |
| 67 | 69 |
| 68 // TODO(felt): Remove these. They are temporary methods, used to pass along | 70 ChromeControllerClient* controller(); |
| 69 // calls to the |controller_| for subclasses that don't yet have their own | 71 |
| 70 // ChromeControllerClients. crbug.com/488673 | |
| 71 security_interstitials::MetricsHelper* metrics_helper(); | 72 security_interstitials::MetricsHelper* metrics_helper(); |
| 72 void set_metrics_helper( | |
| 73 std::unique_ptr<security_interstitials::MetricsHelper> metrics_helper); | |
| 74 | |
| 75 ChromeControllerClient* controller(); | |
| 76 | 73 |
| 77 private: | 74 private: |
| 78 // The WebContents with which this interstitial page is | 75 // The WebContents with which this interstitial page is |
| 79 // associated. Not available in ~SecurityInterstitialPage, since it | 76 // associated. Not available in ~SecurityInterstitialPage, since it |
| 80 // can be destroyed before this class is destroyed. | 77 // can be destroyed before this class is destroyed. |
| 81 content::WebContents* web_contents_; | 78 content::WebContents* web_contents_; |
| 82 const GURL request_url_; | 79 const GURL request_url_; |
| 83 // Once shown, |interstitial_page| takes ownership of this | 80 // Once shown, |interstitial_page| takes ownership of this |
| 84 // SecurityInterstitialPage instance. | 81 // SecurityInterstitialPage instance. |
| 85 content::InterstitialPage* interstitial_page_; | 82 content::InterstitialPage* interstitial_page_; |
| 86 // Whether the interstitial should create a view. | 83 // Whether the interstitial should create a view. |
| 87 bool create_view_; | 84 bool create_view_; |
| 88 // For subclasses that don't have their own ChromeControllerClients yet. | 85 // For subclasses that don't have their own ChromeControllerClients yet. |
| 89 std::unique_ptr<ChromeControllerClient> controller_; | 86 std::unique_ptr<ChromeControllerClient> controller_; |
| 90 | 87 |
| 88 std::unique_ptr<security_interstitials::MetricsHelper> metrics_helper_; |
| 89 |
| 91 DISALLOW_COPY_AND_ASSIGN(SecurityInterstitialPage); | 90 DISALLOW_COPY_AND_ASSIGN(SecurityInterstitialPage); |
| 92 }; | 91 }; |
| 93 | 92 |
| 94 #endif // CHROME_BROWSER_INTERSTITIALS_SECURITY_INTERSTITIAL_PAGE_H_ | 93 #endif // CHROME_BROWSER_INTERSTITIALS_SECURITY_INTERSTITIAL_PAGE_H_ |
| OLD | NEW |