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