| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_DETECTOR_STUB_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_DETECTOR_STUB_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_DETECTOR_STUB_H_ | 6 #define CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_DETECTOR_STUB_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/hash_tables.h" | 12 #include "base/hash_tables.h" |
| 13 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
| 14 #include "chrome/browser/chromeos/net/network_portal_detector.h" | 14 #include "chrome/browser/chromeos/net/network_portal_detector.h" |
| 15 | 15 |
| 16 namespace chromeos { | 16 namespace chromeos { |
| 17 | 17 |
| 18 class NetworkPortalDetectorStub : public NetworkPortalDetector { | 18 class NetworkPortalDetectorStub : public NetworkPortalDetector { |
| 19 public: | 19 public: |
| 20 NetworkPortalDetectorStub(); | 20 NetworkPortalDetectorStub(); |
| 21 virtual ~NetworkPortalDetectorStub(); | 21 virtual ~NetworkPortalDetectorStub(); |
| 22 | 22 |
| 23 // NetworkPortalDetector implementation: | 23 // NetworkPortalDetector implementation: |
| 24 virtual void Init() OVERRIDE; | 24 virtual void Init() OVERRIDE; |
| 25 virtual void Shutdown() OVERRIDE; | 25 virtual void Shutdown() OVERRIDE; |
| 26 virtual void AddObserver(Observer* observer) OVERRIDE; | 26 virtual void AddObserver(Observer* observer) OVERRIDE; |
| 27 virtual void AddAndFireObserver(Observer* observer) OVERRIDE; | 27 virtual void AddAndFireObserver(Observer* observer) OVERRIDE; |
| 28 virtual void RemoveObserver(Observer* observer) OVERRIDE; | 28 virtual void RemoveObserver(Observer* observer) OVERRIDE; |
| 29 virtual CaptivePortalState GetCaptivePortalState( | 29 virtual CaptivePortalState GetCaptivePortalState( |
| 30 const chromeos::Network* network) OVERRIDE; | 30 const chromeos::NetworkState* network) OVERRIDE; |
| 31 virtual bool IsEnabled() OVERRIDE; | 31 virtual bool IsEnabled() OVERRIDE; |
| 32 virtual void Enable(bool start_detection) OVERRIDE; | 32 virtual void Enable(bool start_detection) OVERRIDE; |
| 33 virtual void EnableLazyDetection() OVERRIDE; | 33 virtual void EnableLazyDetection() OVERRIDE; |
| 34 virtual void DisableLazyDetection() OVERRIDE; | 34 virtual void DisableLazyDetection() OVERRIDE; |
| 35 | 35 |
| 36 private: | 36 private: |
| 37 friend class UpdateScreenTest; | 37 friend class UpdateScreenTest; |
| 38 | 38 |
| 39 typedef std::string NetworkId; | 39 typedef std::string NetworkId; |
| 40 typedef base::hash_map<NetworkId, CaptivePortalState> CaptivePortalStateMap; | 40 typedef base::hash_map<NetworkId, CaptivePortalState> CaptivePortalStateMap; |
| 41 | 41 |
| 42 void SetActiveNetworkForTesting(const Network* network); | 42 void SetDefaultNetworkForTesting(const NetworkState* network); |
| 43 void SetDetectionResultsForTesting(const Network* network, | 43 void SetDetectionResultsForTesting(const NetworkState* network, |
| 44 const CaptivePortalState& state); | 44 const CaptivePortalState& state); |
| 45 void NotifyObserversForTesting(); | 45 void NotifyObserversForTesting(); |
| 46 | 46 |
| 47 ObserverList<Observer> observers_; | 47 ObserverList<Observer> observers_; |
| 48 const Network* active_network_; | 48 const NetworkState* default_network_; |
| 49 CaptivePortalStateMap portal_state_map_; | 49 CaptivePortalStateMap portal_state_map_; |
| 50 | 50 |
| 51 DISALLOW_COPY_AND_ASSIGN(NetworkPortalDetectorStub); | 51 DISALLOW_COPY_AND_ASSIGN(NetworkPortalDetectorStub); |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 } // namespace chromeos | 54 } // namespace chromeos |
| 55 | 55 |
| 56 #endif // CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_DETECTOR_STUB_H_ | 56 #endif // CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_DETECTOR_STUB_H_ |
| OLD | NEW |