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 "content/renderer/p2p/ipc_network_manager.h" | 5 #include "content/renderer/p2p/ipc_network_manager.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/sys_byteorder.h" | 8 #include "base/sys_byteorder.h" |
9 #include "net/base/net_util.h" | 9 #include "net/base/net_util.h" |
10 | 10 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 if (!network_list_received_) | 45 if (!network_list_received_) |
46 network_list_received_ = true; | 46 network_list_received_ = true; |
47 | 47 |
48 std::vector<talk_base::Network*> networks; | 48 std::vector<talk_base::Network*> networks; |
49 for (net::NetworkInterfaceList::const_iterator it = list.begin(); | 49 for (net::NetworkInterfaceList::const_iterator it = list.begin(); |
50 it != list.end(); it++) { | 50 it != list.end(); it++) { |
51 uint32 address; | 51 uint32 address; |
52 if (it->address.size() != net::kIPv4AddressSize) | 52 if (it->address.size() != net::kIPv4AddressSize) |
53 continue; | 53 continue; |
54 memcpy(&address, &it->address[0], sizeof(uint32)); | 54 memcpy(&address, &it->address[0], sizeof(uint32)); |
55 address = ntohl(address); | 55 address = talk_base::NetworkToHost32(address); |
56 networks.push_back( | 56 talk_base::Network* network = new talk_base::Network( |
57 new talk_base::Network( | 57 it->name, it->name, talk_base::IPAddress(address), 32); |
58 it->name, it->name, talk_base::IPAddress(address))); | 58 network->AddIP(talk_base::IPAddress(address)); |
| 59 networks.push_back(network); |
59 } | 60 } |
60 | 61 |
61 bool changed = false; | 62 bool changed = false; |
62 MergeNetworkList(networks, &changed); | 63 MergeNetworkList(networks, &changed); |
63 if (changed) | 64 if (changed) |
64 SignalNetworksChanged(); | 65 SignalNetworksChanged(); |
65 } | 66 } |
66 | 67 |
67 void IpcNetworkManager::SendNetworksChangedSignal() { | 68 void IpcNetworkManager::SendNetworksChangedSignal() { |
68 SignalNetworksChanged(); | 69 SignalNetworksChanged(); |
69 } | 70 } |
70 | 71 |
71 } // namespace content | 72 } // namespace content |
OLD | NEW |