| OLD | NEW |
| 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 <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 14 #include "chrome/browser/interstitials/security_interstitial_page.h" | 14 #include "chrome/browser/interstitials/security_interstitial_page.h" |
| 15 #include "chrome/browser/ssl/ssl_cert_reporter.h" | 15 #include "chrome/browser/ssl/ssl_cert_reporter.h" |
| 16 #include "components/ssl_errors/error_classification.h" | 16 #include "components/ssl_errors/error_classification.h" |
| 17 #include "content/public/browser/certificate_request_result_type.h" |
| 17 #include "net/ssl/ssl_info.h" | 18 #include "net/ssl/ssl_info.h" |
| 18 | 19 |
| 19 class CertReportHelper; | 20 class CertReportHelper; |
| 20 class GURL; | 21 class GURL; |
| 21 | 22 |
| 22 namespace security_interstitials { | 23 namespace security_interstitials { |
| 23 class BadClockUI; | 24 class BadClockUI; |
| 24 } | 25 } |
| 25 | 26 |
| 26 // This class is responsible for showing/hiding the interstitial page that | 27 // This class is responsible for showing/hiding the interstitial page that |
| 27 // occurs when an SSL error is triggered by a clock misconfiguration. It | 28 // occurs when an SSL error is triggered by a clock misconfiguration. It |
| 28 // creates the UI using security_interstitials::BadClockUI and then | 29 // creates the UI using security_interstitials::BadClockUI and then |
| 29 // displays it. It deletes itself when the interstitial page is closed. | 30 // displays it. It deletes itself when the interstitial page is closed. |
| 30 class BadClockBlockingPage : public SecurityInterstitialPage { | 31 class BadClockBlockingPage : public SecurityInterstitialPage { |
| 31 public: | 32 public: |
| 32 // Interstitial type, used in tests. | 33 // Interstitial type, used in tests. |
| 33 static InterstitialPageDelegate::TypeID kTypeForTesting; | 34 static InterstitialPageDelegate::TypeID kTypeForTesting; |
| 34 | 35 |
| 35 // If the blocking page isn't shown, the caller is responsible for cleaning | 36 // If the blocking page isn't shown, the caller is responsible for cleaning |
| 36 // up the blocking page. Otherwise, the interstitial takes ownership when | 37 // up the blocking page. Otherwise, the interstitial takes ownership when |
| 37 // shown. | 38 // shown. |
| 38 BadClockBlockingPage(content::WebContents* web_contents, | 39 BadClockBlockingPage(content::WebContents* web_contents, |
| 39 int cert_error, | 40 int cert_error, |
| 40 const net::SSLInfo& ssl_info, | 41 const net::SSLInfo& ssl_info, |
| 41 const GURL& request_url, | 42 const GURL& request_url, |
| 42 const base::Time& time_triggered, | 43 const base::Time& time_triggered, |
| 43 ssl_errors::ClockState clock_state, | 44 ssl_errors::ClockState clock_state, |
| 44 std::unique_ptr<SSLCertReporter> ssl_cert_reporter, | 45 std::unique_ptr<SSLCertReporter> ssl_cert_reporter, |
| 45 const base::Callback<void(bool)>& callback); | 46 const base::Callback<void( |
| 47 content::CertificateRequestResultType)>& callback); |
| 46 | 48 |
| 47 ~BadClockBlockingPage() override; | 49 ~BadClockBlockingPage() override; |
| 48 | 50 |
| 49 // InterstitialPageDelegate method: | 51 // InterstitialPageDelegate method: |
| 50 InterstitialPageDelegate::TypeID GetTypeForTesting() const override; | 52 InterstitialPageDelegate::TypeID GetTypeForTesting() const override; |
| 51 | 53 |
| 52 void SetSSLCertReporterForTesting( | 54 void SetSSLCertReporterForTesting( |
| 53 std::unique_ptr<SSLCertReporter> ssl_cert_reporter); | 55 std::unique_ptr<SSLCertReporter> ssl_cert_reporter); |
| 54 | 56 |
| 55 protected: | 57 protected: |
| 56 // InterstitialPageDelegate implementation: | 58 // InterstitialPageDelegate implementation: |
| 57 void CommandReceived(const std::string& command) override; | 59 void CommandReceived(const std::string& command) override; |
| 58 void OverrideEntry(content::NavigationEntry* entry) override; | 60 void OverrideEntry(content::NavigationEntry* entry) override; |
| 59 void OverrideRendererPrefs(content::RendererPreferences* prefs) override; | 61 void OverrideRendererPrefs(content::RendererPreferences* prefs) override; |
| 60 void OnDontProceed() override; | 62 void OnDontProceed() override; |
| 61 | 63 |
| 62 // SecurityInterstitialPage implementation: | 64 // SecurityInterstitialPage implementation: |
| 63 bool ShouldCreateNewNavigation() const override; | 65 bool ShouldCreateNewNavigation() const override; |
| 64 void PopulateInterstitialStrings( | 66 void PopulateInterstitialStrings( |
| 65 base::DictionaryValue* load_time_data) override; | 67 base::DictionaryValue* load_time_data) override; |
| 66 void AfterShow() override; | 68 void AfterShow() override; |
| 67 | 69 |
| 68 private: | 70 private: |
| 69 void NotifyDenyCertificate(); | 71 void NotifyDenyCertificate(); |
| 70 | 72 |
| 71 base::Callback<void(bool)> callback_; | 73 base::Callback<void(content::CertificateRequestResultType)> callback_; |
| 72 const net::SSLInfo ssl_info_; | 74 const net::SSLInfo ssl_info_; |
| 73 const base::Time time_triggered_; | 75 const base::Time time_triggered_; |
| 74 std::unique_ptr<ChromeControllerClient> controller_; | 76 std::unique_ptr<ChromeControllerClient> controller_; |
| 75 | 77 |
| 76 std::unique_ptr<security_interstitials::BadClockUI> bad_clock_ui_; | 78 std::unique_ptr<security_interstitials::BadClockUI> bad_clock_ui_; |
| 77 std::unique_ptr<CertReportHelper> cert_report_helper_; | 79 std::unique_ptr<CertReportHelper> cert_report_helper_; |
| 78 | 80 |
| 79 DISALLOW_COPY_AND_ASSIGN(BadClockBlockingPage); | 81 DISALLOW_COPY_AND_ASSIGN(BadClockBlockingPage); |
| 80 }; | 82 }; |
| 81 | 83 |
| 82 #endif // CHROME_BROWSER_SSL_BAD_CLOCK_BLOCKING_PAGE_H_ | 84 #endif // CHROME_BROWSER_SSL_BAD_CLOCK_BLOCKING_PAGE_H_ |
| OLD | NEW |