| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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_linux.h" | 5 #include "net/base/net_util_linux.h" |
| 6 | 6 |
| 7 #include <net/if.h> | 7 #include <net/if.h> |
| 8 #include <netinet/in.h> | 8 #include <netinet/in.h> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <sys/types.h> | 10 #include <sys/types.h> |
| 11 | 11 |
| 12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/stl_util.h" |
| 15 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
| 16 #include "base/strings/string_tokenizer.h" | 17 #include "base/strings/string_tokenizer.h" |
| 17 #include "base/strings/string_util.h" | 18 #include "base/strings/string_util.h" |
| 18 #include "base/threading/thread_restrictions.h" | 19 #include "base/threading/thread_restrictions.h" |
| 19 #include "net/base/address_tracker_linux.h" | 20 #include "net/base/address_tracker_linux.h" |
| 20 #include "net/base/escape.h" | 21 #include "net/base/escape.h" |
| 21 #include "net/base/ip_endpoint.h" | 22 #include "net/base/ip_endpoint.h" |
| 22 #include "net/base/net_errors.h" | 23 #include "net/base/net_errors.h" |
| 23 #include "net/base/net_util_posix.h" | 24 #include "net/base/net_util_posix.h" |
| 24 #include "url/gurl.h" | 25 #include "url/gurl.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 55 } | 56 } |
| 56 | 57 |
| 57 return true; | 58 return true; |
| 58 } | 59 } |
| 59 | 60 |
| 60 } // namespace | 61 } // namespace |
| 61 | 62 |
| 62 namespace internal { | 63 namespace internal { |
| 63 | 64 |
| 64 inline const unsigned char* GetIPAddressData(const IPAddressNumber& ip) { | 65 inline const unsigned char* GetIPAddressData(const IPAddressNumber& ip) { |
| 65 #if defined(OS_ANDROID) | 66 return vector_as_array(&ip); |
| 66 return ip.begin(); | |
| 67 #else | |
| 68 return ip.data(); | |
| 69 #endif | |
| 70 } | 67 } |
| 71 | 68 |
| 72 bool GetNetworkListImpl( | 69 bool GetNetworkListImpl( |
| 73 NetworkInterfaceList* networks, | 70 NetworkInterfaceList* networks, |
| 74 int policy, | 71 int policy, |
| 75 const base::hash_set<int>& online_links, | 72 const base::hash_set<int>& online_links, |
| 76 const internal::AddressTrackerLinux::AddressMap& address_map, | 73 const internal::AddressTrackerLinux::AddressMap& address_map, |
| 77 GetInterfaceNameFunction get_interface_name) { | 74 GetInterfaceNameFunction get_interface_name) { |
| 78 std::map<int, std::string> ifnames; | 75 std::map<int, std::string> ifnames; |
| 79 | 76 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 | 142 |
| 146 internal::AddressTrackerLinux tracker; | 143 internal::AddressTrackerLinux tracker; |
| 147 tracker.Init(); | 144 tracker.Init(); |
| 148 | 145 |
| 149 return internal::GetNetworkListImpl(networks, policy, | 146 return internal::GetNetworkListImpl(networks, policy, |
| 150 tracker.GetOnlineLinks(), | 147 tracker.GetOnlineLinks(), |
| 151 tracker.GetAddressMap(), &if_indextoname); | 148 tracker.GetAddressMap(), &if_indextoname); |
| 152 } | 149 } |
| 153 | 150 |
| 154 } // namespace net | 151 } // namespace net |
| OLD | NEW |