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

Side by Side Diff: webrtc/base/fakenetwork.h

Issue 1411253008: WebRTC should generate default private address even when adapter enumeration is disabled. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: after rebase on master Created 5 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 | « talk/app/webrtc/webrtcsession.cc ('k') | webrtc/base/ipaddress.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2009 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2009 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 } 69 }
70 70
71 virtual void StopUpdating() { --start_count_; } 71 virtual void StopUpdating() { --start_count_; }
72 72
73 // MessageHandler interface. 73 // MessageHandler interface.
74 virtual void OnMessage(Message* msg) { 74 virtual void OnMessage(Message* msg) {
75 DoUpdateNetworks(); 75 DoUpdateNetworks();
76 } 76 }
77 77
78 using NetworkManagerBase::set_enumeration_permission; 78 using NetworkManagerBase::set_enumeration_permission;
79 using NetworkManagerBase::set_default_local_addresses;
79 80
80 private: 81 private:
81 void DoUpdateNetworks() { 82 void DoUpdateNetworks() {
82 if (start_count_ == 0) 83 if (start_count_ == 0)
83 return; 84 return;
84 std::vector<Network*> networks; 85 std::vector<Network*> networks;
85 for (IfaceList::iterator it = ifaces_.begin(); 86 for (IfaceList::iterator it = ifaces_.begin();
86 it != ifaces_.end(); ++it) { 87 it != ifaces_.end(); ++it) {
87 int prefix_length = 0; 88 int prefix_length = 0;
88 if (it->ipaddr().family() == AF_INET) { 89 if (it->ipaddr().family() == AF_INET) {
89 prefix_length = kFakeIPv4NetworkPrefixLength; 90 prefix_length = kFakeIPv4NetworkPrefixLength;
90 } else if (it->ipaddr().family() == AF_INET6) { 91 } else if (it->ipaddr().family() == AF_INET6) {
91 prefix_length = kFakeIPv6NetworkPrefixLength; 92 prefix_length = kFakeIPv6NetworkPrefixLength;
92 } 93 }
93 IPAddress prefix = TruncateIP(it->ipaddr(), prefix_length); 94 IPAddress prefix = TruncateIP(it->ipaddr(), prefix_length);
94 scoped_ptr<Network> net(new Network(it->hostname(), 95 scoped_ptr<Network> net(new Network(it->hostname(),
95 it->hostname(), 96 it->hostname(),
96 prefix, 97 prefix,
97 prefix_length)); 98 prefix_length));
99 net->set_default_local_address_provider(this);
98 net->AddIP(it->ipaddr()); 100 net->AddIP(it->ipaddr());
99 networks.push_back(net.release()); 101 networks.push_back(net.release());
100 } 102 }
101 bool changed; 103 bool changed;
102 MergeNetworkList(networks, &changed); 104 MergeNetworkList(networks, &changed);
103 if (changed || !sent_first_update_) { 105 if (changed || !sent_first_update_) {
104 SignalNetworksChanged(); 106 SignalNetworksChanged();
105 sent_first_update_ = true; 107 sent_first_update_ = true;
106 } 108 }
107 } 109 }
108 110
109 Thread* thread_; 111 Thread* thread_;
110 IfaceList ifaces_; 112 IfaceList ifaces_;
111 int next_index_ = 0; 113 int next_index_ = 0;
112 int start_count_ = 0; 114 int start_count_ = 0;
113 bool sent_first_update_ = false; 115 bool sent_first_update_ = false;
116
117 IPAddress default_local_ipv4_address_;
118 IPAddress default_local_ipv6_address_;
114 }; 119 };
115 120
116 } // namespace rtc 121 } // namespace rtc
117 122
118 #endif // WEBRTC_BASE_FAKENETWORK_H_ 123 #endif // WEBRTC_BASE_FAKENETWORK_H_
OLDNEW
« no previous file with comments | « talk/app/webrtc/webrtcsession.cc ('k') | webrtc/base/ipaddress.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698