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

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: Changes for dbeam 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 78%
rename from chrome/browser/resources/ssl/interstitial_v2.js
rename to chrome/browser/resources/security_warnings/interstitial_v2.js
index dbe4e24b6469dbc1eea928babe1825053bb1128a..d77c530968053830ad08667c49f1fda8bbf3ae24 100644
--- a/chrome/browser/resources/ssl/interstitial_v2.js
+++ b/chrome/browser/resources/security_warnings/interstitial_v2.js
@@ -6,6 +6,27 @@
// used for both SSL interstitials and Safe Browsing interstitials.
var expandedDetails = false;
+var keyPressState = 0;
+
+// A convenience method for sending commands to the parent page.
Dan Beam 2014/08/19 16:55:10 nit: // ... -> /* ... * @param {..
felt 2014/08/19 21:04:51 Done.
+function sendCommand(cmd) {
+ window.domAutomationController.setAutomationId(1);
+ window.domAutomationController.send(cmd);
+}
+
+// This allows errors to be skippped by typing "danger" into the page.
Dan Beam 2014/08/19 16:55:10 same
felt 2014/08/19 21:04:51 Done.
+function handleKeypress(e) {
+ var BYPASS_SEQUENCE = 'danger';
+ if (BYPASS_SEQUENCE.charCodeAt(keyPressState) == e.keyCode) {
+ keyPressState++;
+ if (keyPressState == BYPASS_SEQUENCE.length) {
+ sendCommand(CMD_PROCEED);
+ keyPressState = 0;
+ }
+ } else {
+ keyPressState = 0;
+ }
+}
function setupEvents() {
var overridable = loadTimeData.getBoolean('overridable');
@@ -70,6 +91,7 @@ function setupEvents() {
preventDefaultOnPoundLinkClicks();
setupCheckbox();
+ document.addEventListener('keypress', handleKeypress);
}
document.addEventListener('DOMContentLoaded', setupEvents);

Powered by Google App Engine
This is Rietveld 408576698