OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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. |
| 4 |
| 5 #ifndef CONTENT_RENDERER_P2P_EMPTY_NETWORK_MANAGER_H_ |
| 6 #define CONTENT_RENDERER_P2P_EMPTY_NETWORK_MANAGER_H_ |
| 7 |
| 8 #include "base/memory/weak_ptr.h" |
| 9 #include "base/threading/thread_checker.h" |
| 10 #include "content/common/content_export.h" |
| 11 #include "third_party/webrtc/base/network.h" |
| 12 |
| 13 namespace content { |
| 14 |
| 15 // A NetworkManager implementation which handles the case where local address |
| 16 // enumeration is not requested and just returns empty network lists. This class |
| 17 // is not thread safe and should only be used by WebRTC's worker thread. |
| 18 class EmptyNetworkManager : public rtc::NetworkManagerBase { |
| 19 public: |
| 20 // This class is created by WebRTC's signaling thread but used by WebRTC's |
| 21 // worker thread |task_runner|. |
| 22 CONTENT_EXPORT EmptyNetworkManager(); |
| 23 CONTENT_EXPORT ~EmptyNetworkManager() override; |
| 24 |
| 25 // rtc::NetworkManager: |
| 26 void StartUpdating() override; |
| 27 void StopUpdating() override; |
| 28 void GetNetworks(NetworkList* networks) const override; |
| 29 |
| 30 private: |
| 31 void FireEvent(); |
| 32 void SendNetworksChangedSignal(); |
| 33 |
| 34 base::ThreadChecker thread_checker_; |
| 35 |
| 36 // Track whether StartUpdating() has been called before. |
| 37 bool updating_started_ = false; |
| 38 |
| 39 base::WeakPtrFactory<EmptyNetworkManager> weak_ptr_factory_; |
| 40 |
| 41 DISALLOW_COPY_AND_ASSIGN(EmptyNetworkManager); |
| 42 }; |
| 43 |
| 44 } // namespace content |
| 45 |
| 46 #endif // CONTENT_RENDERER_P2P_EMPTY_NETWORK_MANAGER_H_ |
OLD | NEW |