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

Unified Diff: chrome/browser/resources/safe_browsing/malware_block_v2.js

Issue 10855260: Safe Browsing malware interstitial redesign field trial. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix compile warning Created 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/safe_browsing/malware_block_v2.js
diff --git a/chrome/browser/resources/safe_browsing/malware_block_v2.js b/chrome/browser/resources/safe_browsing/malware_block_v2.js
new file mode 100644
index 0000000000000000000000000000000000000000..50a2a442a749436261eb9434d540d51815abbc0b
--- /dev/null
+++ b/chrome/browser/resources/safe_browsing/malware_block_v2.js
@@ -0,0 +1,70 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/**
+ * Sends a command message to SafeBrowsingBlockingPage::CommandReceived.
+ * @param {string} cmd The command to send.
+ */
+function sendCommand(cmd) {
+ window.domAutomationController.setAutomationId(1);
+ window.domAutomationController.send(cmd);
+}
+
+/**
+ * Records state of the reporting checkbox.
+ */
+function savePreference() {
+ var checkBox = $('check-report');
+ if (checkBox.checked)
+ sendCommand('doReport');
+ else
+ sendCommand('dontReport');
+}
+
+/**
+ * Expands or collapses the "see more" section of the page.
+ */
+function seeMore() {
+ if ($('see-less-text').hidden) {
+ $('see-more-text').hidden = true;
+ $('see-less-text').hidden = false;
+ $('see-more-contents').hidden = false;
+ sendCommand('expandedSeeMore');
+ } else {
+ $('see-more-text').hidden = false;
+ $('see-less-text').hidden = true;
+ $('see-more-contents').hidden = true;
+ }
+}
+
+/**
+ * Onload listener to initialize javascript handlers.
+ */
+document.addEventListener('DOMContentLoaded', function() {
+ $('proceed-span').hidden = templateData.proceedDisabled;
+
+ $('back').onclick = function() {
+ sendCommand('takeMeBack');
+ };
+ $('proceed').onclick = function(e) {
+ sendCommand('proceed');
+ };
+ $('learn-more-link').onclick = function(e) {
+ sendCommand('learnMore2');
+ };
+ $('show-diagnostic-link').onclick = function(e) {
+ sendCommand('showDiagnostic');
+ };
+ $('see-more-link').onclick = function(e) {
+ seeMore();
+ // preventDefaultOnPoundLinkClicks doesn't work for this link since it
+ // contains <span>s, which confuse preventDefaultOnPoundLinkClicks.
arv (Not doing code reviews) 2012/08/23 14:20:25 preventDefaultOnPoundLinkClicks can be fixed to ha
+ e.preventDefault();
+ };
+ $('check-report').onclick = savePreference;
+
+ // All the links are handled by javascript sending commands back to the C++
+ // handler, we don't want the default actions.
+ preventDefaultOnPoundLinkClicks(); // From shared/js/util.js.
+});

Powered by Google App Engine
This is Rietveld 408576698