OLD | NEW |
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 | 9 |
10 function setupEvents() { | 10 function setupEvents() { |
(...skipping 13 matching lines...) Expand all Loading... |
24 else | 24 else |
25 sendCommand(CMD_RELOAD); | 25 sendCommand(CMD_RELOAD); |
26 }); | 26 }); |
27 | 27 |
28 if (overridable) { | 28 if (overridable) { |
29 $('proceed-link').addEventListener('click', function(event) { | 29 $('proceed-link').addEventListener('click', function(event) { |
30 sendCommand(ssl ? CMD_PROCEED : SB_CMD_PROCEED); | 30 sendCommand(ssl ? CMD_PROCEED : SB_CMD_PROCEED); |
31 }); | 31 }); |
32 } | 32 } |
33 | 33 |
34 if (!(ssl && overridable)) { // Overridable SSL page doesn't have this link. | 34 if (ssl && overridable) { |
| 35 $('proceed-link').classList.add('small-link'); |
| 36 } else { |
| 37 // Overridable SSL page doesn't have this link. |
35 $('help-link').addEventListener('click', function(event) { | 38 $('help-link').addEventListener('click', function(event) { |
36 if (ssl) | 39 if (ssl) |
37 sendCommand(CMD_HELP); | 40 sendCommand(CMD_HELP); |
38 else if (loadTimeData.getBoolean('phishing')) | 41 else if (loadTimeData.getBoolean('phishing')) |
39 sendCommand(SB_CMD_REPORT_ERROR); | 42 sendCommand(SB_CMD_REPORT_ERROR); |
40 else | 43 else |
41 sendCommand(SB_CMD_SHOW_DIAGNOSTIC); | 44 sendCommand(SB_CMD_SHOW_DIAGNOSTIC); |
42 }); | 45 }); |
43 | 46 |
44 $('error-code').textContent = loadTimeData.getString('errorCode'); | 47 $('error-code').textContent = loadTimeData.getString('errorCode'); |
45 $('error-code').classList.remove('hidden'); | 48 $('error-code').classList.remove('hidden'); |
46 } | 49 } |
47 | 50 |
48 $('details-button').addEventListener('click', function(event) { | 51 $('details-button').addEventListener('click', function(event) { |
49 var hiddenDetails = $('details').classList.toggle('hidden'); | 52 var hiddenDetails = $('details').classList.toggle('hidden'); |
50 $('details-button').innerText = hiddenDetails ? | 53 $('details-button').innerText = hiddenDetails ? |
51 loadTimeData.getString('openDetails') : | 54 loadTimeData.getString('openDetails') : |
52 loadTimeData.getString('closeDetails'); | 55 loadTimeData.getString('closeDetails'); |
53 if (!expandedDetails) { | 56 if (!expandedDetails) { |
54 // Record a histogram entry only the first time that details is opened. | 57 // Record a histogram entry only the first time that details is opened. |
55 sendCommand(ssl ? CMD_MORE : SB_CMD_EXPANDED_SEE_MORE); | 58 sendCommand(ssl ? CMD_MORE : SB_CMD_EXPANDED_SEE_MORE); |
56 expandedDetails = true; | 59 expandedDetails = true; |
57 } | 60 } |
58 }); | 61 }); |
59 | 62 |
60 preventDefaultOnPoundLinkClicks(); | 63 preventDefaultOnPoundLinkClicks(); |
61 } | 64 } |
62 | 65 |
63 document.addEventListener('DOMContentLoaded', setupEvents); | 66 document.addEventListener('DOMContentLoaded', setupEvents); |
OLD | NEW |