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

Side by Side Diff: remoting/client/plugin/pepper_network_manager.cc

Issue 435823002: Revert "Update webrtc&libjingle 6774:6799." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 months 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
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 "remoting/client/plugin/pepper_network_manager.h" 5 #include "remoting/client/plugin/pepper_network_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/thread_task_runner_handle.h" 10 #include "base/thread_task_runner_handle.h"
11 #include "ppapi/cpp/module.h" 11 #include "ppapi/cpp/module.h"
12 #include "ppapi/cpp/net_address.h" 12 #include "ppapi/cpp/net_address.h"
13 #include "ppapi/cpp/network_list.h" 13 #include "ppapi/cpp/network_list.h"
14 #include "remoting/client/plugin/pepper_util.h" 14 #include "remoting/client/plugin/pepper_util.h"
15 #include "third_party/webrtc/base/socketaddress.h" 15 #include "third_party/libjingle/source/talk/base/socketaddress.h"
16 16
17 namespace remoting { 17 namespace remoting {
18 18
19 PepperNetworkManager::PepperNetworkManager(const pp::InstanceHandle& instance) 19 PepperNetworkManager::PepperNetworkManager(const pp::InstanceHandle& instance)
20 : monitor_(instance), 20 : monitor_(instance),
21 start_count_(0), 21 start_count_(0),
22 network_list_received_(false), 22 network_list_received_(false),
23 callback_factory_(this), 23 callback_factory_(this),
24 weak_factory_(this) { 24 weak_factory_(this) {
25 pp::CompletionCallbackWithOutput<pp::NetworkList> callback = 25 pp::CompletionCallbackWithOutput<pp::NetworkList> callback =
(...skipping 30 matching lines...) Expand all
56 DCHECK(!list.is_null()); 56 DCHECK(!list.is_null());
57 57
58 network_list_received_ = true; 58 network_list_received_ = true;
59 59
60 // Request for the next update. 60 // Request for the next update.
61 pp::CompletionCallbackWithOutput<pp::NetworkList> callback = 61 pp::CompletionCallbackWithOutput<pp::NetworkList> callback =
62 callback_factory_.NewCallbackWithOutput( 62 callback_factory_.NewCallbackWithOutput(
63 &PepperNetworkManager::OnNetworkList); 63 &PepperNetworkManager::OnNetworkList);
64 monitor_.UpdateNetworkList(callback); 64 monitor_.UpdateNetworkList(callback);
65 65
66 // Convert the networks to rtc::Network. 66 // Convert the networks to talk_base::Network.
67 std::vector<rtc::Network*> networks; 67 std::vector<talk_base::Network*> networks;
68 size_t count = list.GetCount(); 68 size_t count = list.GetCount();
69 for (size_t i = 0; i < count; i++) { 69 for (size_t i = 0; i < count; i++) {
70 std::vector<pp::NetAddress> addresses; 70 std::vector<pp::NetAddress> addresses;
71 list.GetIpAddresses(i, &addresses); 71 list.GetIpAddresses(i, &addresses);
72 72
73 if (addresses.size() == 0) 73 if (addresses.size() == 0)
74 continue; 74 continue;
75 75
76 for (size_t i = 0; i < addresses.size(); ++i) { 76 for (size_t i = 0; i < addresses.size(); ++i) {
77 rtc::SocketAddress address; 77 talk_base::SocketAddress address;
78 PpNetAddressToSocketAddress(addresses[i], &address); 78 PpNetAddressToSocketAddress(addresses[i], &address);
79 79
80 if (address.family() == AF_INET6 && IPIsSiteLocal(address.ipaddr())) { 80 if (address.family() == AF_INET6 && IPIsSiteLocal(address.ipaddr())) {
81 // Link-local IPv6 addresses can't be bound via the current PPAPI 81 // Link-local IPv6 addresses can't be bound via the current PPAPI
82 // Bind() interface as designed (see crbug.com/384854); trying to do so 82 // Bind() interface as designed (see crbug.com/384854); trying to do so
83 // would fail. 83 // would fail.
84 continue; 84 continue;
85 } 85 }
86 86
87 rtc::Network* network = new rtc::Network( 87 talk_base::Network* network = new talk_base::Network(
88 list.GetName(i), list.GetDisplayName(i), address.ipaddr(), 0); 88 list.GetName(i), list.GetDisplayName(i), address.ipaddr(), 0);
89 network->AddIP(address.ipaddr()); 89 network->AddIP(address.ipaddr());
90 networks.push_back(network); 90 networks.push_back(network);
91 } 91 }
92 } 92 }
93 93
94 bool changed = false; 94 bool changed = false;
95 MergeNetworkList(networks, &changed); 95 MergeNetworkList(networks, &changed);
96 if (changed) 96 if (changed)
97 SignalNetworksChanged(); 97 SignalNetworksChanged();
98 } 98 }
99 99
100 void PepperNetworkManager::SendNetworksChangedSignal() { 100 void PepperNetworkManager::SendNetworksChangedSignal() {
101 SignalNetworksChanged(); 101 SignalNetworksChanged();
102 } 102 }
103 103
104 } // namespace remoting 104 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/client/plugin/pepper_network_manager.h ('k') | remoting/client/plugin/pepper_packet_socket_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698