Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(204)

Side by Side Diff: chrome/browser/ssl/ssl_error_classification.cc

Issue 839183002: Remove redundancy in security interstitial UMA logic (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Answering mattm's questions Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <vector> 5 #include <vector>
6 6
7 #include "chrome/browser/ssl/ssl_error_classification.h" 7 #include "chrome/browser/ssl/ssl_error_classification.h"
8 8
9 #include "base/build_time.h" 9 #include "base/build_time.h"
10 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 if (IsHostnameNonUniqueOrDotless(request_url_.HostNoBrackets())) 289 if (IsHostnameNonUniqueOrDotless(request_url_.HostNoBrackets()))
290 severity_authority_score += kClientWeight * kPrivateURLWeight; 290 severity_authority_score += kClientWeight * kPrivateURLWeight;
291 291
292 RecordSSLInterstitialSeverityScore(severity_authority_score, cert_error_); 292 RecordSSLInterstitialSeverityScore(severity_authority_score, cert_error_);
293 } 293 }
294 294
295 void SSLErrorClassification::RecordUMAStatistics( 295 void SSLErrorClassification::RecordUMAStatistics(
296 bool overridable) const { 296 bool overridable) const {
297 SSLErrorInfo::ErrorType type = 297 SSLErrorInfo::ErrorType type =
298 SSLErrorInfo::NetErrorToErrorType(cert_error_); 298 SSLErrorInfo::NetErrorToErrorType(cert_error_);
299 UMA_HISTOGRAM_ENUMERATION(
300 "interstitial.ssl_error_type", type, SSLErrorInfo::END_OF_ENUM);
299 switch (type) { 301 switch (type) {
300 case SSLErrorInfo::CERT_DATE_INVALID: { 302 case SSLErrorInfo::CERT_DATE_INVALID: {
301 if (IsUserClockInThePast(base::Time::NowFromSystemTime())) 303 if (IsUserClockInThePast(base::Time::NowFromSystemTime()))
302 RecordSSLInterstitialCause(overridable, CLOCK_PAST); 304 RecordSSLInterstitialCause(overridable, CLOCK_PAST);
303 if (IsUserClockInTheFuture(base::Time::NowFromSystemTime())) 305 if (IsUserClockInTheFuture(base::Time::NowFromSystemTime()))
304 RecordSSLInterstitialCause(overridable, CLOCK_FUTURE); 306 RecordSSLInterstitialCause(overridable, CLOCK_FUTURE);
305 break; 307 break;
306 } 308 }
307 case SSLErrorInfo::CERT_COMMON_NAME_INVALID: { 309 case SSLErrorInfo::CERT_COMMON_NAME_INVALID: {
308 std::string host_name = request_url_.host(); 310 std::string host_name = request_url_.host();
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 // sure we don't clear the captive protal flag, since the interstitial was 645 // sure we don't clear the captive protal flag, since the interstitial was
644 // potentially caused by the captive portal. 646 // potentially caused by the captive portal.
645 captive_portal_detected_ = captive_portal_detected_ || 647 captive_portal_detected_ = captive_portal_detected_ ||
646 (results->result == captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL); 648 (results->result == captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL);
647 // Also keep track of non-HTTP portals and error cases. 649 // Also keep track of non-HTTP portals and error cases.
648 captive_portal_no_response_ = captive_portal_no_response_ || 650 captive_portal_no_response_ = captive_portal_no_response_ ||
649 (results->result == captive_portal::RESULT_NO_RESPONSE); 651 (results->result == captive_portal::RESULT_NO_RESPONSE);
650 } 652 }
651 #endif 653 #endif
652 } 654 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698