| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/browser/captive_portal/captive_portal_service.h" | 5 #include "chrome/browser/captive_portal/captive_portal_service.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 DCHECK(CalledOnValidThread()); | 202 DCHECK(CalledOnValidThread()); |
| 203 DCHECK_EQ(STATE_CHECKING_FOR_PORTAL, state_); | 203 DCHECK_EQ(STATE_CHECKING_FOR_PORTAL, state_); |
| 204 DCHECK(!TimerRunning()); | 204 DCHECK(!TimerRunning()); |
| 205 DCHECK(enabled_); | 205 DCHECK(enabled_); |
| 206 | 206 |
| 207 Result result = results.result; | 207 Result result = results.result; |
| 208 const base::TimeDelta& retry_after_delta = results.retry_after_delta; | 208 const base::TimeDelta& retry_after_delta = results.retry_after_delta; |
| 209 base::TimeTicks now = GetCurrentTimeTicks(); | 209 base::TimeTicks now = GetCurrentTimeTicks(); |
| 210 | 210 |
| 211 // Record histograms. | 211 // Record histograms. |
| 212 UMA_HISTOGRAM_ENUMERATION("CaptivePortal.DetectResult", | 212 if (!results.is_response_https || result == RESULT_INTERNET_CONNECTED) { |
| 213 result, | 213 UMA_HISTOGRAM_ENUMERATION("CaptivePortal.DetectResult", |
| 214 RESULT_COUNT); | 214 result, |
| 215 RESULT_COUNT + 2); |
| 216 } else { |
| 217 // Record HTTPS login pages separately for RESULT_NO_RESPONSE |
| 218 // and RESULT_BEHIND_CAPTIVE_PORTAL. |
| 219 UMA_HISTOGRAM_ENUMERATION("CaptivePortal.DetectResult", |
| 220 result + 2, |
| 221 RESULT_COUNT + 2); |
| 222 } |
| 215 | 223 |
| 216 // If this isn't the first captive portal result, record stats. | 224 // If this isn't the first captive portal result, record stats. |
| 217 if (!last_check_time_.is_null()) { | 225 if (!last_check_time_.is_null()) { |
| 218 UMA_HISTOGRAM_LONG_TIMES("CaptivePortal.TimeBetweenChecks", | 226 UMA_HISTOGRAM_LONG_TIMES("CaptivePortal.TimeBetweenChecks", |
| 219 now - last_check_time_); | 227 now - last_check_time_); |
| 220 | 228 |
| 221 if (last_detection_result_ != result) { | 229 if (last_detection_result_ != result) { |
| 222 // If the last result was different from the result of the latest test, | 230 // If the last result was different from the result of the latest test, |
| 223 // record histograms about the previous period over which the result was | 231 // record histograms about the previous period over which the result was |
| 224 // the same. | 232 // the same. |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 | 346 |
| 339 bool CaptivePortalService::DetectionInProgress() const { | 347 bool CaptivePortalService::DetectionInProgress() const { |
| 340 return state_ == STATE_CHECKING_FOR_PORTAL; | 348 return state_ == STATE_CHECKING_FOR_PORTAL; |
| 341 } | 349 } |
| 342 | 350 |
| 343 bool CaptivePortalService::TimerRunning() const { | 351 bool CaptivePortalService::TimerRunning() const { |
| 344 return check_captive_portal_timer_.IsRunning(); | 352 return check_captive_portal_timer_.IsRunning(); |
| 345 } | 353 } |
| 346 | 354 |
| 347 } // namespace captive_portal | 355 } // namespace captive_portal |
| OLD | NEW |