| 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/macros.h" | 7 #include "base/macros.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 "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 &overridable_param)) { | 114 &overridable_param)) { |
| 115 overridable = overridable_param == "1"; | 115 overridable = overridable_param == "1"; |
| 116 } | 116 } |
| 117 std::string strict_enforcement_param; | 117 std::string strict_enforcement_param; |
| 118 if (net::GetValueForKeyInQuery(web_contents->GetURL(), | 118 if (net::GetValueForKeyInQuery(web_contents->GetURL(), |
| 119 "strict_enforcement", | 119 "strict_enforcement", |
| 120 &strict_enforcement_param)) { | 120 &strict_enforcement_param)) { |
| 121 strict_enforcement = strict_enforcement_param == "1"; | 121 strict_enforcement = strict_enforcement_param == "1"; |
| 122 } | 122 } |
| 123 net::SSLInfo ssl_info; | 123 net::SSLInfo ssl_info; |
| 124 ssl_info.cert = new net::X509Certificate( | |
| 125 request_url.host(), "CA", base::Time::Max(), base::Time::Max()); | |
| 126 // This delegate doesn't create an interstitial. | 124 // This delegate doesn't create an interstitial. |
| 127 int options_mask = 0; | 125 int options_mask = 0; |
| 128 if (overridable) | 126 if (overridable) |
| 129 options_mask |= security_interstitials::SSLErrorUI::SOFT_OVERRIDE_ENABLED; | 127 options_mask |= security_interstitials::SSLErrorUI::SOFT_OVERRIDE_ENABLED; |
| 130 if (strict_enforcement) | 128 if (strict_enforcement) |
| 131 options_mask |= security_interstitials::SSLErrorUI::STRICT_ENFORCEMENT; | 129 options_mask |= security_interstitials::SSLErrorUI::STRICT_ENFORCEMENT; |
| 132 return new SSLBlockingPage(web_contents, cert_error, ssl_info, request_url, | 130 return new SSLBlockingPage(web_contents, cert_error, ssl_info, request_url, |
| 133 options_mask, time_triggered_, nullptr, | 131 options_mask, time_triggered_, nullptr, |
| 134 base::Callback<void(bool)>()); | 132 base::Callback<void(bool)>()); |
| 135 } | 133 } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 163 if (net::GetValueForKeyInQuery(web_contents->GetURL(), "clock_manipulation", | 161 if (net::GetValueForKeyInQuery(web_contents->GetURL(), "clock_manipulation", |
| 164 &clock_manipulation_param)) { | 162 &clock_manipulation_param)) { |
| 165 int time_offset; | 163 int time_offset; |
| 166 if (base::StringToInt(clock_manipulation_param, &time_offset)) { | 164 if (base::StringToInt(clock_manipulation_param, &time_offset)) { |
| 167 clock_state = time_offset > 0 ? ssl_errors::CLOCK_STATE_FUTURE | 165 clock_state = time_offset > 0 ? ssl_errors::CLOCK_STATE_FUTURE |
| 168 : ssl_errors::CLOCK_STATE_PAST; | 166 : ssl_errors::CLOCK_STATE_PAST; |
| 169 } | 167 } |
| 170 } | 168 } |
| 171 | 169 |
| 172 net::SSLInfo ssl_info; | 170 net::SSLInfo ssl_info; |
| 173 ssl_info.cert = new net::X509Certificate( | |
| 174 request_url.host(), "CA", base::Time::Max(), base::Time::Max()); | |
| 175 // This delegate doesn't create an interstitial. | 171 // This delegate doesn't create an interstitial. |
| 176 int options_mask = 0; | 172 int options_mask = 0; |
| 177 if (overridable) | 173 if (overridable) |
| 178 options_mask |= security_interstitials::SSLErrorUI::SOFT_OVERRIDE_ENABLED; | 174 options_mask |= security_interstitials::SSLErrorUI::SOFT_OVERRIDE_ENABLED; |
| 179 if (strict_enforcement) | 175 if (strict_enforcement) |
| 180 options_mask |= security_interstitials::SSLErrorUI::STRICT_ENFORCEMENT; | 176 options_mask |= security_interstitials::SSLErrorUI::STRICT_ENFORCEMENT; |
| 181 return new BadClockBlockingPage(web_contents, cert_error, ssl_info, | 177 return new BadClockBlockingPage(web_contents, cert_error, ssl_info, |
| 182 request_url, base::Time::Now(), clock_state, | 178 request_url, base::Time::Now(), clock_state, |
| 183 nullptr, base::Callback<void(bool)>()); | 179 nullptr, base::Callback<void(bool)>()); |
| 184 } | 180 } |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 if (net::GetValueForKeyInQuery(web_contents->GetURL(), "is_wifi", | 257 if (net::GetValueForKeyInQuery(web_contents->GetURL(), "is_wifi", |
| 262 &wifi_connection_param)) { | 258 &wifi_connection_param)) { |
| 263 is_wifi_connection = wifi_connection_param == "1"; | 259 is_wifi_connection = wifi_connection_param == "1"; |
| 264 } | 260 } |
| 265 std::string wifi_ssid_param; | 261 std::string wifi_ssid_param; |
| 266 if (net::GetValueForKeyInQuery(web_contents->GetURL(), "wifi_name", | 262 if (net::GetValueForKeyInQuery(web_contents->GetURL(), "wifi_name", |
| 267 &wifi_ssid_param)) { | 263 &wifi_ssid_param)) { |
| 268 wifi_ssid = wifi_ssid_param; | 264 wifi_ssid = wifi_ssid_param; |
| 269 } | 265 } |
| 270 net::SSLInfo ssl_info; | 266 net::SSLInfo ssl_info; |
| 271 ssl_info.cert = new net::X509Certificate( | |
| 272 request_url.host(), "CA", base::Time::Max(), base::Time::Max()); | |
| 273 CaptivePortalBlockingPage* blocking_page = | 267 CaptivePortalBlockingPage* blocking_page = |
| 274 new CaptivePortalBlockingPageWithNetInfo( | 268 new CaptivePortalBlockingPageWithNetInfo( |
| 275 web_contents, request_url, landing_url, ssl_info, | 269 web_contents, request_url, landing_url, ssl_info, |
| 276 base::Callback<void(bool)>(), is_wifi_connection, wifi_ssid); | 270 base::Callback<void(bool)>(), is_wifi_connection, wifi_ssid); |
| 277 return blocking_page; | 271 return blocking_page; |
| 278 } | 272 } |
| 279 #endif | 273 #endif |
| 280 | 274 |
| 281 } // namespace | 275 } // namespace |
| 282 | 276 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 html = interstitial_delegate.get()->GetHTMLContents(); | 343 html = interstitial_delegate.get()->GetHTMLContents(); |
| 350 } else { | 344 } else { |
| 351 html = ResourceBundle::GetSharedInstance() | 345 html = ResourceBundle::GetSharedInstance() |
| 352 .GetRawDataResource(IDR_SECURITY_INTERSTITIAL_UI_HTML) | 346 .GetRawDataResource(IDR_SECURITY_INTERSTITIAL_UI_HTML) |
| 353 .as_string(); | 347 .as_string(); |
| 354 } | 348 } |
| 355 scoped_refptr<base::RefCountedString> html_bytes = new base::RefCountedString; | 349 scoped_refptr<base::RefCountedString> html_bytes = new base::RefCountedString; |
| 356 html_bytes->data().assign(html.begin(), html.end()); | 350 html_bytes->data().assign(html.begin(), html.end()); |
| 357 callback.Run(html_bytes.get()); | 351 callback.Run(html_bytes.get()); |
| 358 } | 352 } |
| OLD | NEW |