| 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 #ifndef REMOTING_CLIENT_PLUGIN_PEPPER_NETWORK_MANAGER_H_ | 5 #ifndef REMOTING_CLIENT_PLUGIN_PEPPER_NETWORK_MANAGER_H_ |
| 6 #define REMOTING_CLIENT_PLUGIN_PEPPER_NETWORK_MANAGER_H_ | 6 #define REMOTING_CLIENT_PLUGIN_PEPPER_NETWORK_MANAGER_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "ppapi/cpp/instance_handle.h" | 10 #include "ppapi/cpp/instance_handle.h" |
| 11 #include "ppapi/cpp/network_monitor.h" | 11 #include "ppapi/cpp/network_monitor.h" |
| 12 #include "ppapi/utility/completion_callback_factory.h" | 12 #include "ppapi/utility/completion_callback_factory.h" |
| 13 #include "third_party/webrtc/base/network.h" | 13 #include "third_party/webrtc/base/network.h" |
| 14 | 14 |
| 15 namespace pp { | 15 namespace pp { |
| 16 class NetworkList; | 16 class NetworkList; |
| 17 } // namespace pp | 17 } // namespace pp |
| 18 | 18 |
| 19 namespace remoting { | 19 namespace remoting { |
| 20 | 20 |
| 21 // PepperNetworkManager uses the PPB_NetworkMonitor API to | 21 // PepperNetworkManager uses the PPB_NetworkMonitor API to |
| 22 // implement the NetworkManager interface that libjingle uses to | 22 // implement the NetworkManager interface that libjingle uses to |
| 23 // monitor the host system's network interfaces. | 23 // monitor the host system's network interfaces. |
| 24 class PepperNetworkManager : public rtc::NetworkManagerBase { | 24 class PepperNetworkManager : public rtc::NetworkManagerBase { |
| 25 public: | 25 public: |
| 26 PepperNetworkManager(const pp::InstanceHandle& instance); | 26 PepperNetworkManager(const pp::InstanceHandle& instance); |
| 27 virtual ~PepperNetworkManager(); | 27 ~PepperNetworkManager() override; |
| 28 | 28 |
| 29 // NetworkManager interface. | 29 // NetworkManager interface. |
| 30 virtual void StartUpdating() override; | 30 void StartUpdating() override; |
| 31 virtual void StopUpdating() override; | 31 void StopUpdating() override; |
| 32 | 32 |
| 33 private: | 33 private: |
| 34 static void OnNetworkListCallbackHandler(void* user_data, | 34 static void OnNetworkListCallbackHandler(void* user_data, |
| 35 PP_Resource list_resource); | 35 PP_Resource list_resource); |
| 36 | 36 |
| 37 void OnNetworkList(int32_t result, const pp::NetworkList& list); | 37 void OnNetworkList(int32_t result, const pp::NetworkList& list); |
| 38 | 38 |
| 39 void SendNetworksChangedSignal(); | 39 void SendNetworksChangedSignal(); |
| 40 | 40 |
| 41 pp::NetworkMonitor monitor_; | 41 pp::NetworkMonitor monitor_; |
| 42 int start_count_; | 42 int start_count_; |
| 43 bool network_list_received_; | 43 bool network_list_received_; |
| 44 | 44 |
| 45 pp::CompletionCallbackFactory<PepperNetworkManager> callback_factory_; | 45 pp::CompletionCallbackFactory<PepperNetworkManager> callback_factory_; |
| 46 | 46 |
| 47 base::WeakPtrFactory<PepperNetworkManager> weak_factory_; | 47 base::WeakPtrFactory<PepperNetworkManager> weak_factory_; |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 } // namespace remoting | 50 } // namespace remoting |
| 51 | 51 |
| 52 #endif // REMOTING_CLIENT_PLUGIN_PEPPER_NETWORK_MANAGER_H_ | 52 #endif // REMOTING_CLIENT_PLUGIN_PEPPER_NETWORK_MANAGER_H_ |
| OLD | NEW |