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 50ae66bb1aa363731b304ffd2094985370ac9dde..c250196b48d6ef379d7692b15121cd67c1ede6e0 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 |
+ applySafeBrowsingStyle(); |
$('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,13 +27,18 @@ function setupEvents() { |
if (overridable) { |
$('proceed-link').addEventListener('click', function(event) { |
- sendCommand(CMD_PROCEED); |
- event.preventDefault(); |
+ sendCommand(ssl ? CMD_PROCEED : SB_CMD_PROCEED); |
}); |
- } else { |
+ } |
+ |
+ 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); |
}); |
$('error-code').textContent = loadTimeData.getString('errorCode'); |
@@ -36,11 +52,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); |