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

Unified Diff: components/ssl_errors/error_classification.h

Issue 1772143002: Use network time for bad clock interstitial. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pass "gn check out/Default" Created 4 years, 9 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
« no previous file with comments | « components/ssl_errors/DEPS ('k') | components/ssl_errors/error_classification.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/ssl_errors/error_classification.h
diff --git a/components/ssl_errors/error_classification.h b/components/ssl_errors/error_classification.h
index d15adb292fc80c3e59a27d4875bfeb0455099c73..99ab0f1dc8ba74cbb9a2135b682955eb92234672 100644
--- a/components/ssl_errors/error_classification.h
+++ b/components/ssl_errors/error_classification.h
@@ -18,18 +18,42 @@ namespace net {
class X509Certificate;
}
+namespace network_time {
+class NetworkTimeTracker;
+}
+
namespace ssl_errors {
typedef std::vector<std::string> HostnameTokens;
// Methods for identifying specific error causes. ------------------------------
-// Returns true if the system time is in the past.
-bool IsUserClockInThePast(const base::Time& time_now);
+// What is known about the accuracy of system clock. Do not change or
+// reorder; these values are used in an UMA histogram.
+enum ClockState {
+ // Not known whether system clock is close enough.
+ CLOCK_STATE_UNKNOWN,
+
+ // System clock is "close enough", per network time.
+ CLOCK_STATE_OK,
+
+ // System clock is behind.
+ CLOCK_STATE_PAST,
-// Returns true if the system time is too far in the future or the user is
-// using a version of Chrome which is more than 1 year old.
-bool IsUserClockInTheFuture(const base::Time& time_now);
+ // System clock is ahead.
+ CLOCK_STATE_FUTURE,
+
+ CLOCK_STATE_MAX,
+};
+
+// Compares |now_system| to the build time and to the current network time, and
+// returns an inference about the state of the system clock. A result from
+// network time, if available, will always be preferred to a result from the
+// build time. Calling this function records UMA statistics: it's assumed that
+// it's called in the course of handling an SSL error.
+ClockState GetClockState(
+ const base::Time& now_system,
+ const network_time::NetworkTimeTracker* network_time_tracker);
// Returns true if |hostname| is too broad for the scope of a wildcard
// certificate. E.g.:
@@ -71,6 +95,13 @@ void RecordUMAStatistics(bool overridable,
int cert_error,
const net::X509Certificate& cert);
+// Specialization of |RecordUMAStatistics| to be used when the bad clock
+// interstitial is shown. |cert_error| is required only for sanity-checking: it
+// must always be |ssl_errors::ErrorInfo::CERT_DATE_INVALID|.
+void RecordUMAStatisticsForClockInterstitial(bool overridable,
+ ssl_errors::ClockState clock_state,
+ int cert_error);
+
// Helper methods for classification. ------------------------------------------
// Tokenize DNS names and hostnames.
« no previous file with comments | « components/ssl_errors/DEPS ('k') | components/ssl_errors/error_classification.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698