OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 //------------------------------------------------------------------------------ | 672 //------------------------------------------------------------------------------ |
673 | 673 |
674 // static | 674 // static |
675 GURL Predictor::CanonicalizeUrl(const GURL& url) { | 675 GURL Predictor::CanonicalizeUrl(const GURL& url) { |
676 if (!url.has_host()) | 676 if (!url.has_host()) |
677 return GURL::EmptyGURL(); | 677 return GURL::EmptyGURL(); |
678 | 678 |
679 std::string scheme; | 679 std::string scheme; |
680 if (url.has_scheme()) { | 680 if (url.has_scheme()) { |
681 scheme = url.scheme(); | 681 scheme = url.scheme(); |
682 if (scheme != "http" && scheme != "https") | 682 if (scheme != "http" && scheme != "https" && scheme != "httpsv") |
683 return GURL::EmptyGURL(); | 683 return GURL::EmptyGURL(); |
684 if (url.has_port()) | 684 if (url.has_port()) |
685 return url.GetWithEmptyPath(); | 685 return url.GetWithEmptyPath(); |
686 } else { | 686 } else { |
687 scheme = "http"; | 687 scheme = "http"; |
688 } | 688 } |
689 | 689 |
690 // If we omit a port, it will default to 80 or 443 as appropriate. | 690 // If we omit a port, it will default to 80 or 443 as appropriate. |
691 std::string colon_plus_port; | 691 std::string colon_plus_port; |
692 if (url.has_port()) | 692 if (url.has_port()) |
693 colon_plus_port = ":" + url.port(); | 693 colon_plus_port = ":" + url.port(); |
694 | 694 |
695 return GURL(scheme + "://" + url.host() + colon_plus_port); | 695 return GURL(scheme + "://" + url.host() + colon_plus_port); |
696 } | 696 } |
697 | 697 |
698 | 698 |
699 } // namespace chrome_browser_net | 699 } // namespace chrome_browser_net |
OLD | NEW |