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 "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" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 addresses[0], &address_bytes, sizeof(address_bytes))) { | 67 addresses[0], &address_bytes, sizeof(address_bytes))) { |
68 LOG(ERROR) << "Failed to get address for network interface."; | 68 LOG(ERROR) << "Failed to get address for network interface."; |
69 continue; | 69 continue; |
70 } | 70 } |
71 | 71 |
72 int prefix_length; | 72 int prefix_length; |
73 | 73 |
74 // TODO(sergeyu): Copy all addresses, not only the first one. | 74 // TODO(sergeyu): Copy all addresses, not only the first one. |
75 talk_base::IPAddress address; | 75 talk_base::IPAddress address; |
76 switch (pp::NetAddressPrivate::GetFamily(addresses[0])) { | 76 switch (pp::NetAddressPrivate::GetFamily(addresses[0])) { |
77 case PP_NETADDRESSFAMILY_IPV4: { | 77 case PP_NETADDRESSFAMILY_PRIVATE_IPV4: { |
78 in_addr* address_ipv4 = reinterpret_cast<in_addr*>(address_bytes); | 78 in_addr* address_ipv4 = reinterpret_cast<in_addr*>(address_bytes); |
79 address = talk_base::IPAddress(*address_ipv4); | 79 address = talk_base::IPAddress(*address_ipv4); |
80 prefix_length = sizeof(in_addr) * 8; | 80 prefix_length = sizeof(in_addr) * 8; |
81 break; | 81 break; |
82 } | 82 } |
83 | 83 |
84 case PP_NETADDRESSFAMILY_IPV6: { | 84 case PP_NETADDRESSFAMILY_PRIVATE_IPV6: { |
85 in6_addr* address_ipv6 = reinterpret_cast<in6_addr*>(address_bytes); | 85 in6_addr* address_ipv6 = reinterpret_cast<in6_addr*>(address_bytes); |
86 address = talk_base::IPAddress(*address_ipv6); | 86 address = talk_base::IPAddress(*address_ipv6); |
87 prefix_length = sizeof(in6_addr) * 8; | 87 prefix_length = sizeof(in6_addr) * 8; |
88 break; | 88 break; |
89 } | 89 } |
90 | 90 |
91 default: | 91 default: |
92 LOG(WARNING) << "Skipping address with unknown family: " | 92 LOG(WARNING) << "Skipping address with unknown family: " |
93 << pp::NetAddressPrivate::GetFamily(addresses[0]); | 93 << pp::NetAddressPrivate::GetFamily(addresses[0]); |
94 continue; | 94 continue; |
95 } | 95 } |
96 | 96 |
97 talk_base::Network* network = new talk_base::Network( | 97 talk_base::Network* network = new talk_base::Network( |
98 list.GetName(i), list.GetDisplayName(i), address, prefix_length); | 98 list.GetName(i), list.GetDisplayName(i), address, prefix_length); |
99 network->AddIP(address); | 99 network->AddIP(address); |
100 networks.push_back(network); | 100 networks.push_back(network); |
101 } | 101 } |
102 | 102 |
103 bool changed = false; | 103 bool changed = false; |
104 MergeNetworkList(networks, &changed); | 104 MergeNetworkList(networks, &changed); |
105 if (changed) | 105 if (changed) |
106 SignalNetworksChanged(); | 106 SignalNetworksChanged(); |
107 } | 107 } |
108 | 108 |
109 void PepperNetworkManager::SendNetworksChangedSignal() { | 109 void PepperNetworkManager::SendNetworksChangedSignal() { |
110 SignalNetworksChanged(); | 110 SignalNetworksChanged(); |
111 } | 111 } |
112 | 112 |
113 } // namespace remoting | 113 } // namespace remoting |
OLD | NEW |