Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / content / renderer / p2p / ipc_network_manager.h
blob81f673cdffe377843c8151bdc1cf270f79c27be0
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_RENDERER_P2P_IPC_NETWORK_MANAGER_H_
6 #define CONTENT_RENDERER_P2P_IPC_NETWORK_MANAGER_H_
8 #include <vector>
10 #include "base/compiler_specific.h"
11 #include "base/memory/weak_ptr.h"
12 #include "content/common/content_export.h"
13 #include "content/renderer/p2p/network_list_manager.h"
14 #include "content/renderer/p2p/network_list_observer.h"
15 #include "third_party/webrtc/base/network.h"
17 namespace content {
19 // IpcNetworkManager is a NetworkManager for libjingle that gets a
20 // list of network interfaces from the browser.
21 class IpcNetworkManager : public rtc::NetworkManagerBase,
22 public NetworkListObserver {
23 public:
24 // Constructor doesn't take ownership of the |network_list_manager|.
25 CONTENT_EXPORT IpcNetworkManager(NetworkListManager* network_list_manager);
26 ~IpcNetworkManager() override;
28 void StartUpdating() override;
29 void StopUpdating() override;
31 // P2PSocketDispatcher::NetworkListObserver interface.
32 void OnNetworkListChanged(const net::NetworkInterfaceList& list) override;
34 private:
35 void SendNetworksChangedSignal();
37 NetworkListManager* network_list_manager_;
38 int start_count_;
39 bool network_list_received_;
41 base::WeakPtrFactory<IpcNetworkManager> weak_factory_;
44 } // namespace content
46 #endif // CONTENT_RENDERER_P2P_IPC_NETWORK_MANAGER_H_