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

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

Issue 12087091: Move string tokenizer to base/strings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
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 <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 #include <map> 9 #include <map>
10 10
(...skipping 24 matching lines...) Expand all
35 #include "base/lazy_instance.h" 35 #include "base/lazy_instance.h"
36 #include "base/logging.h" 36 #include "base/logging.h"
37 #include "base/memory/singleton.h" 37 #include "base/memory/singleton.h"
38 #include "base/message_loop.h" 38 #include "base/message_loop.h"
39 #include "base/metrics/histogram.h" 39 #include "base/metrics/histogram.h"
40 #include "base/path_service.h" 40 #include "base/path_service.h"
41 #include "base/stl_util.h" 41 #include "base/stl_util.h"
42 #include "base/string_number_conversions.h" 42 #include "base/string_number_conversions.h"
43 #include "base/string_piece.h" 43 #include "base/string_piece.h"
44 #include "base/string_split.h" 44 #include "base/string_split.h"
45 #include "base/string_tokenizer.h"
46 #include "base/string_util.h" 45 #include "base/string_util.h"
47 #include "base/stringprintf.h" 46 #include "base/stringprintf.h"
47 #include "base/strings/string_tokenizer.h"
48 #include "base/synchronization/lock.h" 48 #include "base/synchronization/lock.h"
49 #include "base/sys_string_conversions.h" 49 #include "base/sys_string_conversions.h"
50 #include "base/sys_byteorder.h" 50 #include "base/sys_byteorder.h"
51 #include "base/time.h" 51 #include "base/time.h"
52 #include "base/utf_offset_string_conversions.h" 52 #include "base/utf_offset_string_conversions.h"
53 #include "base/utf_string_conversions.h" 53 #include "base/utf_string_conversions.h"
54 #include "base/values.h" 54 #include "base/values.h"
55 #include "googleurl/src/gurl.h" 55 #include "googleurl/src/gurl.h"
56 #include "googleurl/src/url_canon.h" 56 #include "googleurl/src/url_canon.h"
57 #include "googleurl/src/url_canon_ip.h" 57 #include "googleurl/src/url_canon_ip.h"
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 // (sync'd with characters allowed in url_canon_host with square 390 // (sync'd with characters allowed in url_canon_host with square
391 // brackets excluded.) See kHostCharLookup[] array in url_canon_host.cc. 391 // brackets excluded.) See kHostCharLookup[] array in url_canon_host.cc.
392 icu::UnicodeSet common_characters(UNICODE_STRING_SIMPLE("[[0-9]\\-_+\\ ]"), 392 icu::UnicodeSet common_characters(UNICODE_STRING_SIMPLE("[[0-9]\\-_+\\ ]"),
393 status); 393 status);
394 DCHECK(U_SUCCESS(status)); 394 DCHECK(U_SUCCESS(status));
395 // Subtract common characters because they're always allowed so that 395 // Subtract common characters because they're always allowed so that
396 // we just have to check if a language-specific set contains 396 // we just have to check if a language-specific set contains
397 // the remainder. 397 // the remainder.
398 component_characters.removeAll(common_characters); 398 component_characters.removeAll(common_characters);
399 399
400 StringTokenizer t(languages, ","); 400 base::StringTokenizer t(languages, ",");
401 while (t.GetNext()) { 401 while (t.GetNext()) {
402 if (IsComponentCoveredByLang(component_characters, t.token())) 402 if (IsComponentCoveredByLang(component_characters, t.token()))
403 return true; 403 return true;
404 } 404 }
405 return false; 405 return false;
406 } 406 }
407 407
408 // Converts one component of a host (between dots) to IDN if safe. The result 408 // Converts one component of a host (between dots) to IDN if safe. The result
409 // will be APPENDED to the given output string and will be the same as the input 409 // will be APPENDED to the given output string and will be the same as the input
410 // if it is not IDN or the IDN is unsafe to display. Returns whether any 410 // if it is not IDN or the IDN is unsafe to display. Returns whether any
(...skipping 1762 matching lines...) Expand 10 before | Expand all | Expand 10 after
2173 2173
2174 NetworkInterface::NetworkInterface(const std::string& name, 2174 NetworkInterface::NetworkInterface(const std::string& name,
2175 const IPAddressNumber& address) 2175 const IPAddressNumber& address)
2176 : name(name), address(address) { 2176 : name(name), address(address) {
2177 } 2177 }
2178 2178
2179 NetworkInterface::~NetworkInterface() { 2179 NetworkInterface::~NetworkInterface() {
2180 } 2180 }
2181 2181
2182 } // namespace net 2182 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698