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::Replacements<char> replacements; | 1328 url::Replacements<char> replacements; |
1334 const char kNewScheme[] = "https"; | 1329 const char kNewScheme[] = "https"; |
1335 replacements.SetScheme(kNewScheme, url::Component(0, strlen(kNewScheme))); | 1330 replacements.SetScheme(kNewScheme, url::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. ------------------------------------- |
1340 | 1335 |
(...skipping 127 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 |