Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(394)

Side by Side Diff: net/base/net_util.cc

Issue 732423002: Update from chromium https://crrev.com/304586 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/base/net_util.h ('k') | net/base/net_util_linux.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « net/base/net_util.h ('k') | net/base/net_util_linux.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698