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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This is the shared code for the new (Chrome 37) security interstitials. It is 5 // This is the shared code for the new (Chrome 37) security interstitials. It is
6 // used for both SSL interstitials and Safe Browsing interstitials. 6 // used for both SSL interstitials and Safe Browsing interstitials.
7 7
8 var expandedDetails = false; 8 var expandedDetails = false;
9 var keyPressState = 0;
10
11 function $(o) {
12 return document.getElementById(o);
13 }
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.
14
15 // A convenience method for sending commands to the parent page.
16 function sendCommand(cmd) {
17 window.domAutomationController.setAutomationId(1);
18 window.domAutomationController.send(cmd);
19 }
20
21 // This allows errors to be skippped by typing "danger" into the page.
22 function keyPressHandler(e) {
23 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.
24 if (sequence.charCodeAt(keyPressState) == e.keyCode) {
25 keyPressState++;
26 if (keyPressState == sequence.length) {
27 sendCommand(CMD_PROCEED);
28 keyPressState = 0;
29 }
30 } else {
31 keyPressState = 0;
32 }
33 }
9 34
10 function setupEvents() { 35 function setupEvents() {
11 var overridable = loadTimeData.getBoolean('overridable'); 36 var overridable = loadTimeData.getBoolean('overridable');
12 var ssl = loadTimeData.getBoolean('ssl'); 37 var ssl = loadTimeData.getBoolean('ssl');
13 38
14 if (ssl) { 39 if (ssl) {
15 $('body').classList.add('ssl'); 40 $('body').classList.add('ssl');
16 $('error-code').textContent = loadTimeData.getString('errorCode'); 41 $('error-code').textContent = loadTimeData.getString('errorCode');
17 $('error-code').classList.remove('hidden'); 42 $('error-code').classList.remove('hidden');
18 } else { 43 } else {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 loadTimeData.getString('closeDetails'); 88 loadTimeData.getString('closeDetails');
64 if (!expandedDetails) { 89 if (!expandedDetails) {
65 // Record a histogram entry only the first time that details is opened. 90 // Record a histogram entry only the first time that details is opened.
66 sendCommand(ssl ? CMD_MORE : SB_CMD_EXPANDED_SEE_MORE); 91 sendCommand(ssl ? CMD_MORE : SB_CMD_EXPANDED_SEE_MORE);
67 expandedDetails = true; 92 expandedDetails = true;
68 } 93 }
69 }); 94 });
70 95
71 preventDefaultOnPoundLinkClicks(); 96 preventDefaultOnPoundLinkClicks();
72 setupCheckbox(); 97 setupCheckbox();
98 document.addEventListener('keypress', keyPressHandler);
Dan Beam 2014/08/19 03:06:11 nit: handleKeypress or onKeypress
felt 2014/08/19 03:24:07 Done.
73 } 99 }
74 100
75 document.addEventListener('DOMContentLoaded', setupEvents); 101 document.addEventListener('DOMContentLoaded', setupEvents);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698