OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_SSL_SSL_ERROR_CLASSIFICATION_H_ |
| 6 #define CHROME_BROWSER_SSL_SSL_ERROR_CLASSIFICATION_H_ |
| 7 |
| 8 #include "base/time/time.h" |
| 9 #include "net/cert/x509_certificate.h" |
| 10 |
| 11 // This class calculates the severity scores for the different type of SSL |
| 12 // errors. |
| 13 class SSLErrorClassification { |
| 14 public: |
| 15 SSLErrorClassification(base::Time current_time, |
| 16 const net::X509Certificate& cert); |
| 17 ~SSLErrorClassification(); |
| 18 |
| 19 // This method checks whether the user clock is in the past or not. |
| 20 static bool IsUserClockInThePast(base::Time time_now); |
| 21 |
| 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. |
| 24 static bool IsUserClockInTheFuture(base::Time time_now); |
| 25 |
| 26 // A method which calculates the severity score when the ssl error is |
| 27 // CERT_DATE_INVALID. |
| 28 float InvalidDateSeverityScore() const; |
| 29 |
| 30 static void RecordUMAStatistics(bool overridable); |
| 31 base::TimeDelta TimePassedSinceExpiry() const; |
| 32 |
| 33 private: |
| 34 FRIEND_TEST_ALL_PREFIXES(SSLErrorClassification, TestDateInvalidScore); |
| 35 |
| 36 float CalculateScoreTimePassedSinceExpiry() const; |
| 37 |
| 38 // This stores the current time. |
| 39 base::Time current_time_; |
| 40 |
| 41 // This stores the certificate. |
| 42 const net::X509Certificate& cert_; |
| 43 }; |
| 44 |
| 45 #endif // CHROME_BROWSER_SSL_SSL_ERROR_CLASSIFICATION_H_ |
OLD | NEW |