| OLD | NEW |
| 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 #include "chrome/browser/ui/webui/interstitials/interstitial_ui.h" | 5 #include "chrome/browser/ui/webui/interstitials/interstitial_ui.h" |
| 6 | 6 |
| 7 #include "base/atomic_sequence_num.h" | 7 #include "base/atomic_sequence_num.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 bool IsWifiConnection() const override { return is_wifi_; } | 119 bool IsWifiConnection() const override { return is_wifi_; } |
| 120 std::string GetWiFiSSID() const override { return wifi_ssid_; } | 120 std::string GetWiFiSSID() const override { return wifi_ssid_; } |
| 121 | 121 |
| 122 const bool is_wifi_; | 122 const bool is_wifi_; |
| 123 const std::string wifi_ssid_; | 123 const std::string wifi_ssid_; |
| 124 | 124 |
| 125 DISALLOW_COPY_AND_ASSIGN(CaptivePortalBlockingPageWithNetInfo); | 125 DISALLOW_COPY_AND_ASSIGN(CaptivePortalBlockingPageWithNetInfo); |
| 126 }; | 126 }; |
| 127 #endif | 127 #endif |
| 128 | 128 |
| 129 SSLBlockingPage* CreateSSLBlockingPage(content::WebContents* web_contents) { | 129 SSLBlockingPage* CreateSSLBlockingPage(content::WebContents* web_contents, |
| 130 bool is_superfish) { |
| 130 // Random parameters for SSL blocking page. | 131 // Random parameters for SSL blocking page. |
| 131 int cert_error = net::ERR_CERT_CONTAINS_ERRORS; | 132 int cert_error = net::ERR_CERT_CONTAINS_ERRORS; |
| 132 GURL request_url("https://example.com"); | 133 GURL request_url("https://example.com"); |
| 133 bool overridable = false; | 134 bool overridable = false; |
| 134 bool strict_enforcement = false; | 135 bool strict_enforcement = false; |
| 135 base::Time time_triggered_ = base::Time::NowFromSystemTime(); | 136 base::Time time_triggered_ = base::Time::NowFromSystemTime(); |
| 136 std::string url_param; | 137 std::string url_param; |
| 137 if (net::GetValueForKeyInQuery(web_contents->GetURL(), | 138 if (net::GetValueForKeyInQuery(web_contents->GetURL(), |
| 138 "url", | 139 "url", |
| 139 &url_param)) { | 140 &url_param)) { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 162 net::SSLInfo ssl_info; | 163 net::SSLInfo ssl_info; |
| 163 ssl_info.cert = ssl_info.unverified_cert = CreateFakeCert(); | 164 ssl_info.cert = ssl_info.unverified_cert = CreateFakeCert(); |
| 164 // This delegate doesn't create an interstitial. | 165 // This delegate doesn't create an interstitial. |
| 165 int options_mask = 0; | 166 int options_mask = 0; |
| 166 if (overridable) | 167 if (overridable) |
| 167 options_mask |= security_interstitials::SSLErrorUI::SOFT_OVERRIDE_ENABLED; | 168 options_mask |= security_interstitials::SSLErrorUI::SOFT_OVERRIDE_ENABLED; |
| 168 if (strict_enforcement) | 169 if (strict_enforcement) |
| 169 options_mask |= security_interstitials::SSLErrorUI::STRICT_ENFORCEMENT; | 170 options_mask |= security_interstitials::SSLErrorUI::STRICT_ENFORCEMENT; |
| 170 return SSLBlockingPage::Create( | 171 return SSLBlockingPage::Create( |
| 171 web_contents, cert_error, ssl_info, request_url, options_mask, | 172 web_contents, cert_error, ssl_info, request_url, options_mask, |
| 172 time_triggered_, nullptr, false /* is superfish */, | 173 time_triggered_, nullptr, is_superfish, |
| 173 base::Callback<void(content::CertificateRequestResultType)>()); | 174 base::Callback<void(content::CertificateRequestResultType)>()); |
| 174 } | 175 } |
| 175 | 176 |
| 176 BadClockBlockingPage* CreateBadClockBlockingPage( | 177 BadClockBlockingPage* CreateBadClockBlockingPage( |
| 177 content::WebContents* web_contents) { | 178 content::WebContents* web_contents) { |
| 178 // Set up a fake clock error. | 179 // Set up a fake clock error. |
| 179 int cert_error = net::ERR_CERT_DATE_INVALID; | 180 int cert_error = net::ERR_CERT_DATE_INVALID; |
| 180 GURL request_url("https://example.com"); | 181 GURL request_url("https://example.com"); |
| 181 bool overridable = false; | 182 bool overridable = false; |
| 182 bool strict_enforcement = false; | 183 bool strict_enforcement = false; |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 const content::URLDataSource::GotDataCallback& callback) { | 407 const content::URLDataSource::GotDataCallback& callback) { |
| 407 content::WebContents* web_contents = wc_getter.Run(); | 408 content::WebContents* web_contents = wc_getter.Run(); |
| 408 if (!web_contents) { | 409 if (!web_contents) { |
| 409 // When browser-side navigation is enabled, web_contents can be null if | 410 // When browser-side navigation is enabled, web_contents can be null if |
| 410 // the tab is closing. Nothing to do in this case. | 411 // the tab is closing. Nothing to do in this case. |
| 411 return; | 412 return; |
| 412 } | 413 } |
| 413 std::unique_ptr<content::InterstitialPageDelegate> interstitial_delegate; | 414 std::unique_ptr<content::InterstitialPageDelegate> interstitial_delegate; |
| 414 std::string html; | 415 std::string html; |
| 415 if (base::StartsWith(path, "ssl", base::CompareCase::SENSITIVE)) { | 416 if (base::StartsWith(path, "ssl", base::CompareCase::SENSITIVE)) { |
| 416 interstitial_delegate.reset(CreateSSLBlockingPage(web_contents)); | 417 interstitial_delegate.reset( |
| 418 CreateSSLBlockingPage(web_contents, false /* is superfish */)); |
| 419 } else if (base::StartsWith(path, "superfish-ssl", |
| 420 base::CompareCase::SENSITIVE)) { |
| 421 interstitial_delegate.reset( |
| 422 CreateSSLBlockingPage(web_contents, true /* is superfish */)); |
| 417 } else if (base::StartsWith(path, "safebrowsing", | 423 } else if (base::StartsWith(path, "safebrowsing", |
| 418 base::CompareCase::SENSITIVE)) { | 424 base::CompareCase::SENSITIVE)) { |
| 419 interstitial_delegate.reset(CreateSafeBrowsingBlockingPage(web_contents)); | 425 interstitial_delegate.reset(CreateSafeBrowsingBlockingPage(web_contents)); |
| 420 } else if (base::StartsWith(path, "clock", base::CompareCase::SENSITIVE)) { | 426 } else if (base::StartsWith(path, "clock", base::CompareCase::SENSITIVE)) { |
| 421 interstitial_delegate.reset(CreateBadClockBlockingPage(web_contents)); | 427 interstitial_delegate.reset(CreateBadClockBlockingPage(web_contents)); |
| 422 } | 428 } |
| 423 #if BUILDFLAG(ENABLE_CAPTIVE_PORTAL_DETECTION) | 429 #if BUILDFLAG(ENABLE_CAPTIVE_PORTAL_DETECTION) |
| 424 else if (base::StartsWith(path, "captiveportal", | 430 else if (base::StartsWith(path, "captiveportal", |
| 425 base::CompareCase::SENSITIVE)) | 431 base::CompareCase::SENSITIVE)) |
| 426 { | 432 { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 reason = supervised_user_error_page::NOT_SIGNED_IN; | 503 reason = supervised_user_error_page::NOT_SIGNED_IN; |
| 498 } | 504 } |
| 499 } | 505 } |
| 500 | 506 |
| 501 return supervised_user_error_page::BuildHtml( | 507 return supervised_user_error_page::BuildHtml( |
| 502 allow_access_requests, profile_image_url, profile_image_url2, custodian, | 508 allow_access_requests, profile_image_url, profile_image_url2, custodian, |
| 503 custodian_email, second_custodian, second_custodian_email, | 509 custodian_email, second_custodian, second_custodian_email, |
| 504 is_child_account, is_deprecated, reason, | 510 is_child_account, is_deprecated, reason, |
| 505 g_browser_process->GetApplicationLocale()); | 511 g_browser_process->GetApplicationLocale()); |
| 506 } | 512 } |
| OLD | NEW |