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

Side by Side Diff: chrome/browser/resources/safe_browsing/malware_block_v2.js

Issue 14752005: Finch experiments on SSL, malware, and phishing interstitials (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Browsertest trybot fix Created 7 years, 7 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * Sends a command message to SafeBrowsingBlockingPage::CommandReceived. 6 * Sends a command message to SafeBrowsingBlockingPage::CommandReceived.
7 * @param {string} cmd The command to send. 7 * @param {string} cmd The command to send.
8 */ 8 */
9 function sendCommand(cmd) { 9 function sendCommand(cmd) {
10 window.domAutomationController.setAutomationId(1); 10 window.domAutomationController.setAutomationId(1);
(...skipping 20 matching lines...) Expand all
31 $('see-less-text').hidden = false; 31 $('see-less-text').hidden = false;
32 $('see-more-contents').hidden = false; 32 $('see-more-contents').hidden = false;
33 sendCommand('expandedSeeMore'); 33 sendCommand('expandedSeeMore');
34 } else { 34 } else {
35 $('see-more-text').hidden = false; 35 $('see-more-text').hidden = false;
36 $('see-less-text').hidden = true; 36 $('see-less-text').hidden = true;
37 $('see-more-contents').hidden = true; 37 $('see-more-contents').hidden = true;
38 } 38 }
39 } 39 }
40 40
41 /* This sets up 4 conditions for the Field Trial.
42 * The 'NoBrand' conditions don't have the Chrome/Chromium logo at the top.
43 * The 'OneStep' conditions don't hide the proceed button.
44 */
45 function setupInterstitialExperiment() {
46 var condition = templateData.trialType;
47 if (condition == '' || condition == 'Default') {
48 return; // This is the most common case.
Dan Beam 2013/05/07 08:07:16 make this 1 line, don't use } else { after a retur
49 } else if (condition == 'cond2MalwareNoBrand' ||
50 condition == 'cond4PhishingNoBrand') {
51 $('logo').style.display = 'none';
Dan Beam 2013/05/07 08:07:16 why are you using .display = 'none'; here vs. hidd
52 } else if (condition == 'cond5MalwareOneStep' ||
53 condition == 'cond6PhishingOneStep') {
54 $('see-more-contents').hidden = false;
55 $('see-less-text').hidden = true;
56 $('see-more-text').hidden = true;
57 }
58 }
59
41 /** 60 /**
42 * Onload listener to initialize javascript handlers. 61 * Onload listener to initialize javascript handlers.
43 */ 62 */
44 document.addEventListener('DOMContentLoaded', function() { 63 document.addEventListener('DOMContentLoaded', function() {
45 $('proceed-span').hidden = templateData.proceedDisabled; 64 $('proceed-span').hidden = templateData.proceedDisabled;
46 65
47 $('back').onclick = function() { 66 $('back').onclick = function() {
48 sendCommand('takeMeBack'); 67 sendCommand('takeMeBack');
49 }; 68 };
50 $('proceed').onclick = function(e) { 69 $('proceed').onclick = function(e) {
(...skipping 13 matching lines...) Expand all
64 // preventDefaultOnPoundLinkClicks doesn't work for this link since it 83 // preventDefaultOnPoundLinkClicks doesn't work for this link since it
65 // contains <span>s, which confuse preventDefaultOnPoundLinkClicks. 84 // contains <span>s, which confuse preventDefaultOnPoundLinkClicks.
66 e.preventDefault(); 85 e.preventDefault();
67 }; 86 };
68 $('check-report').onclick = savePreference; 87 $('check-report').onclick = savePreference;
69 88
70 // All the links are handled by javascript sending commands back to the C++ 89 // All the links are handled by javascript sending commands back to the C++
71 // handler, we don't want the default actions. 90 // handler, we don't want the default actions.
72 preventDefaultOnPoundLinkClicks(); // From webui/js/util.js. 91 preventDefaultOnPoundLinkClicks(); // From webui/js/util.js.
73 92
93 setupInterstitialExperiment();
94
74 // Allow jsdisplay elements to be visible now. 95 // Allow jsdisplay elements to be visible now.
75 document.documentElement.classList.remove('loading'); 96 document.documentElement.classList.remove('loading');
76 }); 97 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698