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

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: Added comments 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 75%
rename from chrome/browser/resources/ssl/interstitial_v2.js
rename to chrome/browser/resources/security_warnings/interstitial_v2.js
index dbe4e24b6469dbc1eea928babe1825053bb1128a..0da23b75ebbc62df85ffb1c03238e5d2cadaaa67 100644
--- a/chrome/browser/resources/ssl/interstitial_v2.js
+++ b/chrome/browser/resources/security_warnings/interstitial_v2.js
@@ -6,6 +6,33 @@
// 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.
+ * @param {string} cmd The command to send.
+ */
+function sendCommand(cmd) {
+ window.domAutomationController.setAutomationId(1);
+ window.domAutomationController.send(cmd);
+}
+
+/*
+ * This allows errors to be skippped by typing "danger" into the page.
+ * @param {string} e The key that was just pressed.
+ */
+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 +97,7 @@ function setupEvents() {
preventDefaultOnPoundLinkClicks();
setupCheckbox();
+ document.addEventListener('keypress', handleKeypress);
}
document.addEventListener('DOMContentLoaded', setupEvents);

Powered by Google App Engine
This is Rietveld 408576698