Chromium Code Reviews| 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); |