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

Unified Diff: remoting/client/plugin/pepper_network_manager.cc

Issue 23806003: Use PP_ArrayOutput and PPB_NetAddress in PPB_NetworkList_Private.. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/thunk/ppb_network_list_private_thunk.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/client/plugin/pepper_network_manager.cc
diff --git a/remoting/client/plugin/pepper_network_manager.cc b/remoting/client/plugin/pepper_network_manager.cc
index afe79a00419098765a497a7ae976c88a63791b22..d4fa68f5dd1d166ed0f71a2b7b67b38d709963c3 100644
--- a/remoting/client/plugin/pepper_network_manager.cc
+++ b/remoting/client/plugin/pepper_network_manager.cc
@@ -9,8 +9,10 @@
#include "base/single_thread_task_runner.h"
#include "base/thread_task_runner_handle.h"
#include "ppapi/cpp/module.h"
+#include "ppapi/cpp/net_address.h"
#include "ppapi/cpp/private/network_list_private.h"
-#include "ppapi/cpp/private/net_address_private.h"
+#include "remoting/client/plugin/pepper_util.h"
+#include "third_party/libjingle/source/talk/base/socketaddress.h"
namespace remoting {
@@ -56,47 +58,21 @@ void PepperNetworkManager::OnNetworkList(const pp::NetworkListPrivate& list) {
std::vector<talk_base::Network*> networks;
size_t count = list.GetCount();
for (size_t i = 0; i < count; i++) {
- std::vector<PP_NetAddress_Private> addresses;
+ std::vector<pp::NetAddress> addresses;
list.GetIpAddresses(i, &addresses);
if (addresses.size() == 0)
continue;
- char address_bytes[sizeof(in6_addr)];
- if (!pp::NetAddressPrivate::GetAddress(
- addresses[0], &address_bytes, sizeof(address_bytes))) {
- LOG(ERROR) << "Failed to get address for network interface.";
- continue;
- }
+ talk_base::Network* network = new talk_base::Network(
+ list.GetName(i), list.GetDisplayName(i), talk_base::IPAddress(), 0);
- int prefix_length;
-
- // TODO(sergeyu): Copy all addresses, not only the first one.
- talk_base::IPAddress address;
- switch (pp::NetAddressPrivate::GetFamily(addresses[0])) {
- case PP_NETADDRESSFAMILY_PRIVATE_IPV4: {
- in_addr* address_ipv4 = reinterpret_cast<in_addr*>(address_bytes);
- address = talk_base::IPAddress(*address_ipv4);
- prefix_length = sizeof(in_addr) * 8;
- break;
- }
-
- case PP_NETADDRESSFAMILY_PRIVATE_IPV6: {
- in6_addr* address_ipv6 = reinterpret_cast<in6_addr*>(address_bytes);
- address = talk_base::IPAddress(*address_ipv6);
- prefix_length = sizeof(in6_addr) * 8;
- break;
- }
-
- default:
- LOG(WARNING) << "Skipping address with unknown family: "
- << pp::NetAddressPrivate::GetFamily(addresses[0]);
- continue;
+ for (size_t i = 0; i < addresses.size(); ++i) {
+ talk_base::SocketAddress address;
+ PpNetAddressToSocketAddress(addresses[i], &address);
+ network->AddIP(address.ipaddr());
}
- talk_base::Network* network = new talk_base::Network(
- list.GetName(i), list.GetDisplayName(i), address, prefix_length);
- network->AddIP(address);
networks.push_back(network);
}
« no previous file with comments | « ppapi/thunk/ppb_network_list_private_thunk.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698