| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <iterator> | 8 #include <iterator> |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| 11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 12 | 12 |
| 13 #if defined(OS_WIN) | 13 #if defined(OS_WIN) |
| 14 #include <windows.h> | 14 #include <windows.h> |
| 15 #include <iphlpapi.h> |
| 15 #include <winsock2.h> | 16 #include <winsock2.h> |
| 16 #include <iphlpapi.h> | |
| 17 #pragma comment(lib, "iphlpapi.lib") | 17 #pragma comment(lib, "iphlpapi.lib") |
| 18 #elif defined(OS_POSIX) | 18 #elif defined(OS_POSIX) |
| 19 #include <fcntl.h> | 19 #include <fcntl.h> |
| 20 #if !defined(OS_ANDROID) | 20 #if !defined(OS_ANDROID) |
| 21 #include <ifaddrs.h> | 21 #include <ifaddrs.h> |
| 22 #endif | 22 #endif |
| 23 #include <net/if.h> |
| 23 #include <netdb.h> | 24 #include <netdb.h> |
| 24 #include <net/if.h> | |
| 25 #include <netinet/in.h> | 25 #include <netinet/in.h> |
| 26 #endif | 26 #endif |
| 27 | 27 |
| 28 #include "base/basictypes.h" | 28 #include "base/basictypes.h" |
| 29 #include "base/file_path.h" | 29 #include "base/file_path.h" |
| 30 #include "base/file_util.h" | 30 #include "base/file_util.h" |
| 31 #include "base/i18n/file_util_icu.h" | 31 #include "base/i18n/file_util_icu.h" |
| 32 #include "base/i18n/icu_string_conversions.h" | 32 #include "base/i18n/icu_string_conversions.h" |
| 33 #include "base/i18n/time_formatting.h" | 33 #include "base/i18n/time_formatting.h" |
| 34 #include "base/json/string_escape.h" | 34 #include "base/json/string_escape.h" |
| 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_byteorder.h" |
| 49 #include "base/sys_string_conversions.h" | 50 #include "base/sys_string_conversions.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" |
| 58 #include "googleurl/src/url_parse.h" | 58 #include "googleurl/src/url_parse.h" |
| 59 #include "grit/net_resources.h" | 59 #include "grit/net_resources.h" |
| 60 #if defined(OS_ANDROID) | 60 #if defined(OS_ANDROID) |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |