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

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

Issue 1481213003: Componentize the bad clock blocking page (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes for estark Created 5 years 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_BAD_CLOCK_BLOCKING_PAGE_H_ 5 #ifndef CHROME_BROWSER_SSL_BAD_CLOCK_BLOCKING_PAGE_H_
6 #define CHROME_BROWSER_SSL_BAD_CLOCK_BLOCKING_PAGE_H_ 6 #define CHROME_BROWSER_SSL_BAD_CLOCK_BLOCKING_PAGE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/time/time.h" 11 #include "base/time/time.h"
12 #include "chrome/browser/interstitials/security_interstitial_page.h" 12 #include "chrome/browser/interstitials/security_interstitial_page.h"
13 #include "chrome/browser/ssl/ssl_cert_reporter.h" 13 #include "chrome/browser/ssl/ssl_cert_reporter.h"
14 #include "components/security_interstitials/core/bad_clock_ui.h"
estark 2015/12/01 21:41:51 forward declare?
felt 2015/12/01 22:59:23 Done.
14 #include "net/ssl/ssl_info.h" 15 #include "net/ssl/ssl_info.h"
15 16
16 class CertReportHelper; 17 class CertReportHelper;
17 class GURL; 18 class GURL;
18 19
19 // This class is responsible for showing/hiding the interstitial page that is 20 // This class is responsible for showing/hiding the interstitial page that
20 // shown when a certificate error happens. This error is not overridable. 21 // occurs when an SSL error is triggered by a clock misconfiguration. It
21 // It deletes itself when the interstitial page is closed. 22 // creates the UI using security_interstitials::BadClockUI and then
23 // displays it. It deletes itself when the interstitial page is closed.
22 class BadClockBlockingPage : public SecurityInterstitialPage { 24 class BadClockBlockingPage : public SecurityInterstitialPage {
23 public: 25 public:
24 // Interstitial type, used in tests. 26 // Interstitial type, used in tests.
25 static InterstitialPageDelegate::TypeID kTypeForTesting; 27 static InterstitialPageDelegate::TypeID kTypeForTesting;
26 28
27 // Creates a bad clock interstitial. If the blocking page isn't shown, the 29 // If the blocking page isn't shown, the caller is responsible for cleaning
28 // caller is responsible for cleaning up the blocking page, otherwise the 30 // up the blocking page. Otherwise, the interstitial takes ownership when
29 // interstitial takes ownership when shown. 31 // shown.
30 BadClockBlockingPage(content::WebContents* web_contents, 32 BadClockBlockingPage(content::WebContents* web_contents,
31 int cert_error, 33 int cert_error,
32 const net::SSLInfo& ssl_info, 34 const net::SSLInfo& ssl_info,
33 const GURL& request_url, 35 const GURL& request_url,
34 const base::Time& time_triggered, 36 const base::Time& time_triggered,
35 scoped_ptr<SSLCertReporter> ssl_cert_reporter, 37 scoped_ptr<SSLCertReporter> ssl_cert_reporter,
36 const base::Callback<void(bool)>& callback); 38 const base::Callback<void(bool)>& callback);
37 39
38 ~BadClockBlockingPage() override; 40 ~BadClockBlockingPage() override;
39 41
40 // InterstitialPageDelegate method: 42 // InterstitialPageDelegate method:
41 InterstitialPageDelegate::TypeID GetTypeForTesting() const override; 43 InterstitialPageDelegate::TypeID GetTypeForTesting() const override;
42 44
43 void SetSSLCertReporterForTesting( 45 void SetSSLCertReporterForTesting(
44 scoped_ptr<SSLCertReporter> ssl_cert_reporter); 46 scoped_ptr<SSLCertReporter> ssl_cert_reporter);
45 47
46 protected: 48 protected:
47 // InterstitialPageDelegate implementation. 49 // InterstitialPageDelegate implementation:
48 void CommandReceived(const std::string& command) override; 50 void CommandReceived(const std::string& command) override;
49 void OverrideEntry(content::NavigationEntry* entry) override; 51 void OverrideEntry(content::NavigationEntry* entry) override;
50 void OverrideRendererPrefs(content::RendererPreferences* prefs) override; 52 void OverrideRendererPrefs(content::RendererPreferences* prefs) override;
51 void OnDontProceed() override; 53 void OnDontProceed() override;
52 54
53 // SecurityInterstitialPage implementation: 55 // SecurityInterstitialPage implementation:
54 bool ShouldCreateNewNavigation() const override; 56 bool ShouldCreateNewNavigation() const override;
55 void PopulateInterstitialStrings( 57 void PopulateInterstitialStrings(
56 base::DictionaryValue* load_time_data) override; 58 base::DictionaryValue* load_time_data) override;
59 void AfterShow() override;
57 60
58 private: 61 private:
59 void NotifyDenyCertificate(); 62 void NotifyDenyCertificate();
60 63
61 base::Callback<void(bool)> callback_; 64 base::Callback<void(bool)> callback_;
62 const int cert_error_; 65 const int cert_error_;
63 const net::SSLInfo ssl_info_; 66 const net::SSLInfo ssl_info_;
67 const base::Time time_triggered_;
68 scoped_ptr<ChromeControllerClient> controller_;
64 69
65 // The time at which the interstitial was triggered. The interstitial 70 scoped_ptr<security_interstitials::BadClockUI> bad_clock_ui_;
66 // calculates all times relative to this.
67 const base::Time time_triggered_;
68
69 scoped_ptr<CertReportHelper> cert_report_helper_; 71 scoped_ptr<CertReportHelper> cert_report_helper_;
70 72
71 DISALLOW_COPY_AND_ASSIGN(BadClockBlockingPage); 73 DISALLOW_COPY_AND_ASSIGN(BadClockBlockingPage);
72 }; 74 };
73 75
74 #endif // CHROME_BROWSER_SSL_BAD_CLOCK_BLOCKING_PAGE_H_ 76 #endif // CHROME_BROWSER_SSL_BAD_CLOCK_BLOCKING_PAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698