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_PROTOCOL_PEPPER_NETWORK_MANAGER_H_ | 5 #ifndef REMOTING_CLIENT_PLUGIN_PEPPER_NETWORK_MANAGER_H_ |
6 #define REMOTING_PROTOCOL_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/private/network_monitor_private.h" | 11 #include "ppapi/cpp/private/network_monitor_private.h" |
12 #include "third_party/libjingle/source/talk/base/network.h" | 12 #include "third_party/libjingle/source/talk/base/network.h" |
13 | 13 |
14 namespace pp { | 14 namespace pp { |
15 class NetworkListPrivate; | 15 class NetworkListPrivate; |
16 } // namespace pp | 16 } // namespace pp |
17 | 17 |
18 namespace remoting { | 18 namespace remoting { |
19 namespace protocol { | |
20 | 19 |
21 // PepperNetworkManager uses the PPB_NetworkMonitor_Private API to | 20 // PepperNetworkManager uses the PPB_NetworkMonitor_Private API to |
22 // implement the NetworkManager interface that libjingle uses to | 21 // implement the NetworkManager interface that libjingle uses to |
23 // monitor the host system's network interfaces. | 22 // monitor the host system's network interfaces. |
24 class PepperNetworkManager : public talk_base::NetworkManagerBase { | 23 class PepperNetworkManager : public talk_base::NetworkManagerBase { |
25 public: | 24 public: |
26 PepperNetworkManager(const pp::InstanceHandle& instance); | 25 PepperNetworkManager(const pp::InstanceHandle& instance); |
27 virtual ~PepperNetworkManager(); | 26 virtual ~PepperNetworkManager(); |
28 | 27 |
29 // NetworkManager interface. | 28 // NetworkManager interface. |
30 virtual void StartUpdating() OVERRIDE; | 29 virtual void StartUpdating() OVERRIDE; |
31 virtual void StopUpdating() OVERRIDE; | 30 virtual void StopUpdating() OVERRIDE; |
32 | 31 |
33 private: | 32 private: |
34 static void OnNetworkListCallbackHandler(void* user_data, | 33 static void OnNetworkListCallbackHandler(void* user_data, |
35 PP_Resource list_resource); | 34 PP_Resource list_resource); |
36 | 35 |
37 void OnNetworkList(const pp::NetworkListPrivate& list); | 36 void OnNetworkList(const pp::NetworkListPrivate& list); |
38 | 37 |
39 void SendNetworksChangedSignal(); | 38 void SendNetworksChangedSignal(); |
40 | 39 |
41 pp::NetworkMonitorPrivate monitor_; | 40 pp::NetworkMonitorPrivate monitor_; |
42 int start_count_; | 41 int start_count_; |
43 bool network_list_received_; | 42 bool network_list_received_; |
44 | 43 |
45 base::WeakPtrFactory<PepperNetworkManager> weak_factory_; | 44 base::WeakPtrFactory<PepperNetworkManager> weak_factory_; |
46 }; | 45 }; |
47 | 46 |
48 } // namespace protocol | |
49 } // namespace remoting | 47 } // namespace remoting |
50 | 48 |
51 #endif // REMOTING_PROTOCOL_PEPPER_NETWORK_MANAGER_H_ | 49 #endif // REMOTING_CLIENT_PLUGIN_PEPPER_NETWORK_MANAGER_H_ |
OLD | NEW |