Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Side by Side Diff: components/security_interstitials/content/security_interstitial_page.h

Issue 2603433002: Move SecurityInterstitialPage into component (Closed)
Patch Set: missed some changes in rebase Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 COMPONENTS_SECURITY_INTERSTITIALS_CONTENT_SECURITY_INTERSTITIAL_PAGE_H_
6 #define CHROME_BROWSER_INTERSTITIALS_SECURITY_INTERSTITIAL_PAGE_H_ 6 #define COMPONENTS_SECURITY_INTERSTITIALS_CONTENT_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 class SecurityInterstitialControllerClient;
27
28 class ChromeControllerClient;
29 class Profile;
30 27
31 class SecurityInterstitialPage : public content::InterstitialPageDelegate { 28 class SecurityInterstitialPage : public content::InterstitialPageDelegate {
32 public: 29 public:
33 SecurityInterstitialPage( 30 SecurityInterstitialPage(
34 content::WebContents* web_contents, 31 content::WebContents* web_contents,
35 const GURL& url, 32 const GURL& url,
36 std::unique_ptr<security_interstitials::MetricsHelper> metrics_helper); 33 std::unique_ptr<SecurityInterstitialControllerClient> controller);
37 ~SecurityInterstitialPage() override; 34 ~SecurityInterstitialPage() override;
38 35
39 // Creates an interstitial and shows it. 36 // Creates an interstitial and shows it.
40 virtual void Show(); 37 virtual void Show();
41 38
42 // Prevents creating the actual interstitial view for testing. 39 // Prevents creating the actual interstitial view for testing.
43 void DontCreateViewForTesting(); 40 void DontCreateViewForTesting();
44 41
45 protected: 42 protected:
46 // Returns true if the interstitial should create a new navigation entry. 43 // Returns true if the interstitial should create a new navigation entry.
(...skipping 10 matching lines...) Expand all
57 // InterstitialPageDelegate method: 54 // InterstitialPageDelegate method:
58 std::string GetHTMLContents() override; 55 std::string GetHTMLContents() override;
59 56
60 // Returns the formatted host name for the request url. 57 // Returns the formatted host name for the request url.
61 base::string16 GetFormattedHostName() const; 58 base::string16 GetFormattedHostName() const;
62 59
63 content::InterstitialPage* interstitial_page() const; 60 content::InterstitialPage* interstitial_page() const;
64 content::WebContents* web_contents() const; 61 content::WebContents* web_contents() const;
65 GURL request_url() const; 62 GURL request_url() const;
66 63
67 // Returns a pointer to the Profile associated with |web_contents_|. 64 // Returns the boolean value of the given |pref|.
68 Profile* profile();
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); 65 bool IsPrefEnabled(const char* pref);
73 66
74 ChromeControllerClient* controller(); 67 SecurityInterstitialControllerClient* controller();
75 68
76 security_interstitials::MetricsHelper* metrics_helper(); 69 MetricsHelper* metrics_helper();
77 70
78 private: 71 private:
79 // The WebContents with which this interstitial page is 72 // The WebContents with which this interstitial page is
80 // associated. Not available in ~SecurityInterstitialPage, since it 73 // associated. Not available in ~SecurityInterstitialPage, since it
81 // can be destroyed before this class is destroyed. 74 // can be destroyed before this class is destroyed.
82 content::WebContents* web_contents_; 75 content::WebContents* web_contents_;
83 const GURL request_url_; 76 const GURL request_url_;
84 // Once shown, |interstitial_page| takes ownership of this 77 // Once shown, |interstitial_page| takes ownership of this
85 // SecurityInterstitialPage instance. 78 // SecurityInterstitialPage instance.
86 content::InterstitialPage* interstitial_page_; 79 content::InterstitialPage* interstitial_page_;
87 // Whether the interstitial should create a view. 80 // Whether the interstitial should create a view.
88 bool create_view_; 81 bool create_view_;
89 // For subclasses that don't have their own ChromeControllerClients yet. 82 // For subclasses that don't have their own ControllerClients yet.
90 std::unique_ptr<ChromeControllerClient> controller_; 83 std::unique_ptr<SecurityInterstitialControllerClient> controller_;
91 84
92 std::unique_ptr<security_interstitials::MetricsHelper> metrics_helper_; 85 std::unique_ptr<MetricsHelper> metrics_helper_;
93 86
94 DISALLOW_COPY_AND_ASSIGN(SecurityInterstitialPage); 87 DISALLOW_COPY_AND_ASSIGN(SecurityInterstitialPage);
95 }; 88 };
96 89
97 #endif // CHROME_BROWSER_INTERSTITIALS_SECURITY_INTERSTITIAL_PAGE_H_ 90 } // security_interstitials
91
92 #endif // COMPONENTS_SECURITY_INTERSTITIALS_CONTENT_SECURITY_INTERSTITIAL_PAGE_ H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698