Colin Blundell | 2ae7015 | 2019-11-25 12:32:31 | [diff] [blame] | 1 | // Copyright 2019 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef WEBLAYER_BROWSER_SSL_ERROR_CONTROLLER_CLIENT_H_ |
| 6 | #define WEBLAYER_BROWSER_SSL_ERROR_CONTROLLER_CLIENT_H_ |
| 7 | |
| 8 | #include "components/security_interstitials/content/security_interstitial_controller_client.h" |
| 9 | #include "net/ssl/ssl_info.h" |
| 10 | #include "url/gurl.h" |
| 11 | |
| 12 | namespace content { |
| 13 | class WebContents; |
| 14 | } |
| 15 | |
| 16 | namespace security_interstitials { |
| 17 | class MetricsHelper; |
Xinghui Lu | 74f0391a | 2020-10-12 20:35:31 | [diff] [blame^] | 18 | class SettingsPageHelper; |
Colin Blundell | 2ae7015 | 2019-11-25 12:32:31 | [diff] [blame] | 19 | } |
| 20 | |
| 21 | namespace weblayer { |
| 22 | |
| 23 | // A stripped-down version of the class by the same name in |
| 24 | // //chrome/browser/ssl, which provides basic functionality for interacting with |
| 25 | // the SSL interstitial. |
| 26 | class SSLErrorControllerClient |
| 27 | : public security_interstitials::SecurityInterstitialControllerClient { |
| 28 | public: |
| 29 | SSLErrorControllerClient( |
| 30 | content::WebContents* web_contents, |
| 31 | int cert_error, |
| 32 | const net::SSLInfo& ssl_info, |
| 33 | const GURL& request_url, |
Xinghui Lu | 74f0391a | 2020-10-12 20:35:31 | [diff] [blame^] | 34 | std::unique_ptr<security_interstitials::MetricsHelper> metrics_helper, |
| 35 | std::unique_ptr<security_interstitials::SettingsPageHelper> |
| 36 | settings_page_helper); |
Colin Blundell | 2ae7015 | 2019-11-25 12:32:31 | [diff] [blame] | 37 | |
| 38 | ~SSLErrorControllerClient() override = default; |
| 39 | |
| 40 | // security_interstitials::SecurityInterstitialControllerClient: |
| 41 | void GoBack() override; |
| 42 | void Proceed() override; |
| 43 | void OpenUrlInNewForegroundTab(const GURL& url) override; |
Colin Blundell | 40121f8 | 2020-01-10 15:01:50 | [diff] [blame] | 44 | bool CanLaunchDateAndTimeSettings() override; |
Colin Blundell | 0c25cae | 2020-02-12 14:33:27 | [diff] [blame] | 45 | void LaunchDateAndTimeSettings() override; |
Colin Blundell | 2ae7015 | 2019-11-25 12:32:31 | [diff] [blame] | 46 | |
| 47 | private: |
| 48 | const int cert_error_; |
| 49 | const net::SSLInfo ssl_info_; |
| 50 | const GURL request_url_; |
| 51 | |
| 52 | DISALLOW_COPY_AND_ASSIGN(SSLErrorControllerClient); |
| 53 | }; |
| 54 | |
| 55 | } // namespace weblayer |
| 56 | |
| 57 | #endif // WEBLAYER_BROWSER_SSL_ERROR_CONTROLLER_CLIENT_H_ |