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 JINGLE_GLUE_FAKE_NETWORK_MANAGER_H_ | 5 #ifndef JINGLE_GLUE_FAKE_NETWORK_MANAGER_H_ |
6 #define JINGLE_GLUE_FAKE_NETWORK_MANAGER_H_ | 6 #define JINGLE_GLUE_FAKE_NETWORK_MANAGER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.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 jingle_glue { | 16 namespace jingle_glue { |
17 | 17 |
18 // FakeNetworkManager always returns one interface with the IP address | 18 // FakeNetworkManager always returns one interface with the IP address |
19 // specified in the constructor. | 19 // specified in the constructor. |
20 class FakeNetworkManager : public talk_base::NetworkManager { | 20 class FakeNetworkManager : public talk_base::NetworkManager { |
21 public: | 21 public: |
22 FakeNetworkManager(const net::IPAddressNumber& address); | 22 explicit FakeNetworkManager(const net::IPAddressNumber& address); |
23 virtual ~FakeNetworkManager(); | 23 virtual ~FakeNetworkManager(); |
24 | 24 |
25 // talk_base::NetworkManager interface. | 25 // talk_base::NetworkManager interface. |
26 virtual void StartUpdating() OVERRIDE; | 26 virtual void StartUpdating() OVERRIDE; |
27 virtual void StopUpdating() OVERRIDE; | 27 virtual void StopUpdating() OVERRIDE; |
28 virtual void GetNetworks(NetworkList* networks) const OVERRIDE; | 28 virtual void GetNetworks(NetworkList* networks) const OVERRIDE; |
29 | 29 |
30 protected: | 30 protected: |
31 void SendNetworksChangedSignal(); | 31 void SendNetworksChangedSignal(); |
32 | 32 |
33 bool started_; | 33 bool started_; |
34 scoped_ptr<talk_base::Network> network_; | 34 scoped_ptr<talk_base::Network> network_; |
35 | 35 |
36 base::WeakPtrFactory<FakeNetworkManager> weak_factory_; | 36 base::WeakPtrFactory<FakeNetworkManager> weak_factory_; |
37 }; | 37 }; |
38 | 38 |
39 } // namespace jingle_glue | 39 } // namespace jingle_glue |
40 | 40 |
41 #endif // JINGLE_GLUE_FAKE_NETWORK_MANAGER_H_ | 41 #endif // JINGLE_GLUE_FAKE_NETWORK_MANAGER_H_ |
OLD | NEW |