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

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: estark review 4 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
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..b0f360f03444cbb32156c4b7648f9d59b9edffbb 100644
--- a/components/ssl_errors/error_classification.h
+++ b/components/ssl_errors/error_classification.h
@@ -18,18 +18,39 @@ 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,
+
+ // System clock is ahead.
+ CLOCK_STATE_FUTURE,
+};
-// 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);
+// Returns the current state of the clock. The states are documented with the
+// |CLOCK_STATE| enum. A result from network time, if available, will always be
+// preferred to a result from the build time.
+ClockState GetClockState(
+ const base::Time& now_system,
+ const network_time::NetworkTimeTracker* network_time_tracker,
+ bool record_results);
// Returns true if |hostname| is too broad for the scope of a wildcard
// certificate. E.g.:
@@ -67,6 +88,7 @@ bool GetWWWSubDomainMatch(const GURL& request_url,
void RecordUMAStatistics(bool overridable,
const base::Time& current_time,
+ const network_time::NetworkTimeTracker* network_time,
const GURL& request_url,
int cert_error,
const net::X509Certificate& cert);

Powered by Google App Engine
This is Rietveld 408576698