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

Side by Side Diff: content/renderer/p2p/ipc_network_manager.cc

Issue 730623002: Rename network_prefix to prefix_length in NetworkInterface structure (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 | « content/common/p2p_messages.h ('k') | extensions/browser/api/socket/socket_api.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 "content/renderer/p2p/ipc_network_manager.h" 5 #include "content/renderer/p2p/ipc_network_manager.h"
6 #include <string> 6 #include <string>
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/sys_byteorder.h" 10 #include "base/sys_byteorder.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 std::vector<rtc::Network*> networks; 76 std::vector<rtc::Network*> networks;
77 int ipv4_interfaces = 0; 77 int ipv4_interfaces = 0;
78 int ipv6_interfaces = 0; 78 int ipv6_interfaces = 0;
79 for (net::NetworkInterfaceList::const_iterator it = list.begin(); 79 for (net::NetworkInterfaceList::const_iterator it = list.begin();
80 it != list.end(); it++) { 80 it != list.end(); it++) {
81 if (it->address.size() == net::kIPv4AddressSize) { 81 if (it->address.size() == net::kIPv4AddressSize) {
82 uint32 address; 82 uint32 address;
83 memcpy(&address, &it->address[0], sizeof(uint32)); 83 memcpy(&address, &it->address[0], sizeof(uint32));
84 address = rtc::NetworkToHost32(address); 84 address = rtc::NetworkToHost32(address);
85 rtc::IPAddress prefix = 85 rtc::IPAddress prefix =
86 rtc::TruncateIP(rtc::IPAddress(address), it->network_prefix); 86 rtc::TruncateIP(rtc::IPAddress(address), it->prefix_length);
87 rtc::Network* network = 87 rtc::Network* network =
88 new rtc::Network(it->name, 88 new rtc::Network(it->name, it->name, prefix, it->prefix_length,
89 it->name,
90 prefix,
91 it->network_prefix,
92 ConvertConnectionTypeToAdapterType(it->type)); 89 ConvertConnectionTypeToAdapterType(it->type));
93 network->AddIP(rtc::IPAddress(address)); 90 network->AddIP(rtc::IPAddress(address));
94 networks.push_back(network); 91 networks.push_back(network);
95 ++ipv4_interfaces; 92 ++ipv4_interfaces;
96 } else if (it->address.size() == net::kIPv6AddressSize) { 93 } else if (it->address.size() == net::kIPv6AddressSize) {
97 in6_addr address; 94 in6_addr address;
98 memcpy(&address, &it->address[0], sizeof(in6_addr)); 95 memcpy(&address, &it->address[0], sizeof(in6_addr));
99 rtc::IPAddress ip6_addr(address); 96 rtc::IPAddress ip6_addr(address);
100 if (!rtc::IPIsPrivate(ip6_addr)) { 97 if (!rtc::IPIsPrivate(ip6_addr)) {
101 rtc::IPAddress prefix = 98 rtc::IPAddress prefix =
102 rtc::TruncateIP(rtc::IPAddress(ip6_addr), it->network_prefix); 99 rtc::TruncateIP(rtc::IPAddress(ip6_addr), it->prefix_length);
103 rtc::Network* network = 100 rtc::Network* network =
104 new rtc::Network(it->name, 101 new rtc::Network(it->name, it->name, prefix, it->prefix_length,
105 it->name,
106 prefix,
107 it->network_prefix,
108 ConvertConnectionTypeToAdapterType(it->type)); 102 ConvertConnectionTypeToAdapterType(it->type));
109 network->AddIP(ip6_addr); 103 network->AddIP(ip6_addr);
110 networks.push_back(network); 104 networks.push_back(network);
111 ++ipv6_interfaces; 105 ++ipv6_interfaces;
112 } 106 }
113 } 107 }
114 } 108 }
115 109
116 110
117 // Send interface counts to UMA. 111 // Send interface counts to UMA.
(...skipping 23 matching lines...) Expand all
141 MergeNetworkList(networks, &changed); 135 MergeNetworkList(networks, &changed);
142 if (changed) 136 if (changed)
143 SignalNetworksChanged(); 137 SignalNetworksChanged();
144 } 138 }
145 139
146 void IpcNetworkManager::SendNetworksChangedSignal() { 140 void IpcNetworkManager::SendNetworksChangedSignal() {
147 SignalNetworksChanged(); 141 SignalNetworksChanged();
148 } 142 }
149 143
150 } // namespace content 144 } // namespace content
OLDNEW
« no previous file with comments | « content/common/p2p_messages.h ('k') | extensions/browser/api/socket/socket_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698