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

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: webui style fixes 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..3b10886018d7bb56056738dc5fed4e7c35fde02b
--- /dev/null
+++ b/chrome/browser/resources/safe_browsing/malware_block_v2.js
@@ -0,0 +1,66 @@
+// 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.
+
Dan Beam 2012/08/22 02:34:03 might want to add a doc comment (i.e. /** This is
mattm 2012/08/22 20:33:47 Done.
+function sendCommand(cmd) {
+ window.domAutomationController.setAutomationId(1);
+ window.domAutomationController.send(cmd);
+}
+
+function savePreference() {
+ var checkBox = $('check-report');
+ if (checkBox.checked) {
Dan Beam 2012/08/22 02:34:03 nit: no curlies for 1-liners at every level (condi
mattm 2012/08/22 20:33:47 Done.
+ sendCommand('doReport');
+ } else {
+ sendCommand('dontReport');
+ }
+}
+
+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;
+ }
+}
+
+/**
+ * Context menu handler to disable context menu during interstitial.
arv (Not doing code reviews) 2012/08/22 14:33:45 Why?
mattm 2012/08/22 20:33:47 I think it's because some browser functions don't
+ * @param {Event} e The event which triggered the handler.
+ */
+document.oncontextmenu = function(e) {
+ e.preventDefault();
+};
+
+/**
+ * Onload listener to initialize javascript handlers.
+ */
+window.onload = function() {
arv (Not doing code reviews) 2012/08/22 14:33:45 DOMContentLoaded is faster http://ie.microsoft.co
mattm 2012/08/22 20:33:47 Done.
+ $('back').onclick = function() {
+ sendCommand('takeMeBack');
+ }
Dan Beam 2012/08/22 02:34:03 }; (after all these function expressions)
mattm 2012/08/22 20:33:47 Done.
+ $('proceed').onclick = function(e) {
+ sendCommand('proceed');
+ e.preventDefault();
Dan Beam 2012/08/22 02:34:03 none of these need prevenDefault() if they're simp
arv (Not doing code reviews) 2012/08/22 14:33:45 Another rule is to never have a preventDefault or
mattm 2012/08/22 20:33:47 Removed them all except for the 'see-more-link' on
mattm 2012/08/22 20:33:47 Done.
+ }
+ $('learn-more-link').onclick = function(e) {
+ sendCommand('learnMore2');
+ e.preventDefault();
+ }
+ $('show-diagnostic-link').onclick = function(e) {
+ sendCommand('showDiagnostic');
+ e.preventDefault();
+ }
+ $('see-more-link').onclick = function(e) {
+ seeMore();
+ e.preventDefault();
+ }
+ $('check-report').onclick = savePreference;
+
+ preventDefaultOnPoundLinkClicks(); // From shared/js/util.js.
+};

Powered by Google App Engine
This is Rietveld 408576698