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