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

Unified Diff: chrome/browser/ssl/ssl_error_classification.h

Issue 376663002: Calculate severity score for date_invalid error (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ssl/ssl_error_classification.h
diff --git a/chrome/browser/ssl/ssl_error_classification.h b/chrome/browser/ssl/ssl_error_classification.h
new file mode 100644
index 0000000000000000000000000000000000000000..361189f159eea55cb5023fc4f8307eb179e5b014
--- /dev/null
+++ b/chrome/browser/ssl/ssl_error_classification.h
@@ -0,0 +1,42 @@
+// Copyright (c) 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_SSL_SSL_ERROR_CLASSIFICATION_H_
+#define CHROME_BROWSER_SSL_SSL_ERROR_CLASSIFICATION_H_
+
+#include "base/time/time.h"
+#include "net/cert/x509_certificate.h"
+
+// This class calculates the severity scores for the different type of SSL
+// errors.
+class SSLErrorClassification {
+ public:
+ SSLErrorClassification(base::Time current_time,
+ const::net::X509Certificate& cert);
+ ~SSLErrorClassification();
+
+ // Functions which check whether the user clock is wrong or not.
+ static bool IsUserClockInThePast(base::Time time_now);
+ static bool IsUserClockInTheFuture(base::Time time_now);
+
+ // A function which calculates the severity score when the ssl error is
+ // CERT_DATE_INVALID.
+ float InvalidDateSeverityScore() const;
+
+ void RecordUMAStatistics(bool overridable);
felt 2014/07/11 14:12:48 could this also be a static method, at least for n
radhikabhar 2014/07/11 16:34:46 Done. But in the future if I have to record any o
+ base::TimeDelta TimePassedSinceExpiry() const;
+
+ private:
+ FRIEND_TEST_ALL_PREFIXES(SSLErrorClassification, TestDateInvalidScore);
+
+ float CalculateScoreTimePassedSinceExpiry() const;
+
+ // This stores the current time.
+ base::Time current_time_;
+
+ // This stores the certificate.
+ const net::X509Certificate& cert_;
+};
+
+#endif // CHROME_BROWSER_SSL_SSL_ERROR_CLASSIFICATION_H_

Powered by Google App Engine
This is Rietveld 408576698