Chromium Code Reviews| 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.landing_url.SchemeIs("https") || |
| 213 result, | 213 result == RESULT_INTERNET_CONNECTED) { |
| 214 RESULT_COUNT); | 214 UMA_HISTOGRAM_ENUMERATION("CaptivePortal.DetectResult", |
| 215 result, | |
| 216 RESULT_COUNT + 2); | |
| 217 } else { | |
| 218 // Record HTTPS login pages separately for RESULT_NO_RESPONSE | |
| 219 // and RESULT_BEHIND_CAPTIVE_PORTAL. | |
| 220 UMA_HISTOGRAM_ENUMERATION("CaptivePortal.DetectResult", | |
| 221 result + 2, | |
| 222 RESULT_COUNT + 2); | |
|
mmenke
2014/03/26 17:23:21
The +2 strikes me as fragile. If this histogram i
meacer
2014/03/26 17:59:32
I guess we can keep it for some time, so I extract
| |
| 223 } | |
| 215 | 224 |
| 216 // If this isn't the first captive portal result, record stats. | 225 // If this isn't the first captive portal result, record stats. |
| 217 if (!last_check_time_.is_null()) { | 226 if (!last_check_time_.is_null()) { |
| 218 UMA_HISTOGRAM_LONG_TIMES("CaptivePortal.TimeBetweenChecks", | 227 UMA_HISTOGRAM_LONG_TIMES("CaptivePortal.TimeBetweenChecks", |
| 219 now - last_check_time_); | 228 now - last_check_time_); |
| 220 | 229 |
| 221 if (last_detection_result_ != result) { | 230 if (last_detection_result_ != result) { |
| 222 // If the last result was different from the result of the latest test, | 231 // 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 | 232 // record histograms about the previous period over which the result was |
| 224 // the same. | 233 // the same. |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 338 | 347 |
| 339 bool CaptivePortalService::DetectionInProgress() const { | 348 bool CaptivePortalService::DetectionInProgress() const { |
| 340 return state_ == STATE_CHECKING_FOR_PORTAL; | 349 return state_ == STATE_CHECKING_FOR_PORTAL; |
| 341 } | 350 } |
| 342 | 351 |
| 343 bool CaptivePortalService::TimerRunning() const { | 352 bool CaptivePortalService::TimerRunning() const { |
| 344 return check_captive_portal_timer_.IsRunning(); | 353 return check_captive_portal_timer_.IsRunning(); |
| 345 } | 354 } |
| 346 | 355 |
| 347 } // namespace captive_portal | 356 } // namespace captive_portal |
| OLD | NEW |