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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
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.
5 function sendCommand(cmd) {
6 window.domAutomationController.setAutomationId(1);
7 window.domAutomationController.send(cmd);
8 }
9
10 function savePreference() {
11 var checkBox = $('check-report');
12 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.
13 sendCommand('doReport');
14 } else {
15 sendCommand('dontReport');
16 }
17 }
18
19 function seeMore() {
20 if ($('see-less-text').hidden) {
21 $('see-more-text').hidden = true;
22 $('see-less-text').hidden = false;
23 $('see-more-contents').hidden = false;
24 sendCommand('expandedSeeMore');
25 } else {
26 $('see-more-text').hidden = false;
27 $('see-less-text').hidden = true;
28 $('see-more-contents').hidden = true;
29 }
30 }
31
32 /**
33 * 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
34 * @param {Event} e The event which triggered the handler.
35 */
36 document.oncontextmenu = function(e) {
37 e.preventDefault();
38 };
39
40 /**
41 * Onload listener to initialize javascript handlers.
42 */
43 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.
44 $('back').onclick = function() {
45 sendCommand('takeMeBack');
46 }
Dan Beam 2012/08/22 02:34:03 }; (after all these function expressions)
mattm 2012/08/22 20:33:47 Done.
47 $('proceed').onclick = function(e) {
48 sendCommand('proceed');
49 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.
50 }
51 $('learn-more-link').onclick = function(e) {
52 sendCommand('learnMore2');
53 e.preventDefault();
54 }
55 $('show-diagnostic-link').onclick = function(e) {
56 sendCommand('showDiagnostic');
57 e.preventDefault();
58 }
59 $('see-more-link').onclick = function(e) {
60 seeMore();
61 e.preventDefault();
62 }
63 $('check-report').onclick = savePreference;
64
65 preventDefaultOnPoundLinkClicks(); // From shared/js/util.js.
66 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698