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

Unified Diff: chrome/browser/ssl/ssl_blocking_page.cc

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_blocking_page.cc
diff --git a/chrome/browser/ssl/ssl_blocking_page.cc b/chrome/browser/ssl/ssl_blocking_page.cc
index 212172ec99332601943cc076b03fa3d64b1f62f9..ca97c2b60a0a90009235bd3716fc0b3b657f2126 100644
--- a/chrome/browser/ssl/ssl_blocking_page.cc
+++ b/chrome/browser/ssl/ssl_blocking_page.cc
@@ -20,6 +20,7 @@
#include "chrome/browser/history/history_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/renderer_preferences_util.h"
+#include "chrome/browser/ssl/ssl_error_classification.h"
#include "chrome/browser/ssl/ssl_error_info.h"
#include "chrome/common/chrome_switches.h"
#include "content/public/browser/cert_store.h"
@@ -215,45 +216,6 @@ void RecordSSLBlockingPageDetailedStats(
}
}
-// Events for UMA. Do not reorder or change!
-enum SSLInterstitialCause {
- CLOCK_PAST,
- CLOCK_FUTURE,
- UNUSED_INTERSTITIAL_CAUSE_ENTRY,
-};
-
-void RecordSSLInterstitialCause(bool overridable, SSLInterstitialCause event) {
- if (overridable) {
- UMA_HISTOGRAM_ENUMERATION("interstitial.ssl.cause.overridable",
- event,
- UNUSED_INTERSTITIAL_CAUSE_ENTRY);
- } else {
- UMA_HISTOGRAM_ENUMERATION("interstitial.ssl.cause.nonoverridable",
- event,
- UNUSED_INTERSTITIAL_CAUSE_ENTRY);
- }
-}
-
-// The cause of most clock errors (CMOS battery causing clock reset) will
-// fall backwards, not forwards. IsErrorProbablyCausedByClock therefore only
-// returns true for clocks set early, and histograms clocks set far into the
-// future to see if there are more future-clocks than expected.
-bool IsErrorProbablyCausedByClock(bool overridable, int cert_info) {
- if (SSLErrorInfo::NetErrorToErrorType(cert_info) !=
- SSLErrorInfo::CERT_DATE_INVALID) {
- return false;
- }
- const base::Time current_time = base::Time::NowFromSystemTime();
- const base::Time build_time = base::GetBuildTime();
- if (current_time < build_time - base::TimeDelta::FromDays(2)) {
- RecordSSLInterstitialCause(overridable, CLOCK_PAST);
- return true;
- }
- if (current_time > build_time + base::TimeDelta::FromDays(365))
- RecordSSLInterstitialCause(overridable, CLOCK_FUTURE);
- return false;
-}
-
} // namespace
// Note that we always create a navigation entry with SSL errors.
@@ -300,6 +262,11 @@ SSLBlockingPage::SSLBlockingPage(
&request_tracker_);
}
}
+ if (SSLErrorInfo::NetErrorToErrorType(cert_error_) ==
+ SSLErrorInfo::CERT_DATE_INVALID) {
+ SSLErrorClassification::RecordUMAStatistics(overridable_ &&
+ !strict_enforcement_);
+ }
#if defined(ENABLE_CAPTIVE_PORTAL_DETECTION)
CaptivePortalService* captive_portal_service =
@@ -524,8 +491,10 @@ std::string SSLBlockingPage::GetHTMLContentsV2() {
"tabTitle", l10n_util::GetStringUTF16(IDS_SSL_V2_TITLE));
load_time_data.SetString(
"heading", l10n_util::GetStringUTF16(IDS_SSL_V2_HEADING));
- if (IsErrorProbablyCausedByClock(
- overridable_ && !strict_enforcement_, cert_error_)) {
+ if ((SSLErrorClassification::IsUserClockInThePast(
+ base::Time::NowFromSystemTime()))
+ && (SSLErrorInfo::NetErrorToErrorType(cert_error_) ==
+ SSLErrorInfo::CERT_DATE_INVALID)) {
load_time_data.SetString("primaryParagraph",
l10n_util::GetStringFUTF16(
IDS_SSL_CLOCK_ERROR,
« no previous file with comments | « no previous file | chrome/browser/ssl/ssl_error_classification.h » ('j') | chrome/browser/ssl/ssl_error_classification.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698