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..38045370b9f9b9d7c30a1323a20e1927e7ca8cc5 100644 |
--- a/chrome/browser/resources/ssl/interstitial_v2.js |
+++ b/chrome/browser/resources/ssl/interstitial_v2.js |
@@ -2,13 +2,24 @@ |
// 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) |
+ if (!ssl) |
+ sendCommand(SB_CMD_TAKE_ME_BACK); |
+ else if (overridable) |
sendCommand(CMD_DONT_PROCEED); |
else |
sendCommand(CMD_RELOAD); |
@@ -16,15 +27,18 @@ function setupEvents() { |
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 +49,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_SEE_MORE); |
expandedDetails = true; |
} |
- event.preventDefault(); |
}); |
+ |
+ preventDefaultOnPoundLinkClicks(); |
} |
document.addEventListener('DOMContentLoaded', setupEvents); |