| 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_IMPL_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_DETECTOR_IMPL_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_DETECTOR_IMPL_H_ | 6 #define CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_DETECTOR_IMPL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 static const char kSessionPortalToOnlineHistogram[]; | 61 static const char kSessionPortalToOnlineHistogram[]; |
| 62 | 62 |
| 63 // Creates an instance of NetworkPortalDetectorImpl. | 63 // Creates an instance of NetworkPortalDetectorImpl. |
| 64 static void Initialize(net::URLRequestContextGetter* url_context); | 64 static void Initialize(net::URLRequestContextGetter* url_context); |
| 65 | 65 |
| 66 explicit NetworkPortalDetectorImpl( | 66 explicit NetworkPortalDetectorImpl( |
| 67 const scoped_refptr<net::URLRequestContextGetter>& request_context); | 67 const scoped_refptr<net::URLRequestContextGetter>& request_context); |
| 68 virtual ~NetworkPortalDetectorImpl(); | 68 virtual ~NetworkPortalDetectorImpl(); |
| 69 | 69 |
| 70 // NetworkPortalDetector implementation: | 70 // NetworkPortalDetector implementation: |
| 71 virtual void AddObserver(Observer* observer) OVERRIDE; | 71 virtual void AddObserver(Observer* observer) override; |
| 72 virtual void AddAndFireObserver(Observer* observer) OVERRIDE; | 72 virtual void AddAndFireObserver(Observer* observer) override; |
| 73 virtual void RemoveObserver(Observer* observer) OVERRIDE; | 73 virtual void RemoveObserver(Observer* observer) override; |
| 74 virtual CaptivePortalState GetCaptivePortalState( | 74 virtual CaptivePortalState GetCaptivePortalState( |
| 75 const std::string& guid) OVERRIDE; | 75 const std::string& guid) override; |
| 76 virtual bool IsEnabled() OVERRIDE; | 76 virtual bool IsEnabled() override; |
| 77 virtual void Enable(bool start_detection) OVERRIDE; | 77 virtual void Enable(bool start_detection) override; |
| 78 virtual bool StartDetectionIfIdle() OVERRIDE; | 78 virtual bool StartDetectionIfIdle() override; |
| 79 virtual void SetStrategy(PortalDetectorStrategy::StrategyId id) OVERRIDE; | 79 virtual void SetStrategy(PortalDetectorStrategy::StrategyId id) override; |
| 80 | 80 |
| 81 // NetworkStateHandlerObserver implementation: | 81 // NetworkStateHandlerObserver implementation: |
| 82 virtual void DefaultNetworkChanged(const NetworkState* network) OVERRIDE; | 82 virtual void DefaultNetworkChanged(const NetworkState* network) override; |
| 83 | 83 |
| 84 // PortalDetectorStrategy::Delegate implementation: | 84 // PortalDetectorStrategy::Delegate implementation: |
| 85 virtual int NoResponseResultCount() OVERRIDE; | 85 virtual int NoResponseResultCount() override; |
| 86 virtual base::TimeTicks AttemptStartTime() OVERRIDE; | 86 virtual base::TimeTicks AttemptStartTime() override; |
| 87 virtual base::TimeTicks GetCurrentTimeTicks() OVERRIDE; | 87 virtual base::TimeTicks GetCurrentTimeTicks() override; |
| 88 | 88 |
| 89 private: | 89 private: |
| 90 friend class NetworkPortalDetectorImplTest; | 90 friend class NetworkPortalDetectorImplTest; |
| 91 friend class NetworkPortalDetectorImplBrowserTest; | 91 friend class NetworkPortalDetectorImplBrowserTest; |
| 92 | 92 |
| 93 struct DetectionAttemptCompletedReport { | 93 struct DetectionAttemptCompletedReport { |
| 94 DetectionAttemptCompletedReport(); | 94 DetectionAttemptCompletedReport(); |
| 95 | 95 |
| 96 DetectionAttemptCompletedReport(const std::string network_name, | 96 DetectionAttemptCompletedReport(const std::string network_name, |
| 97 const std::string network_id, | 97 const std::string network_id, |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 // OnPortalDetectionCompleted() with RESULT_NO_RESPONSE as a result. | 136 // OnPortalDetectionCompleted() with RESULT_NO_RESPONSE as a result. |
| 137 void OnAttemptTimeout(); | 137 void OnAttemptTimeout(); |
| 138 | 138 |
| 139 // Called by CaptivePortalDetector when detection attempt completes. | 139 // Called by CaptivePortalDetector when detection attempt completes. |
| 140 void OnAttemptCompleted( | 140 void OnAttemptCompleted( |
| 141 const captive_portal::CaptivePortalDetector::Results& results); | 141 const captive_portal::CaptivePortalDetector::Results& results); |
| 142 | 142 |
| 143 // content::NotificationObserver implementation: | 143 // content::NotificationObserver implementation: |
| 144 virtual void Observe(int type, | 144 virtual void Observe(int type, |
| 145 const content::NotificationSource& source, | 145 const content::NotificationSource& source, |
| 146 const content::NotificationDetails& details) OVERRIDE; | 146 const content::NotificationDetails& details) override; |
| 147 | 147 |
| 148 // Stores captive portal state for a |network| and notifies observers. | 148 // Stores captive portal state for a |network| and notifies observers. |
| 149 void OnDetectionCompleted(const NetworkState* network, | 149 void OnDetectionCompleted(const NetworkState* network, |
| 150 const CaptivePortalState& results); | 150 const CaptivePortalState& results); |
| 151 | 151 |
| 152 // Notifies observers that portal detection is completed for a |network|. | 152 // Notifies observers that portal detection is completed for a |network|. |
| 153 void NotifyDetectionCompleted(const NetworkState* network, | 153 void NotifyDetectionCompleted(const NetworkState* network, |
| 154 const CaptivePortalState& state); | 154 const CaptivePortalState& state); |
| 155 | 155 |
| 156 State state() const { return state_; } | 156 State state() const { return state_; } |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 DetectionAttemptCompletedReport attempt_completed_report_; | 263 DetectionAttemptCompletedReport attempt_completed_report_; |
| 264 | 264 |
| 265 base::WeakPtrFactory<NetworkPortalDetectorImpl> weak_factory_; | 265 base::WeakPtrFactory<NetworkPortalDetectorImpl> weak_factory_; |
| 266 | 266 |
| 267 DISALLOW_COPY_AND_ASSIGN(NetworkPortalDetectorImpl); | 267 DISALLOW_COPY_AND_ASSIGN(NetworkPortalDetectorImpl); |
| 268 }; | 268 }; |
| 269 | 269 |
| 270 } // namespace chromeos | 270 } // namespace chromeos |
| 271 | 271 |
| 272 #endif // CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_DETECTOR_IMPL_H_ | 272 #endif // CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_DETECTOR_IMPL_H_ |
| OLD | NEW |