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..7a1e293e9d22a852cfaff8a7fa125d299aadfecb 100644 |
--- a/chrome/browser/ssl/ssl_blocking_page.cc |
+++ b/chrome/browser/ssl/ssl_blocking_page.cc |
@@ -205,6 +205,7 @@ bool IsErrorDueToBadClock(const base::Time& now, int error) { |
SSLErrorInfo::CERT_DATE_INVALID) { |
return false; |
} |
+ |
lgarron
2015/02/20 22:12:46
Nit: Remove all blank lines until the diff is sema
|
return SSLErrorClassification::IsUserClockInThePast(now) || |
SSLErrorClassification::IsUserClockInTheFuture(now); |
} |
@@ -222,7 +223,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 +233,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), |
+ base_time_(base_time) { |
+ interstitial_reason_ = IsErrorDueToBadClock(base_time_, 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. |
@@ -250,12 +253,9 @@ SSLBlockingPage::SSLBlockingPage(content::WebContents* web_contents, |
metrics_helper_->RecordUserInteraction( |
SecurityInterstitialMetricsHelper::TOTAL_VISITS); |
- ssl_error_classification_.reset(new SSLErrorClassification( |
- web_contents, |
- base::Time::NowFromSystemTime(), |
- request_url, |
- cert_error_, |
- *ssl_info_.cert.get())); |
+ ssl_error_classification_.reset( |
+ new SSLErrorClassification(web_contents, base_time_, request_url, |
+ cert_error_, *ssl_info_.cert.get())); |
ssl_error_classification_->RecordUMAStatistics(overridable_); |
// Creating an interstitial without showing (e.g. from chrome://interstitials) |
@@ -295,7 +295,8 @@ void SSLBlockingPage::PopulateInterstitialStrings( |
load_time_data->SetString("type", "SSL"); |
// Shared UI configuration for all SSL interstitials. |
- base::Time now = base::Time::NowFromSystemTime(); |
+ // base::Time now = base::Time::NowFromSystemTime(); |
felt
2015/02/20 16:01:53
why are these lines here but commented out?
lgarron
2015/02/20 22:12:46
I think we've removed the need for these; I would
fahl
2015/02/23 23:47:49
Acknowledged.
fahl
2015/02/23 23:47:49
Acknowledged.
|
+ // base::Time now = base_time_; |
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(base_time_) |
+ ? 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", |
lgarron
2015/02/20 22:12:46
I see you're using `git cl format`? :-D
lgarron
2015/02/20 22:12:46
I see you're using `git cl format`? :-D
|
+ l10n_util::GetStringFUTF16( |
+ IDS_SSL_V2_CLOCK_PRIMARY_PARAGRAPH, url, |
+ base::TimeFormatFriendlyDateAndTime(base_time_))); |
load_time_data->SetString( |
"primaryButtonText", |
@@ -425,8 +427,8 @@ void SSLBlockingPage::PopulateInterstitialStrings( |
load_time_data->SetString( |
"expirationDate", |
base::TimeFormatShortDate(ssl_info_.cert->valid_expiry())); |
- load_time_data->SetString( |
- "currentDate", base::TimeFormatShortDate(now)); |
+ load_time_data->SetString("currentDate", |
felt
2015/02/20 16:01:53
nit: i liked putting all of these on the next line
lgarron
2015/02/20 22:12:46
I suggested Sascha use `git cl format`. In case he
fahl
2015/02/23 23:47:49
Acknowledged.
|
+ base::TimeFormatShortDate(base_time_)); |
std::vector<std::string> encoded_chain; |
ssl_info_.cert->GetPEMEncodedChain(&encoded_chain); |
load_time_data->SetString("pem", JoinString(encoded_chain, std::string())); |