| 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 "net/base/net_util.h" | 5 #include "net/base/net_util.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 #endif | 58 #endif |
| 59 #if defined(OS_WIN) | 59 #if defined(OS_WIN) |
| 60 #include "net/base/winsock_init.h" | 60 #include "net/base/winsock_init.h" |
| 61 #endif | 61 #endif |
| 62 | 62 |
| 63 namespace net { | 63 namespace net { |
| 64 | 64 |
| 65 namespace { | 65 namespace { |
| 66 | 66 |
| 67 std::string NormalizeHostname(const std::string& host) { | 67 std::string NormalizeHostname(const std::string& host) { |
| 68 std::string result = base::StringToLowerASCII(host); | 68 std::string result = base::ToLowerASCII(host); |
| 69 if (!result.empty() && *result.rbegin() == '.') | 69 if (!result.empty() && *result.rbegin() == '.') |
| 70 result.resize(result.size() - 1); | 70 result.resize(result.size() - 1); |
| 71 return result; | 71 return result; |
| 72 } | 72 } |
| 73 | 73 |
| 74 bool IsNormalizedLocalhostTLD(const std::string& host) { | 74 bool IsNormalizedLocalhostTLD(const std::string& host) { |
| 75 return base::EndsWith(host, ".localhost", base::CompareCase::SENSITIVE); | 75 return base::EndsWith(host, ".localhost", base::CompareCase::SENSITIVE); |
| 76 } | 76 } |
| 77 | 77 |
| 78 // |host| should be normalized. | 78 // |host| should be normalized. |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 }; | 623 }; |
| 624 const std::string& host = url.host(); | 624 const std::string& host = url.host(); |
| 625 for (const char* suffix : kGoogleHostSuffixes) { | 625 for (const char* suffix : kGoogleHostSuffixes) { |
| 626 if (base::EndsWith(host, suffix, base::CompareCase::INSENSITIVE_ASCII)) | 626 if (base::EndsWith(host, suffix, base::CompareCase::INSENSITIVE_ASCII)) |
| 627 return true; | 627 return true; |
| 628 } | 628 } |
| 629 return false; | 629 return false; |
| 630 } | 630 } |
| 631 | 631 |
| 632 } // namespace net | 632 } // namespace net |
| OLD | NEW |