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