OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CONTENT_RENDERER_P2P_IPC_NETWORK_MANAGER_H_ | 5 #ifndef CONTENT_RENDERER_P2P_IPC_NETWORK_MANAGER_H_ |
6 #define CONTENT_RENDERER_P2P_IPC_NETWORK_MANAGER_H_ | 6 #define CONTENT_RENDERER_P2P_IPC_NETWORK_MANAGER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/task.h" | 10 #include "base/task.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "content/common/content_export.h" |
12 #include "content/renderer/p2p/socket_dispatcher.h" | 13 #include "content/renderer/p2p/socket_dispatcher.h" |
13 #include "net/base/net_util.h" | 14 #include "net/base/net_util.h" |
14 #include "third_party/libjingle/source/talk/base/network.h" | 15 #include "third_party/libjingle/source/talk/base/network.h" |
15 | 16 |
16 namespace content { | 17 namespace content { |
17 | 18 |
18 // IpcNetworkManager is a NetworkManager for libjingle that gets a | 19 // IpcNetworkManager is a NetworkManager for libjingle that gets a |
19 // list of network interfaces from the browser. | 20 // list of network interfaces from the browser. |
20 class IpcNetworkManager : public talk_base::NetworkManagerBase, | 21 class IpcNetworkManager : public talk_base::NetworkManagerBase, |
21 public P2PSocketDispatcher::NetworkListObserver { | 22 public P2PSocketDispatcher::NetworkListObserver { |
22 public: | 23 public: |
23 // Constructor doesn't take ownership of the |socket_dispatcher|. | 24 // Constructor doesn't take ownership of the |socket_dispatcher|. |
24 IpcNetworkManager(P2PSocketDispatcher* socket_dispatcher); | 25 CONTENT_EXPORT IpcNetworkManager(P2PSocketDispatcher* socket_dispatcher); |
25 virtual ~IpcNetworkManager(); | 26 virtual ~IpcNetworkManager(); |
26 | 27 |
27 virtual void StartUpdating() OVERRIDE; | 28 virtual void StartUpdating() OVERRIDE; |
28 virtual void StopUpdating() OVERRIDE; | 29 virtual void StopUpdating() OVERRIDE; |
29 | 30 |
30 // P2PSocketDispatcher::NetworkListObserver interface. | 31 // P2PSocketDispatcher::NetworkListObserver interface. |
31 virtual void OnNetworkListChanged( | 32 virtual void OnNetworkListChanged( |
32 const net::NetworkInterfaceList& list) OVERRIDE; | 33 const net::NetworkInterfaceList& list) OVERRIDE; |
33 | 34 |
34 private: | 35 private: |
35 void SendNetworksChangedSignal(); | 36 void SendNetworksChangedSignal(); |
36 | 37 |
37 MessageLoop* message_loop_; | 38 MessageLoop* message_loop_; |
38 P2PSocketDispatcher* socket_dispatcher_; | 39 P2PSocketDispatcher* socket_dispatcher_; |
39 bool started_; | 40 bool started_; |
40 bool first_update_sent_; | 41 bool first_update_sent_; |
41 | 42 |
42 ScopedRunnableMethodFactory<IpcNetworkManager> task_factory_; | 43 ScopedRunnableMethodFactory<IpcNetworkManager> task_factory_; |
43 }; | 44 }; |
44 | 45 |
45 } // namespace content | 46 } // namespace content |
46 | 47 |
47 #endif // CONTENT_RENDERER_P2P_IPC_NETWORK_MANAGER_H_ | 48 #endif // CONTENT_RENDERER_P2P_IPC_NETWORK_MANAGER_H_ |
OLD | NEW |