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

Unified Diff: chrome/browser/ui/webui/interstitials/interstitial_ui.cc

Issue 940543003: added clock interstitial to chrome://interstitials (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add the 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/ui/webui/interstitials/interstitial_ui.cc
diff --git a/chrome/browser/ui/webui/interstitials/interstitial_ui.cc b/chrome/browser/ui/webui/interstitials/interstitial_ui.cc
index 6bdd42fe0cf6259fcb9ab08ec018770cdc0eea26..45449ea4cd763d46c16a06c51106c7bf7f7b196e 100644
--- a/chrome/browser/ui/webui/interstitials/interstitial_ui.cc
+++ b/chrome/browser/ui/webui/interstitials/interstitial_ui.cc
@@ -51,6 +51,8 @@ SSLBlockingPage* CreateSSLBlockingPage(content::WebContents* web_contents) {
GURL request_url("https://example.com");
bool overridable = false;
bool strict_enforcement = false;
+ base::Time base_time = base::Time::NowFromSystemTime();
+
std::string url_param;
if (net::GetValueForKeyInQuery(web_contents->GetURL(),
"url",
@@ -70,6 +72,15 @@ SSLBlockingPage* CreateSSLBlockingPage(content::WebContents* web_contents) {
&strict_enforcement_param)) {
strict_enforcement = strict_enforcement_param == "1";
}
+
+ std::string clock_manipulation_param;
+ if (net::GetValueForKeyInQuery(web_contents->GetURL(), "clock_manipulation",
lgarron 2015/02/20 22:12:46 I like the idea of being able to scale the number
+ &clock_manipulation_param) == 1) {
+ cert_error = net::ERR_CERT_DATE_INVALID;
+ base_time +=
+ base::TimeDelta::FromDays(365 * atoi(clock_manipulation_param.c_str()));
lgarron 2015/02/20 22:12:46 felt@: Do you know if there's a more semantic way
+ }
+
net::SSLInfo ssl_info;
ssl_info.cert = new net::X509Certificate(
request_url.host(), "CA", base::Time::Max(), base::Time::Max());
@@ -79,12 +90,9 @@ SSLBlockingPage* CreateSSLBlockingPage(content::WebContents* web_contents) {
options_mask |= SSLBlockingPage::OVERRIDABLE;
if (strict_enforcement)
options_mask |= SSLBlockingPage::STRICT_ENFORCEMENT;
- return new SSLBlockingPage(web_contents,
- cert_error,
- ssl_info,
- request_url,
- options_mask,
- base::Callback<void(bool)>());
+ return new SSLBlockingPage(web_contents, cert_error, ssl_info, request_url,
+ options_mask, base::Callback<void(bool)>(),
+ base_time);
}
SafeBrowsingBlockingPage* CreateSafeBrowsingBlockingPage(
@@ -128,8 +136,7 @@ SafeBrowsingBlockingPage* CreateSafeBrowsingBlockingPage(
web_contents,
resource);
}
felt 2015/02/20 16:01:53 nit: why are you reformatting this?
fahl 2015/02/23 23:47:49 Acknowledged.
-
-} // namespace
+} // namespace
InterstitialUI::InterstitialUI(content::WebUI* web_ui)
: WebUIController(web_ui) {
@@ -185,23 +192,33 @@ void InterstitialHTMLSource::StartDataRequest(
if (interstitial_delegate.get()) {
html = interstitial_delegate.get()->GetHTMLContents();
} else {
- html = "<html><head><title>Interstitials</title></head>"
- "<body><h2>Choose an interstitial<h2>"
- "<h3>SSL</h3>"
- "<a href='ssl'>example.com</a><br>"
- "<a href='ssl?url=https://google.com'>SSL (google.com)</a><br>"
- "<a href='ssl?overridable=1&strict_enforcement=0'>"
- " example.com (Overridable)</a>"
- "<br><br>"
- "<h3>SafeBrowsing</h3>"
- "<a href='safebrowsing?type=malware'>Malware</a><br>"
- "<a href='safebrowsing?type=phishing'>Phishing</a><br>"
- "<a href='safebrowsing?type=clientside_malware'>"
- " Client Side Malware</a><br>"
- "<a href='safebrowsing?type=clientside_phishing'>"
- " Client Side Phishing</a><br>"
- "</body></html>";
+ html =
+ "<html><head><title>Interstitials</title></head>"
+ "<body><h2>Choose an interstitial<h2>"
+ "<h3>SSL</h3>"
+ "<a href='ssl'>example.com</a><br>"
+ "<a href='ssl?url=https://google.com'>SSL (google.com)</a><br>"
+ "<a href='ssl?overridable=1&strict_enforcement=0'>"
+ " example.com (Overridable)</a><br>"
+ "<a "
+ "href='ssl?clock_error=1&clock_manipulation=1&url=https://"
lgarron 2015/02/20 22:12:46 We can remove the URL parameter now, right?
fahl 2015/02/23 23:47:49 Acknowledged.
+ "yourclockiswrong.com'>"
+ " Clock is ahead</a><br>"
+ "<a "
+ "href='ssl?clock_error=1&clock_manipulation=-1&url=https://"
+ "yourclockiswrong.com'>"
+ " Clock is behind</a><br>"
+ "<br><br>"
+ "<h3>SafeBrowsing</h3>"
+ "<a href='safebrowsing?type=malware'>Malware</a><br>"
+ "<a href='safebrowsing?type=phishing'>Phishing</a><br>"
+ "<a href='safebrowsing?type=clientside_malware'>"
+ " Client Side Malware</a><br>"
+ "<a href='safebrowsing?type=clientside_phishing'>"
+ " Client Side Phishing</a><br>"
+ "</body></html>";
}
+
felt 2015/02/20 16:01:53 nit: same question here, generally it's best to le
fahl 2015/02/23 23:47:49 Acknowledged.
scoped_refptr<base::RefCountedString> html_bytes = new base::RefCountedString;
html_bytes->data().assign(html.begin(), html.end());
callback.Run(html_bytes.get());
« chrome/browser/ssl/ssl_blocking_page.cc ('K') | « chrome/browser/ssl/ssl_error_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698