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 12 matching lines...) Expand all Loading... |
23 #include "net/cert/x509_cert_types.h" | 23 #include "net/cert/x509_cert_types.h" |
24 #include "net/cert/x509_certificate.h" | 24 #include "net/cert/x509_certificate.h" |
25 #include "url/gurl.h" | 25 #include "url/gurl.h" |
26 | 26 |
27 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) | 27 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) |
28 #include "chrome/browser/captive_portal/captive_portal_service.h" | 28 #include "chrome/browser/captive_portal/captive_portal_service.h" |
29 #include "chrome/browser/captive_portal/captive_portal_service_factory.h" | 29 #include "chrome/browser/captive_portal/captive_portal_service_factory.h" |
30 #endif | 30 #endif |
31 | 31 |
32 #if defined(OS_WIN) | 32 #if defined(OS_WIN) |
| 33 #include "base/win/win_util.h" |
33 #include "base/win/windows_version.h" | 34 #include "base/win/windows_version.h" |
34 #endif | 35 #endif |
35 | 36 |
36 using base::Time; | 37 using base::Time; |
37 using base::TimeTicks; | 38 using base::TimeTicks; |
38 using base::TimeDelta; | 39 using base::TimeDelta; |
39 | 40 |
40 namespace { | 41 namespace { |
41 | 42 |
42 // Events for UMA. Do not reorder or change! | 43 // Events for UMA. Do not reorder or change! |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 } | 360 } |
360 | 361 |
361 bool SSLErrorClassification::IsUserClockInTheFuture( | 362 bool SSLErrorClassification::IsUserClockInTheFuture( |
362 const base::Time& time_now) { | 363 const base::Time& time_now) { |
363 base::Time build_time = base::GetBuildTime(); | 364 base::Time build_time = base::GetBuildTime(); |
364 if (time_now > build_time + base::TimeDelta::FromDays(365)) | 365 if (time_now > build_time + base::TimeDelta::FromDays(365)) |
365 return true; | 366 return true; |
366 return false; | 367 return false; |
367 } | 368 } |
368 | 369 |
369 bool SSLErrorClassification::IsWindowsVersionSP3OrLower() { | 370 bool SSLErrorClassification::MaybeWindowsLacksSHA256Support() { |
370 #if defined(OS_WIN) | 371 #if defined(OS_WIN) |
371 const base::win::OSInfo* os_info = base::win::OSInfo::GetInstance(); | 372 return !base::win::MaybeHasSHA256Support(); |
372 base::win::OSInfo::ServicePack service_pack = os_info->service_pack(); | 373 #else |
373 if (os_info->version() < base::win::VERSION_VISTA && service_pack.major < 3) | 374 return false; |
374 return true; | |
375 #endif | 375 #endif |
376 return false; | |
377 } | 376 } |
378 | 377 |
379 bool SSLErrorClassification::IsHostNameKnownTLD(const std::string& host_name) { | 378 bool SSLErrorClassification::IsHostNameKnownTLD(const std::string& host_name) { |
380 size_t tld_length = | 379 size_t tld_length = |
381 net::registry_controlled_domains::GetRegistryLength( | 380 net::registry_controlled_domains::GetRegistryLength( |
382 host_name, | 381 host_name, |
383 net::registry_controlled_domains::EXCLUDE_UNKNOWN_REGISTRIES, | 382 net::registry_controlled_domains::EXCLUDE_UNKNOWN_REGISTRIES, |
384 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); | 383 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); |
385 if (tld_length == 0 || tld_length == std::string::npos) | 384 if (tld_length == 0 || tld_length == std::string::npos) |
386 return false; | 385 return false; |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 // sure we don't clear the captive protal flag, since the interstitial was | 593 // sure we don't clear the captive protal flag, since the interstitial was |
595 // potentially caused by the captive portal. | 594 // potentially caused by the captive portal. |
596 captive_portal_detected_ = captive_portal_detected_ || | 595 captive_portal_detected_ = captive_portal_detected_ || |
597 (results->result == captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL); | 596 (results->result == captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL); |
598 // Also keep track of non-HTTP portals and error cases. | 597 // Also keep track of non-HTTP portals and error cases. |
599 captive_portal_no_response_ = captive_portal_no_response_ || | 598 captive_portal_no_response_ = captive_portal_no_response_ || |
600 (results->result == captive_portal::RESULT_NO_RESPONSE); | 599 (results->result == captive_portal::RESULT_NO_RESPONSE); |
601 } | 600 } |
602 #endif | 601 #endif |
603 } | 602 } |
OLD | NEW |