| 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 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| 11 #include <iterator> | 11 #include <iterator> |
| 12 #include <limits> |
| 12 #include <set> | 13 #include <set> |
| 13 | 14 |
| 14 #include "build/build_config.h" | 15 #include "build/build_config.h" |
| 15 | 16 |
| 16 #if defined(OS_WIN) | 17 #if defined(OS_WIN) |
| 17 #include <windows.h> | 18 #include <windows.h> |
| 18 #include <iphlpapi.h> | 19 #include <iphlpapi.h> |
| 19 #include <winsock2.h> | 20 #include <winsock2.h> |
| 20 #include <ws2bth.h> | 21 #include <ws2bth.h> |
| 21 #pragma comment(lib, "iphlpapi.lib") | 22 #pragma comment(lib, "iphlpapi.lib") |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 base::string16 StripWWW(const base::string16& text) { | 288 base::string16 StripWWW(const base::string16& text) { |
| 288 const base::string16 www(base::ASCIIToUTF16("www.")); | 289 const base::string16 www(base::ASCIIToUTF16("www.")); |
| 289 return StartsWith(text, www, true) ? text.substr(www.length()) : text; | 290 return StartsWith(text, www, true) ? text.substr(www.length()) : text; |
| 290 } | 291 } |
| 291 | 292 |
| 292 base::string16 StripWWWFromHost(const GURL& url) { | 293 base::string16 StripWWWFromHost(const GURL& url) { |
| 293 DCHECK(url.is_valid()); | 294 DCHECK(url.is_valid()); |
| 294 return StripWWW(base::ASCIIToUTF16(url.host())); | 295 return StripWWW(base::ASCIIToUTF16(url.host())); |
| 295 } | 296 } |
| 296 | 297 |
| 298 bool IsPortValid(int port) { |
| 299 return port >= 0 && port <= std::numeric_limits<uint16>::max(); |
| 300 } |
| 301 |
| 297 bool IsPortAllowedByDefault(int port) { | 302 bool IsPortAllowedByDefault(int port) { |
| 298 int array_size = arraysize(kRestrictedPorts); | 303 int array_size = arraysize(kRestrictedPorts); |
| 299 for (int i = 0; i < array_size; i++) { | 304 for (int i = 0; i < array_size; i++) { |
| 300 if (kRestrictedPorts[i] == port) { | 305 if (kRestrictedPorts[i] == port) { |
| 301 return false; | 306 return false; |
| 302 } | 307 } |
| 303 } | 308 } |
| 304 return true; | 309 return true; |
| 305 } | 310 } |
| 306 | 311 |
| (...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1052 | 1057 |
| 1053 unsigned MaskPrefixLength(const IPAddressNumber& mask) { | 1058 unsigned MaskPrefixLength(const IPAddressNumber& mask) { |
| 1054 IPAddressNumber all_ones(mask.size(), 0xFF); | 1059 IPAddressNumber all_ones(mask.size(), 0xFF); |
| 1055 return CommonPrefixLength(mask, all_ones); | 1060 return CommonPrefixLength(mask, all_ones); |
| 1056 } | 1061 } |
| 1057 | 1062 |
| 1058 ScopedWifiOptions::~ScopedWifiOptions() { | 1063 ScopedWifiOptions::~ScopedWifiOptions() { |
| 1059 } | 1064 } |
| 1060 | 1065 |
| 1061 } // namespace net | 1066 } // namespace net |
| OLD | NEW |