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

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

Issue 940543003: added clock interstitial to chrome://interstitials (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added clock interstitial to chrome://interstitials Created 5 years, 10 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 ecf70291056c8b47e64f534c76b29a09aad97083..42aaa308433c61c9e545d3c292673c9df5e3c92b 100644
--- a/chrome/browser/ssl/ssl_blocking_page.cc
+++ b/chrome/browser/ssl/ssl_blocking_page.cc
@@ -222,7 +222,8 @@ SSLBlockingPage::SSLBlockingPage(content::WebContents* web_contents,
const net::SSLInfo& ssl_info,
const GURL& request_url,
int options_mask,
- const base::Callback<void(bool)>& callback)
+ const base::Callback<void(bool)>& callback,
+ const base::Time& base_time)
: SecurityInterstitialPage(web_contents, request_url),
callback_(callback),
cert_error_(cert_error),
@@ -231,10 +232,11 @@ SSLBlockingPage::SSLBlockingPage(content::WebContents* web_contents,
danger_overridable_(true),
strict_enforcement_((options_mask & STRICT_ENFORCEMENT) != 0),
expired_but_previously_allowed_(
- (options_mask & EXPIRED_BUT_PREVIOUSLY_ALLOWED) != 0) {
- interstitial_reason_ =
- IsErrorDueToBadClock(base::Time::NowFromSystemTime(), cert_error_) ?
- SSL_REASON_BAD_CLOCK : SSL_REASON_SSL;
+ (options_mask & EXPIRED_BUT_PREVIOUSLY_ALLOWED) != 0),
+ time_triggered_(base_time) {
lgarron 2015/02/24 02:28:37 I would make the constructor argument and the inst
fahl 2015/02/24 21:23:23 Done.
+ interstitial_reason_ = IsErrorDueToBadClock(time_triggered_, cert_error_)
+ ? SSL_REASON_BAD_CLOCK
+ : SSL_REASON_SSL;
// We collapse the Rappor metric name to just "ssl" so we don't leak
// the "overridable" bit. We skip Rappor altogether for bad clocks.
@@ -252,7 +254,7 @@ SSLBlockingPage::SSLBlockingPage(content::WebContents* web_contents,
ssl_error_classification_.reset(new SSLErrorClassification(
web_contents,
- base::Time::NowFromSystemTime(),
+ time_triggered_,
request_url,
cert_error_,
*ssl_info_.cert.get()));
@@ -295,7 +297,6 @@ void SSLBlockingPage::PopulateInterstitialStrings(
load_time_data->SetString("type", "SSL");
// Shared UI configuration for all SSL interstitials.
- base::Time now = base::Time::NowFromSystemTime();
load_time_data->SetString("errorCode", net::ErrorToString(cert_error_));
load_time_data->SetString(
"openDetails",
@@ -321,9 +322,10 @@ void SSLBlockingPage::PopulateInterstitialStrings(
// case.
danger_overridable_ = false;
- int heading_string = SSLErrorClassification::IsUserClockInTheFuture(now) ?
- IDS_SSL_V2_CLOCK_AHEAD_HEADING :
- IDS_SSL_V2_CLOCK_BEHIND_HEADING;
+ int heading_string =
+ SSLErrorClassification::IsUserClockInTheFuture(time_triggered_)
+ ? IDS_SSL_V2_CLOCK_AHEAD_HEADING
+ : IDS_SSL_V2_CLOCK_BEHIND_HEADING;
load_time_data->SetString(
"tabTitle",
@@ -331,11 +333,11 @@ void SSLBlockingPage::PopulateInterstitialStrings(
load_time_data->SetString(
"heading",
l10n_util::GetStringUTF16(heading_string));
- load_time_data->SetString("primaryParagraph",
- l10n_util::GetStringFUTF16(
- IDS_SSL_V2_CLOCK_PRIMARY_PARAGRAPH ,
- url,
- base::TimeFormatFriendlyDateAndTime(now)));
+ load_time_data->SetString(
+ "primaryParagraph",
+ l10n_util::GetStringFUTF16(
+ IDS_SSL_V2_CLOCK_PRIMARY_PARAGRAPH, url,
+ base::TimeFormatFriendlyDateAndTime(time_triggered_)));
load_time_data->SetString(
"primaryButtonText",
@@ -426,10 +428,12 @@ void SSLBlockingPage::PopulateInterstitialStrings(
"expirationDate",
base::TimeFormatShortDate(ssl_info_.cert->valid_expiry()));
load_time_data->SetString(
- "currentDate", base::TimeFormatShortDate(now));
+ "currentDate", base::TimeFormatShortDate(time_triggered_));
std::vector<std::string> encoded_chain;
- ssl_info_.cert->GetPEMEncodedChain(&encoded_chain);
- load_time_data->SetString("pem", JoinString(encoded_chain, std::string()));
+ ssl_info_.cert->GetPEMEncodedChain(
+ &encoded_chain);
+ load_time_data->SetString(
+ "pem", JoinString(encoded_chain, std::string()));
}
void SSLBlockingPage::OverrideEntry(NavigationEntry* entry) {

Powered by Google App Engine
This is Rietveld 408576698