OLD | NEW |
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 CLOCK_FUTURE, | 46 CLOCK_FUTURE, |
47 WWW_SUBDOMAIN_MATCH, | 47 WWW_SUBDOMAIN_MATCH, |
48 SUBDOMAIN_MATCH, | 48 SUBDOMAIN_MATCH, |
49 SUBDOMAIN_INVERSE_MATCH, | 49 SUBDOMAIN_INVERSE_MATCH, |
50 SUBDOMAIN_OUTSIDE_WILDCARD, | 50 SUBDOMAIN_OUTSIDE_WILDCARD, |
51 HOST_NAME_NOT_KNOWN_TLD, | 51 HOST_NAME_NOT_KNOWN_TLD, |
52 LIKELY_MULTI_TENANT_HOSTING, | 52 LIKELY_MULTI_TENANT_HOSTING, |
53 LOCALHOST, | 53 LOCALHOST, |
54 PRIVATE_URL, | 54 PRIVATE_URL, |
55 AUTHORITY_ERROR_CAPTIVE_PORTAL, | 55 AUTHORITY_ERROR_CAPTIVE_PORTAL, |
| 56 SELF_SIGNED, |
56 UNUSED_INTERSTITIAL_CAUSE_ENTRY, | 57 UNUSED_INTERSTITIAL_CAUSE_ENTRY, |
57 }; | 58 }; |
58 | 59 |
59 // Events for UMA. Do not reorder or change! | 60 // Events for UMA. Do not reorder or change! |
60 enum SSLInterstitialCauseCaptivePortal { | 61 enum SSLInterstitialCauseCaptivePortal { |
61 CAPTIVE_PORTAL_DETECTION_ENABLED, | 62 CAPTIVE_PORTAL_DETECTION_ENABLED, |
62 CAPTIVE_PORTAL_DETECTION_ENABLED_OVERRIDABLE, | 63 CAPTIVE_PORTAL_DETECTION_ENABLED_OVERRIDABLE, |
63 CAPTIVE_PORTAL_PROBE_COMPLETED, | 64 CAPTIVE_PORTAL_PROBE_COMPLETED, |
64 CAPTIVE_PORTAL_PROBE_COMPLETED_OVERRIDABLE, | 65 CAPTIVE_PORTAL_PROBE_COMPLETED_OVERRIDABLE, |
65 CAPTIVE_PORTAL_NO_RESPONSE, | 66 CAPTIVE_PORTAL_NO_RESPONSE, |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 break; | 328 break; |
328 } | 329 } |
329 case SSLErrorInfo::CERT_AUTHORITY_INVALID: { | 330 case SSLErrorInfo::CERT_AUTHORITY_INVALID: { |
330 const std::string& hostname = request_url_.HostNoBrackets(); | 331 const std::string& hostname = request_url_.HostNoBrackets(); |
331 if (net::IsLocalhost(hostname)) | 332 if (net::IsLocalhost(hostname)) |
332 RecordSSLInterstitialCause(overridable, LOCALHOST); | 333 RecordSSLInterstitialCause(overridable, LOCALHOST); |
333 if (IsHostnameNonUniqueOrDotless(hostname)) | 334 if (IsHostnameNonUniqueOrDotless(hostname)) |
334 RecordSSLInterstitialCause(overridable, PRIVATE_URL); | 335 RecordSSLInterstitialCause(overridable, PRIVATE_URL); |
335 if (captive_portal_probe_completed_ && captive_portal_detected_) | 336 if (captive_portal_probe_completed_ && captive_portal_detected_) |
336 RecordSSLInterstitialCause(overridable, AUTHORITY_ERROR_CAPTIVE_PORTAL); | 337 RecordSSLInterstitialCause(overridable, AUTHORITY_ERROR_CAPTIVE_PORTAL); |
| 338 if (net::X509Certificate::IsSelfSigned(cert_.os_cert_handle())) |
| 339 RecordSSLInterstitialCause(overridable, SELF_SIGNED); |
337 break; | 340 break; |
338 } | 341 } |
339 default: | 342 default: |
340 break; | 343 break; |
341 } | 344 } |
342 } | 345 } |
343 | 346 |
344 base::TimeDelta SSLErrorClassification::TimePassedSinceExpiry() const { | 347 base::TimeDelta SSLErrorClassification::TimePassedSinceExpiry() const { |
345 base::TimeDelta delta = current_time_ - cert_.valid_expiry(); | 348 base::TimeDelta delta = current_time_ - cert_.valid_expiry(); |
346 return delta; | 349 return delta; |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 // sure we don't clear the captive protal flag, since the interstitial was | 646 // sure we don't clear the captive protal flag, since the interstitial was |
644 // potentially caused by the captive portal. | 647 // potentially caused by the captive portal. |
645 captive_portal_detected_ = captive_portal_detected_ || | 648 captive_portal_detected_ = captive_portal_detected_ || |
646 (results->result == captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL); | 649 (results->result == captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL); |
647 // Also keep track of non-HTTP portals and error cases. | 650 // Also keep track of non-HTTP portals and error cases. |
648 captive_portal_no_response_ = captive_portal_no_response_ || | 651 captive_portal_no_response_ = captive_portal_no_response_ || |
649 (results->result == captive_portal::RESULT_NO_RESPONSE); | 652 (results->result == captive_portal::RESULT_NO_RESPONSE); |
650 } | 653 } |
651 #endif | 654 #endif |
652 } | 655 } |
OLD | NEW |