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

Side by Side Diff: chrome/browser/ssl/ssl_blocking_page.h

Issue 2303413002: Simplify security_interstitials::ControllerClient and other related classes (Closed)
Patch Set: Rebase 2 Created 4 years, 2 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_SSL_SSL_BLOCKING_PAGE_H_ 5 #ifndef CHROME_BROWSER_SSL_SSL_BLOCKING_PAGE_H_
6 #define CHROME_BROWSER_SSL_SSL_BLOCKING_PAGE_H_ 6 #define CHROME_BROWSER_SSL_SSL_BLOCKING_PAGE_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 19 matching lines...) Expand all
30 namespace policy { 30 namespace policy {
31 class PolicyTest_SSLErrorOverridingDisallowed_Test; 31 class PolicyTest_SSLErrorOverridingDisallowed_Test;
32 } 32 }
33 33
34 namespace security_interstitials { 34 namespace security_interstitials {
35 class SSLErrorUI; 35 class SSLErrorUI;
36 } 36 }
37 37
38 class CertReportHelper; 38 class CertReportHelper;
39 class SSLUITest; 39 class SSLUITest;
40 class ChromeMetricsHelper;
40 41
41 // This class is responsible for showing/hiding the interstitial page that is 42 // This class is responsible for showing/hiding the interstitial page that is
42 // shown when a certificate error happens. 43 // shown when a certificate error happens.
43 // It deletes itself when the interstitial page is closed. 44 // It deletes itself when the interstitial page is closed.
44 class SSLBlockingPage : public SecurityInterstitialPage { 45 class SSLBlockingPage : public SecurityInterstitialPage {
45 public: 46 public:
46 // Interstitial type, used in tests. 47 // Interstitial type, used in tests.
47 static InterstitialPageDelegate::TypeID kTypeForTesting; 48 static InterstitialPageDelegate::TypeID kTypeForTesting;
48 49
49 ~SSLBlockingPage() override; 50 ~SSLBlockingPage() override;
50 51
51 // Creates an SSL blocking page. If the blocking page isn't shown, the caller 52 // Creates an SSL blocking page. If the blocking page isn't shown, the caller
52 // is responsible for cleaning up the blocking page, otherwise the 53 // is responsible for cleaning up the blocking page, otherwise the
53 // interstitial takes ownership when shown. |options_mask| must be a bitwise 54 // interstitial takes ownership when shown. |options_mask| must be a bitwise
54 // mask of SSLErrorUI::SSLErrorOptionsMask values. 55 // mask of SSLErrorUI::SSLErrorOptionsMask values.
55 SSLBlockingPage(content::WebContents* web_contents, 56 // This is static because the constructor uses expensive to compute parameters
56 int cert_error, 57 // more than once (e.g. overrideable).
57 const net::SSLInfo& ssl_info, 58 static SSLBlockingPage* Create(
58 const GURL& request_url, 59 content::WebContents* web_contents,
59 int options_mask, 60 int cert_error,
60 const base::Time& time_triggered, 61 const net::SSLInfo& ssl_info,
61 std::unique_ptr<SSLCertReporter> ssl_cert_reporter, 62 const GURL& request_url,
62 const base::Callback< 63 int options_mask,
63 void(content::CertificateRequestResultType)>& callback); 64 const base::Time& time_triggered,
65 std::unique_ptr<SSLCertReporter> ssl_cert_reporter,
66 const base::Callback<void(content::CertificateRequestResultType)>&
67 callback);
64 68
65 // InterstitialPageDelegate method: 69 // InterstitialPageDelegate method:
66 InterstitialPageDelegate::TypeID GetTypeForTesting() const override; 70 InterstitialPageDelegate::TypeID GetTypeForTesting() const override;
67 71
68 // Returns true if |options_mask| refers to a soft-overridable SSL error and 72 // Returns true if |options_mask| refers to a soft-overridable SSL error and
69 // if SSL error overriding is allowed by policy. 73 // if SSL error overriding is allowed by policy.
70 static bool IsOverridable(int options_mask, const Profile* const profile); 74 static bool IsOverridable(int options_mask, const Profile* const profile);
71 75
72 void SetSSLCertReporterForTesting( 76 void SetSSLCertReporterForTesting(
73 std::unique_ptr<SSLCertReporter> ssl_cert_reporter); 77 std::unique_ptr<SSLCertReporter> ssl_cert_reporter);
74 78
75 protected: 79 protected:
76 friend class policy::PolicyTest_SSLErrorOverridingDisallowed_Test; 80 friend class policy::PolicyTest_SSLErrorOverridingDisallowed_Test;
77 friend class SSLUITest; 81 friend class SSLUITest;
78 82
79 // InterstitialPageDelegate implementation. 83 // InterstitialPageDelegate implementation.
80 void CommandReceived(const std::string& command) override; 84 void CommandReceived(const std::string& command) override;
81 void OverrideEntry(content::NavigationEntry* entry) override; 85 void OverrideEntry(content::NavigationEntry* entry) override;
82 void OverrideRendererPrefs(content::RendererPreferences* prefs) override; 86 void OverrideRendererPrefs(content::RendererPreferences* prefs) override;
83 void OnProceed() override; 87 void OnProceed() override;
84 void OnDontProceed() override; 88 void OnDontProceed() override;
85 89
86 // SecurityInterstitialPage implementation: 90 // SecurityInterstitialPage implementation:
87 bool ShouldCreateNewNavigation() const override; 91 bool ShouldCreateNewNavigation() const override;
88 void PopulateInterstitialStrings( 92 void PopulateInterstitialStrings(
89 base::DictionaryValue* load_time_data) override; 93 base::DictionaryValue* load_time_data) override;
90 94
91 private: 95 private:
96 SSLBlockingPage(content::WebContents* web_contents,
97 int cert_error,
98 const net::SSLInfo& ssl_info,
99 const GURL& request_url,
100 int options_mask,
101 const base::Time& time_triggered,
102 std::unique_ptr<SSLCertReporter> ssl_cert_reporter,
103 bool overrideable,
104 std::unique_ptr<ChromeMetricsHelper> metrics_helper,
105 const base::Callback<
106 void(content::CertificateRequestResultType)>& callback);
107
92 void NotifyDenyCertificate(); 108 void NotifyDenyCertificate();
93 109
94 base::Callback<void(content::CertificateRequestResultType)> callback_; 110 base::Callback<void(content::CertificateRequestResultType)> callback_;
95 const net::SSLInfo ssl_info_; 111 const net::SSLInfo ssl_info_;
96 const bool overridable_; // The UI allows the user to override the error. 112 const bool overridable_; // The UI allows the user to override the error.
97 113
98 // The user previously allowed a bad certificate, but the decision has now 114 // The user previously allowed a bad certificate, but the decision has now
99 // expired. 115 // expired.
100 const bool expired_but_previously_allowed_; 116 const bool expired_but_previously_allowed_;
101 117
102 std::unique_ptr<security_interstitials::SSLErrorUI> ssl_error_ui_; 118 std::unique_ptr<security_interstitials::SSLErrorUI> ssl_error_ui_;
103 std::unique_ptr<CertReportHelper> cert_report_helper_; 119 std::unique_ptr<CertReportHelper> cert_report_helper_;
104 120
105 DISALLOW_COPY_AND_ASSIGN(SSLBlockingPage); 121 DISALLOW_COPY_AND_ASSIGN(SSLBlockingPage);
106 }; 122 };
107 123
108 #endif // CHROME_BROWSER_SSL_SSL_BLOCKING_PAGE_H_ 124 #endif // CHROME_BROWSER_SSL_SSL_BLOCKING_PAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698