| 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 <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 | 77 |
| 78 using CaptivePortalStateMap = base::hash_map<std::string, CaptivePortalState>; | 78 using CaptivePortalStateMap = base::hash_map<std::string, CaptivePortalState>; |
| 79 | 79 |
| 80 enum State { | 80 enum State { |
| 81 // No portal check is running. | 81 // No portal check is running. |
| 82 STATE_IDLE = 0, | 82 STATE_IDLE = 0, |
| 83 // Waiting for portal check. | 83 // Waiting for portal check. |
| 84 STATE_PORTAL_CHECK_PENDING, | 84 STATE_PORTAL_CHECK_PENDING, |
| 85 // Portal check is in progress. | 85 // Portal check is in progress. |
| 86 STATE_CHECKING_FOR_PORTAL, | 86 STATE_CHECKING_FOR_PORTAL, |
| 87 // No portal check when successfully behind portal. |
| 88 STATE_BEHIND_PORTAL_IDLE, |
| 87 }; | 89 }; |
| 88 | 90 |
| 89 struct DetectionAttemptCompletedReport { | 91 struct DetectionAttemptCompletedReport { |
| 90 DetectionAttemptCompletedReport(); | 92 DetectionAttemptCompletedReport(); |
| 91 | 93 |
| 92 DetectionAttemptCompletedReport(const std::string network_name, | 94 DetectionAttemptCompletedReport(const std::string network_name, |
| 93 const std::string network_id, | 95 const std::string network_id, |
| 94 captive_portal::CaptivePortalResult result, | 96 captive_portal::CaptivePortalResult result, |
| 95 int response_code); | 97 int response_code); |
| 96 | 98 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 | 165 |
| 164 bool is_idle() const { | 166 bool is_idle() const { |
| 165 return state_ == STATE_IDLE; | 167 return state_ == STATE_IDLE; |
| 166 } | 168 } |
| 167 bool is_portal_check_pending() const { | 169 bool is_portal_check_pending() const { |
| 168 return state_ == STATE_PORTAL_CHECK_PENDING; | 170 return state_ == STATE_PORTAL_CHECK_PENDING; |
| 169 } | 171 } |
| 170 bool is_checking_for_portal() const { | 172 bool is_checking_for_portal() const { |
| 171 return state_ == STATE_CHECKING_FOR_PORTAL; | 173 return state_ == STATE_CHECKING_FOR_PORTAL; |
| 172 } | 174 } |
| 175 bool is_behind_portal_idle() const { |
| 176 return state_ == STATE_BEHIND_PORTAL_IDLE; |
| 177 } |
| 173 | 178 |
| 174 int same_detection_result_count_for_testing() const { | 179 int same_detection_result_count_for_testing() const { |
| 175 return same_detection_result_count_; | 180 return same_detection_result_count_; |
| 176 } | 181 } |
| 177 | 182 |
| 178 int no_response_result_count_for_testing() const { | 183 int no_response_result_count_for_testing() const { |
| 179 return no_response_result_count_; | 184 return no_response_result_count_; |
| 180 } | 185 } |
| 181 | 186 |
| 182 void set_no_response_result_count_for_testing(int count) { | 187 void set_no_response_result_count_for_testing(int count) { |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 DetectionAttemptCompletedReport attempt_completed_report_; | 280 DetectionAttemptCompletedReport attempt_completed_report_; |
| 276 | 281 |
| 277 base::WeakPtrFactory<NetworkPortalDetectorImpl> weak_factory_; | 282 base::WeakPtrFactory<NetworkPortalDetectorImpl> weak_factory_; |
| 278 | 283 |
| 279 DISALLOW_COPY_AND_ASSIGN(NetworkPortalDetectorImpl); | 284 DISALLOW_COPY_AND_ASSIGN(NetworkPortalDetectorImpl); |
| 280 }; | 285 }; |
| 281 | 286 |
| 282 } // namespace chromeos | 287 } // namespace chromeos |
| 283 | 288 |
| 284 #endif // CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_DETECTOR_IMPL_H_ | 289 #endif // CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_DETECTOR_IMPL_H_ |
| OLD | NEW |