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

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

Issue 1172183002: Move StartsWith[ASCII] to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@string_util3
Patch Set: merger Created 5 years, 6 months 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/mime_util.cc ('k') | net/base/net_util_icu.cc » ('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>
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 } else if (!IsHostCharAlphanumeric(c) && (c != '-') && (c != '_')) { 249 } else if (!IsHostCharAlphanumeric(c) && (c != '-') && (c != '_')) {
250 return false; 250 return false;
251 } 251 }
252 } 252 }
253 253
254 return most_recent_component_started_alphanumeric; 254 return most_recent_component_started_alphanumeric;
255 } 255 }
256 256
257 base::string16 StripWWW(const base::string16& text) { 257 base::string16 StripWWW(const base::string16& text) {
258 const base::string16 www(base::ASCIIToUTF16("www.")); 258 const base::string16 www(base::ASCIIToUTF16("www."));
259 return StartsWith(text, www, true) ? text.substr(www.length()) : text; 259 return base::StartsWith(text, www, true) ? text.substr(www.length()) : text;
260 } 260 }
261 261
262 base::string16 StripWWWFromHost(const GURL& url) { 262 base::string16 StripWWWFromHost(const GURL& url) {
263 DCHECK(url.is_valid()); 263 DCHECK(url.is_valid());
264 return StripWWW(base::ASCIIToUTF16(url.host())); 264 return StripWWW(base::ASCIIToUTF16(url.host()));
265 } 265 }
266 266
267 bool IsPortValid(int port) { 267 bool IsPortValid(int port) {
268 return port >= 0 && port <= std::numeric_limits<uint16_t>::max(); 268 return port >= 0 && port <= std::numeric_limits<uint16_t>::max();
269 } 269 }
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 }; 794 };
795 const std::string& host = url.host(); 795 const std::string& host = url.host();
796 for (const char* suffix : kGoogleHostSuffixes) { 796 for (const char* suffix : kGoogleHostSuffixes) {
797 if (EndsWith(host, suffix, false)) 797 if (EndsWith(host, suffix, false))
798 return true; 798 return true;
799 } 799 }
800 return false; 800 return false;
801 } 801 }
802 802
803 } // namespace net 803 } // namespace net
OLDNEW
« no previous file with comments | « net/base/mime_util.cc ('k') | net/base/net_util_icu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698