| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/net/predictor.h" | 5 #include "chrome/browser/net/predictor.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <sstream> | 10 #include <sstream> |
| (...skipping 1302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1313 proxy_advisor_->Advise(url, motivation, is_preconnect); | 1313 proxy_advisor_->Advise(url, motivation, is_preconnect); |
| 1314 } | 1314 } |
| 1315 | 1315 |
| 1316 GURL Predictor::GetHSTSRedirectOnIOThread(const GURL& url) { | 1316 GURL Predictor::GetHSTSRedirectOnIOThread(const GURL& url) { |
| 1317 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 1317 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 1318 | 1318 |
| 1319 if (!transport_security_state_) | 1319 if (!transport_security_state_) |
| 1320 return url; | 1320 return url; |
| 1321 if (!url.SchemeIs("http")) | 1321 if (!url.SchemeIs("http")) |
| 1322 return url; | 1322 return url; |
| 1323 net::TransportSecurityState::DomainState domain_state; | 1323 bool sni_available = |
| 1324 if (!transport_security_state_->GetDomainState( | 1324 net::SSLConfigService::IsSNIAvailable(ssl_config_service_); |
| 1325 url.host(), | 1325 if (!transport_security_state_->ShouldUpgradeToSSL(url.host(), sni_available)) |
| 1326 net::SSLConfigService::IsSNIAvailable(ssl_config_service_), | |
| 1327 &domain_state)) { | |
| 1328 return url; | |
| 1329 } | |
| 1330 if (!domain_state.ShouldUpgradeToSSL()) | |
| 1331 return url; | 1326 return url; |
| 1332 | 1327 |
| 1333 url_canon::Replacements<char> replacements; | 1328 url_canon::Replacements<char> replacements; |
| 1334 const char kNewScheme[] = "https"; | 1329 const char kNewScheme[] = "https"; |
| 1335 replacements.SetScheme(kNewScheme, | 1330 replacements.SetScheme(kNewScheme, |
| 1336 url_parse::Component(0, strlen(kNewScheme))); | 1331 url_parse::Component(0, strlen(kNewScheme))); |
| 1337 return url.ReplaceComponents(replacements); | 1332 return url.ReplaceComponents(replacements); |
| 1338 } | 1333 } |
| 1339 | 1334 |
| 1340 // ---------------------- End IO methods. ------------------------------------- | 1335 // ---------------------- End IO methods. ------------------------------------- |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1469 IOThread* io_thread, | 1464 IOThread* io_thread, |
| 1470 net::URLRequestContextGetter* getter) { | 1465 net::URLRequestContextGetter* getter) { |
| 1471 // Empty function for unittests. | 1466 // Empty function for unittests. |
| 1472 } | 1467 } |
| 1473 | 1468 |
| 1474 void SimplePredictor::ShutdownOnUIThread() { | 1469 void SimplePredictor::ShutdownOnUIThread() { |
| 1475 SetShutdown(true); | 1470 SetShutdown(true); |
| 1476 } | 1471 } |
| 1477 | 1472 |
| 1478 } // namespace chrome_browser_net | 1473 } // namespace chrome_browser_net |
| OLD | NEW |