Chromium Code Reviews| Index: chrome/browser/resources/ssl/interstitial_v2.js |
| diff --git a/chrome/browser/resources/ssl/interstitial_v2.js b/chrome/browser/resources/ssl/interstitial_v2.js |
| index 99344ee8817551c61b2c651d2e8a2f1bef0a05a5..7050e31c028e263c71fc08b64b48319ac3ffe525 100644 |
| --- a/chrome/browser/resources/ssl/interstitial_v2.js |
| +++ b/chrome/browser/resources/ssl/interstitial_v2.js |
| @@ -2,29 +2,41 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| +// This is the shared code for the new (Chrome 37) security interstitials. It is |
| +// used for both SSL interstitials and Safe Browsing interstitials. |
| + |
| var expandedDetails = false; |
| function setupEvents() { |
| var overridable = loadTimeData.getBoolean('overridable'); |
| + var ssl = loadTimeData.getBoolean('ssl'); |
| + |
| + if (ssl) |
| + applySSLStyle(); |
| + else |
| + applyMalwareStyle(); |
| $('primary-button').addEventListener('click', function() { |
| - if (overridable) |
| - sendCommand(CMD_DONT_PROCEED); |
| - else |
| + if (!overridable && ssl) |
| sendCommand(CMD_RELOAD); |
| + else |
| + sendCommand(ssl ? CMD_DONT_PROCEED : SB_CMD_GO_BACK); |
|
Bernhard Bauer
2014/06/09 10:04:03
I think you could reorder this as
if (!ssl)
felt
2014/06/09 14:24:09
Done.
|
| }); |
| if (overridable) { |
| $('proceed-link').addEventListener('click', function(event) { |
| - sendCommand(CMD_PROCEED); |
| - event.preventDefault(); |
| + sendCommand(ssl ? CMD_PROCEED : SB_CMD_PROCEED); |
| }); |
| } |
| - if (!overridable) { |
| + if (!(ssl && overridable)) { // Overridable SSL page doesn't have this link. |
| $('help-link').addEventListener('click', function(event) { |
| - sendCommand(CMD_HELP); |
| - event.preventDefault(); |
| + if (ssl) |
| + sendCommand(CMD_HELP); |
| + else if (loadTimeData.getBoolean('phishing')) |
| + sendCommand(SB_CMD_REPORT_ERROR); |
| + else |
| + sendCOmmand(SB_CMD_SHOW_DIAGNOSTIC); |
| }); |
| } |
| @@ -35,11 +47,12 @@ function setupEvents() { |
| loadTimeData.getString('closeDetails'); |
| if (!expandedDetails) { |
| // Record a histogram entry only the first time that details is opened. |
| - sendCommand(CMD_MORE); |
| + sendCommand(ssl ? CMD_MORE : SB_CMD_EXPANDED_MORE); |
| expandedDetails = true; |
| } |
| - event.preventDefault(); |
| }); |
| + |
| + preventDefaultOnPoundLinkClicks(); |
| } |
| document.addEventListener('DOMContentLoaded', setupEvents); |