Chromium Code Reviews| 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 130 // Random parameters for SSL blocking page. | 130 // Random parameters for SSL blocking page. |
| 131 int cert_error = net::ERR_CERT_CONTAINS_ERRORS; | 131 int cert_error = net::ERR_CERT_CONTAINS_ERRORS; |
| 132 GURL request_url("https://example.com"); | 132 GURL request_url("https://example.com"); |
| 133 bool overridable = false; | 133 bool overridable = false; |
| 134 bool strict_enforcement = false; | 134 bool strict_enforcement = false; |
| 135 base::Time time_triggered_ = base::Time::NowFromSystemTime(); | 135 base::Time time_triggered_ = base::Time::NowFromSystemTime(); |
| 136 std::string url_param; | 136 std::string url_param; |
| 137 if (net::GetValueForKeyInQuery(web_contents->GetURL(), | 137 if (net::GetValueForKeyInQuery(web_contents->GetURL(), |
| 138 "url", | 138 "url", |
| 139 &url_param)) { | 139 &url_param)) { |
| 140 if (GURL(url_param).is_valid()) | 140 if (GURL(url_param).is_valid()) { |
| 141 request_url = GURL(url_param); | 141 request_url = GURL(url_param); |
| 142 } | |
| 142 } | 143 } |
| 143 std::string overridable_param; | 144 std::string overridable_param; |
| 144 if (net::GetValueForKeyInQuery(web_contents->GetURL(), | 145 if (net::GetValueForKeyInQuery(web_contents->GetURL(), |
| 145 "overridable", | 146 "overridable", |
| 146 &overridable_param)) { | 147 &overridable_param)) { |
| 147 overridable = overridable_param == "1"; | 148 overridable = overridable_param == "1"; |
| 148 } | 149 } |
| 149 std::string strict_enforcement_param; | 150 std::string strict_enforcement_param; |
| 150 if (net::GetValueForKeyInQuery(web_contents->GetURL(), | 151 if (net::GetValueForKeyInQuery(web_contents->GetURL(), |
| 151 "strict_enforcement", | 152 "strict_enforcement", |
| 152 &strict_enforcement_param)) { | 153 &strict_enforcement_param)) { |
| 153 strict_enforcement = strict_enforcement_param == "1"; | 154 strict_enforcement = strict_enforcement_param == "1"; |
| 154 } | 155 } |
| 156 std::string type_param; | |
| 157 if (net::GetValueForKeyInQuery(web_contents->GetURL(), "type", &type_param)) { | |
| 158 if (type_param == "pinned_cert") { | |
|
lgarron
2017/06/27 20:41:44
This should match `hpkp_failure` below, right?
sperigo
2017/06/27 21:31:27
Oops! Definitely.
| |
| 159 cert_error = net::ERR_SSL_PINNED_KEY_NOT_IN_CERT_CHAIN; | |
| 160 } | |
| 161 } | |
| 155 net::SSLInfo ssl_info; | 162 net::SSLInfo ssl_info; |
| 156 ssl_info.cert = ssl_info.unverified_cert = CreateFakeCert(); | 163 ssl_info.cert = ssl_info.unverified_cert = CreateFakeCert(); |
| 157 // This delegate doesn't create an interstitial. | 164 // This delegate doesn't create an interstitial. |
| 158 int options_mask = 0; | 165 int options_mask = 0; |
| 159 if (overridable) | 166 if (overridable) |
| 160 options_mask |= security_interstitials::SSLErrorUI::SOFT_OVERRIDE_ENABLED; | 167 options_mask |= security_interstitials::SSLErrorUI::SOFT_OVERRIDE_ENABLED; |
| 161 if (strict_enforcement) | 168 if (strict_enforcement) |
| 162 options_mask |= security_interstitials::SSLErrorUI::STRICT_ENFORCEMENT; | 169 options_mask |= security_interstitials::SSLErrorUI::STRICT_ENFORCEMENT; |
| 163 return SSLBlockingPage::Create( | 170 return SSLBlockingPage::Create( |
| 164 web_contents, cert_error, ssl_info, request_url, options_mask, | 171 web_contents, cert_error, ssl_info, request_url, options_mask, |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 217 | 224 |
| 218 safe_browsing::SafeBrowsingBlockingPage* CreateSafeBrowsingBlockingPage( | 225 safe_browsing::SafeBrowsingBlockingPage* CreateSafeBrowsingBlockingPage( |
| 219 content::WebContents* web_contents) { | 226 content::WebContents* web_contents) { |
| 220 safe_browsing::SBThreatType threat_type = | 227 safe_browsing::SBThreatType threat_type = |
| 221 safe_browsing::SB_THREAT_TYPE_URL_MALWARE; | 228 safe_browsing::SB_THREAT_TYPE_URL_MALWARE; |
| 222 GURL request_url("http://example.com"); | 229 GURL request_url("http://example.com"); |
| 223 std::string url_param; | 230 std::string url_param; |
| 224 if (net::GetValueForKeyInQuery(web_contents->GetURL(), | 231 if (net::GetValueForKeyInQuery(web_contents->GetURL(), |
| 225 "url", | 232 "url", |
| 226 &url_param)) { | 233 &url_param)) { |
| 227 if (GURL(url_param).is_valid()) | 234 if (GURL(url_param).is_valid()) { |
| 228 request_url = GURL(url_param); | 235 request_url = GURL(url_param); |
| 236 } | |
| 229 } | 237 } |
| 230 GURL main_frame_url(request_url); | 238 GURL main_frame_url(request_url); |
| 231 // TODO(mattm): add flag to change main_frame_url or add dedicated flag to | 239 // TODO(mattm): add flag to change main_frame_url or add dedicated flag to |
| 232 // test subresource interstitials. | 240 // test subresource interstitials. |
| 233 std::string type_param; | 241 std::string type_param; |
| 234 if (net::GetValueForKeyInQuery(web_contents->GetURL(), | 242 if (net::GetValueForKeyInQuery(web_contents->GetURL(), |
| 235 "type", | 243 "type", |
| 236 &type_param)) { | 244 &type_param)) { |
| 237 // TODO(mattm): add param for SB_THREAT_TYPE_URL_UNWANTED. | 245 // TODO(mattm): add param for SB_THREAT_TYPE_URL_UNWANTED. |
| 238 if (type_param == "malware") { | 246 if (type_param == "malware") { |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 482 } else if (reason_string == "not_signed_in") { | 490 } else if (reason_string == "not_signed_in") { |
| 483 reason = supervised_user_error_page::NOT_SIGNED_IN; | 491 reason = supervised_user_error_page::NOT_SIGNED_IN; |
| 484 } | 492 } |
| 485 } | 493 } |
| 486 | 494 |
| 487 return supervised_user_error_page::BuildHtml( | 495 return supervised_user_error_page::BuildHtml( |
| 488 allow_access_requests, profile_image_url, profile_image_url2, custodian, | 496 allow_access_requests, profile_image_url, profile_image_url2, custodian, |
| 489 custodian_email, second_custodian, second_custodian_email, | 497 custodian_email, second_custodian, second_custodian_email, |
| 490 is_child_account, reason, g_browser_process->GetApplicationLocale()); | 498 is_child_account, reason, g_browser_process->GetApplicationLocale()); |
| 491 } | 499 } |
| OLD | NEW |