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

Side by Side Diff: chrome/browser/interstitials/security_interstitial_page.h

Issue 1467063002: Introduce the ChromeControllerClient class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 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 "components/security_interstitials/core/controller_client.h"
10 #include "content/public/browser/interstitial_page_delegate.h" 9 #include "content/public/browser/interstitial_page_delegate.h"
11 #include "url/gurl.h" 10 #include "url/gurl.h"
12 11
13 namespace base { 12 namespace base {
14 class DictionaryValue; 13 class DictionaryValue;
15 } 14 }
16 15
17 namespace content { 16 namespace content {
18 class InterstitialPage; 17 class InterstitialPage;
19 class WebContents; 18 class WebContents;
20 } 19 }
21 20
22 namespace interstitials { 21 namespace security_interstitials {
23 // Constants used to communicate with the JavaScript. 22 class MetricsHelper;
24 extern const char kBoxChecked[];
25 extern const char kDisplayCheckBox[];
26 extern const char kOptInLink[];
27 extern const char kPrivacyLinkHtml[];
28 } 23 }
29 24
30 class SecurityInterstitialPage 25 class ChromeControllerClient;
31 : public content::InterstitialPageDelegate, 26
32 public security_interstitials::ControllerClient { 27 class SecurityInterstitialPage : public content::InterstitialPageDelegate {
33 public: 28 public:
34 SecurityInterstitialPage(content::WebContents* web_contents, 29 SecurityInterstitialPage(content::WebContents* web_contents,
35 const GURL& url); 30 const GURL& url);
36 ~SecurityInterstitialPage() override; 31 ~SecurityInterstitialPage() override;
37 32
38 // Creates an interstitial and shows it. 33 // Creates an interstitial and shows it.
39 virtual void Show(); 34 virtual void Show();
40 35
41 // Prevents creating the actual interstitial view for testing. 36 // Prevents creating the actual interstitial view for testing.
42 void DontCreateViewForTesting(); 37 void DontCreateViewForTesting();
(...skipping 13 matching lines...) Expand all
56 base::string16 GetFormattedHostName() const; 51 base::string16 GetFormattedHostName() const;
57 52
58 content::InterstitialPage* interstitial_page() const; 53 content::InterstitialPage* interstitial_page() const;
59 content::WebContents* web_contents() const; 54 content::WebContents* web_contents() const;
60 GURL request_url() const; 55 GURL request_url() const;
61 56
62 // Returns the boolean value of the given |pref| from the PrefService of the 57 // Returns the boolean value of the given |pref| from the PrefService of the
63 // Profile associated with |web_contents_|. 58 // Profile associated with |web_contents_|.
64 bool IsPrefEnabled(const char* pref); 59 bool IsPrefEnabled(const char* pref);
65 60
66 protected: 61 // Temporary methods, used to pass along calls to the |controller_| for
67 // security_interstitials::ControllerClient overrides 62 // subclasses that don't yet have their own ChromeControllerClients.
estark 2015/11/23 16:25:23 maybe make this a TODO with the bug number?
felt 2015/11/24 00:18:11 Done.
68 void OpenUrlInCurrentTab(const GURL& url) override; 63 void SetReportingPreference(bool report);
69 const std::string& GetApplicationLocale() override; 64 void OpenExtendedReportingPrivacyPolicy();
70 PrefService* GetPrefService() override; 65 security_interstitials::MetricsHelper* metrics_helper();
71 const std::string GetExtendedReportingPrefName() override; 66 void set_metrics_helper(
67 scoped_ptr<security_interstitials::MetricsHelper> metrics_helper);
72 68
73 private: 69 private:
74 // The WebContents with which this interstitial page is 70 // The WebContents with which this interstitial page is
75 // associated. Not available in ~SecurityInterstitialPage, since it 71 // associated. Not available in ~SecurityInterstitialPage, since it
76 // can be destroyed before this class is destroyed. 72 // can be destroyed before this class is destroyed.
77 content::WebContents* web_contents_; 73 content::WebContents* web_contents_;
78 const GURL request_url_; 74 const GURL request_url_;
79 // Once shown, |interstitial_page| takes ownership of this 75 // Once shown, |interstitial_page| takes ownership of this
80 // SecurityInterstitialPage instance. 76 // SecurityInterstitialPage instance.
81 content::InterstitialPage* interstitial_page_; 77 content::InterstitialPage* interstitial_page_;
82 // Whether the interstitial should create a view. 78 // Whether the interstitial should create a view.
83 bool create_view_; 79 bool create_view_;
80 // For subclasses that don't have their own ChromeControllerClients yet.
81 scoped_ptr<ChromeControllerClient> controller_;
84 82
85 DISALLOW_COPY_AND_ASSIGN(SecurityInterstitialPage); 83 DISALLOW_COPY_AND_ASSIGN(SecurityInterstitialPage);
86 }; 84 };
87 85
88 #endif // CHROME_BROWSER_INTERSTITIALS_SECURITY_INTERSTITIAL_PAGE_H_ 86 #endif // CHROME_BROWSER_INTERSTITIALS_SECURITY_INTERSTITIAL_PAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698