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 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 } | 497 } |
498 | 498 |
499 private: | 499 private: |
500 // Transforms something like "http://www.google.com/xyz" to | 500 // Transforms something like "http://www.google.com/xyz" to |
501 // "http://com.google.www/xyz". | 501 // "http://com.google.www/xyz". |
502 static std::string ReverseComponents(const GURL& url) { | 502 static std::string ReverseComponents(const GURL& url) { |
503 // Reverse the components in the hostname. | 503 // Reverse the components in the hostname. |
504 std::vector<std::string> parts; | 504 std::vector<std::string> parts; |
505 base::SplitString(url.host(), '.', &parts); | 505 base::SplitString(url.host(), '.', &parts); |
506 std::reverse(parts.begin(), parts.end()); | 506 std::reverse(parts.begin(), parts.end()); |
507 std::string reversed_host = JoinString(parts, '.'); | 507 std::string reversed_host = base::JoinString(parts, "."); |
508 | 508 |
509 // Return the new URL. | 509 // Return the new URL. |
510 GURL::Replacements url_components; | 510 GURL::Replacements url_components; |
511 url_components.SetHostStr(reversed_host); | 511 url_components.SetHostStr(reversed_host); |
512 return url.ReplaceComponents(url_components).spec(); | 512 return url.ReplaceComponents(url_components).spec(); |
513 } | 513 } |
514 }; | 514 }; |
515 | 515 |
516 void Predictor::GetHtmlReferrerLists(std::string* output) { | 516 void Predictor::GetHtmlReferrerLists(std::string* output) { |
517 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 517 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1318 } | 1318 } |
1319 | 1319 |
1320 void SimplePredictor::ShutdownOnUIThread() { | 1320 void SimplePredictor::ShutdownOnUIThread() { |
1321 SetShutdown(true); | 1321 SetShutdown(true); |
1322 } | 1322 } |
1323 | 1323 |
1324 bool SimplePredictor::CanPrefetchAndPrerender() const { return true; } | 1324 bool SimplePredictor::CanPrefetchAndPrerender() const { return true; } |
1325 bool SimplePredictor::CanPreresolveAndPreconnect() const { return true; } | 1325 bool SimplePredictor::CanPreresolveAndPreconnect() const { return true; } |
1326 | 1326 |
1327 } // namespace chrome_browser_net | 1327 } // namespace chrome_browser_net |
OLD | NEW |