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 #ifndef CHROME_BROWSER_SSL_SSL_ERROR_CLASSIFICATION_H_ | 5 #ifndef CHROME_BROWSER_SSL_SSL_ERROR_CLASSIFICATION_H_ |
6 #define CHROME_BROWSER_SSL_SSL_ERROR_CLASSIFICATION_H_ | 6 #define CHROME_BROWSER_SSL_SSL_ERROR_CLASSIFICATION_H_ |
7 | 7 |
8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
9 #include "net/cert/x509_certificate.h" | 9 #include "net/cert/x509_certificate.h" |
10 | 10 |
11 // This class calculates the severity scores for the different type of SSL | 11 // This class calculates the severity scores for the different type of SSL |
12 // errors. | 12 // errors. |
13 class SSLErrorClassification { | 13 class SSLErrorClassification { |
14 public: | 14 public: |
15 SSLErrorClassification(base::Time current_time, | 15 SSLErrorClassification(base::Time current_time, |
16 const net::X509Certificate& cert); | 16 const net::X509Certificate& cert); |
17 ~SSLErrorClassification(); | 17 ~SSLErrorClassification(); |
18 | 18 |
19 // This method checks whether the user clock is in the past or not. | 19 // This method checks whether the user clock is in the past or not. |
20 static bool IsUserClockInThePast(base::Time time_now); | 20 static bool IsUserClockInThePast(base::Time time_now); |
21 | 21 |
22 // This method checks whether the system time is too far in the future or | 22 // This method checks whether the system time is too far in the future or |
23 // the user is using a version of Chrome which is more than 1 year old. | 23 // the user is using a version of Chrome which is more than 1 year old. |
24 static bool IsUserClockInTheFuture(base::Time time_now); | 24 static bool IsUserClockInTheFuture(base::Time time_now); |
25 | 25 |
| 26 static bool IsWindowsVersionSP3OrLower(); |
| 27 |
26 // A method which calculates the severity score when the ssl error is | 28 // A method which calculates the severity score when the ssl error is |
27 // CERT_DATE_INVALID. | 29 // CERT_DATE_INVALID. |
28 float InvalidDateSeverityScore() const; | 30 float InvalidDateSeverityScore() const; |
29 | 31 |
30 static void RecordUMAStatistics(bool overridable); | 32 static void RecordUMAStatistics(bool overridable); |
31 base::TimeDelta TimePassedSinceExpiry() const; | 33 base::TimeDelta TimePassedSinceExpiry() const; |
32 | 34 |
33 private: | 35 private: |
34 FRIEND_TEST_ALL_PREFIXES(SSLErrorClassification, TestDateInvalidScore); | 36 FRIEND_TEST_ALL_PREFIXES(SSLErrorClassification, TestDateInvalidScore); |
35 | 37 |
36 float CalculateScoreTimePassedSinceExpiry() const; | 38 float CalculateScoreTimePassedSinceExpiry() const; |
37 | 39 |
38 // This stores the current time. | 40 // This stores the current time. |
39 base::Time current_time_; | 41 base::Time current_time_; |
40 | 42 |
41 // This stores the certificate. | 43 // This stores the certificate. |
42 const net::X509Certificate& cert_; | 44 const net::X509Certificate& cert_; |
43 }; | 45 }; |
44 | 46 |
45 #endif // CHROME_BROWSER_SSL_SSL_ERROR_CLASSIFICATION_H_ | 47 #endif // CHROME_BROWSER_SSL_SSL_ERROR_CLASSIFICATION_H_ |
OLD | NEW |