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

Unified Diff: chrome/browser/resources/security_warnings/interstitial_v2.js

Issue 480393002: Move the security interstitials into a single folder (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Working Created 6 years, 4 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/resources/security_warnings/interstitial_v2.js
diff --git a/chrome/browser/resources/ssl/interstitial_v2.js b/chrome/browser/resources/security_warnings/interstitial_v2.js
similarity index 77%
rename from chrome/browser/resources/ssl/interstitial_v2.js
rename to chrome/browser/resources/security_warnings/interstitial_v2.js
index dbe4e24b6469dbc1eea928babe1825053bb1128a..9b1d1449b3e8058523c0a99a008045f43d5eb51b 100644
--- a/chrome/browser/resources/ssl/interstitial_v2.js
+++ b/chrome/browser/resources/security_warnings/interstitial_v2.js
@@ -6,6 +6,31 @@
// used for both SSL interstitials and Safe Browsing interstitials.
var expandedDetails = false;
+var keyPressState = 0;
+
+function $(o) {
+ return document.getElementById(o);
+}
Dan Beam 2014/08/19 03:06:11 ^ why is this needed? wasn't this already defined
felt 2014/08/19 03:24:06 Done.
+
+// A convenience method for sending commands to the parent page.
+function sendCommand(cmd) {
+ window.domAutomationController.setAutomationId(1);
+ window.domAutomationController.send(cmd);
+}
+
+// This allows errors to be skippped by typing "danger" into the page.
+function keyPressHandler(e) {
+ var sequence = 'danger';
Dan Beam 2014/08/19 03:06:11 nit: BYPASS_SEQUENCE or something in ALL_CAPS and
felt 2014/08/19 03:24:06 Done.
+ if (sequence.charCodeAt(keyPressState) == e.keyCode) {
+ keyPressState++;
+ if (keyPressState == sequence.length) {
+ sendCommand(CMD_PROCEED);
+ keyPressState = 0;
+ }
+ } else {
+ keyPressState = 0;
+ }
+}
function setupEvents() {
var overridable = loadTimeData.getBoolean('overridable');
@@ -70,6 +95,7 @@ function setupEvents() {
preventDefaultOnPoundLinkClicks();
setupCheckbox();
+ document.addEventListener('keypress', keyPressHandler);
Dan Beam 2014/08/19 03:06:11 nit: handleKeypress or onKeypress
felt 2014/08/19 03:24:07 Done.
}
document.addEventListener('DOMContentLoaded', setupEvents);

Powered by Google App Engine
This is Rietveld 408576698