OLD | NEW |
---|---|
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 Loading... | |
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 function setupInterstitialExperiment() { | |
James Hawkins
2013/05/03 18:31:55
nit: Document method.
felt
2013/05/03 18:43:25
Done.
| |
42 var condition = templateData.trialType; | |
43 if (condition == '' || condition == 'Default') { | |
44 return; // This is the most common case. | |
45 } else if (condition == 'cond2MalwareNoBrand' || | |
46 condition == 'cond4PhishingNoBrand') { | |
47 $('logo').style.display = 'none'; | |
James Hawkins
2013/05/03 18:31:55
Why display none instead of hidden?
felt
2013/05/03 18:43:25
Hidden would leave extra empty whitespace, right?
| |
48 } else if (condition == 'cond5MalwareOneStep' || | |
49 condition == 'cond6PhishingOneStep') { | |
50 $('see-more-contents').hidden = false; | |
51 $('see-less-text').hidden = true; | |
52 $('see-more-text').hidden = true; | |
53 } | |
54 } | |
55 | |
41 /** | 56 /** |
42 * Onload listener to initialize javascript handlers. | 57 * Onload listener to initialize javascript handlers. |
43 */ | 58 */ |
44 document.addEventListener('DOMContentLoaded', function() { | 59 document.addEventListener('DOMContentLoaded', function() { |
45 $('proceed-span').hidden = templateData.proceedDisabled; | 60 $('proceed-span').hidden = templateData.proceedDisabled; |
46 | 61 |
47 $('back').onclick = function() { | 62 $('back').onclick = function() { |
48 sendCommand('takeMeBack'); | 63 sendCommand('takeMeBack'); |
49 }; | 64 }; |
50 $('proceed').onclick = function(e) { | 65 $('proceed').onclick = function(e) { |
(...skipping 13 matching lines...) Expand all Loading... | |
64 // preventDefaultOnPoundLinkClicks doesn't work for this link since it | 79 // preventDefaultOnPoundLinkClicks doesn't work for this link since it |
65 // contains <span>s, which confuse preventDefaultOnPoundLinkClicks. | 80 // contains <span>s, which confuse preventDefaultOnPoundLinkClicks. |
66 e.preventDefault(); | 81 e.preventDefault(); |
67 }; | 82 }; |
68 $('check-report').onclick = savePreference; | 83 $('check-report').onclick = savePreference; |
69 | 84 |
70 // All the links are handled by javascript sending commands back to the C++ | 85 // All the links are handled by javascript sending commands back to the C++ |
71 // handler, we don't want the default actions. | 86 // handler, we don't want the default actions. |
72 preventDefaultOnPoundLinkClicks(); // From webui/js/util.js. | 87 preventDefaultOnPoundLinkClicks(); // From webui/js/util.js. |
73 | 88 |
89 setupInterstitialExperiment(); | |
90 | |
74 // Allow jsdisplay elements to be visible now. | 91 // Allow jsdisplay elements to be visible now. |
75 document.documentElement.classList.remove('loading'); | 92 document.documentElement.classList.remove('loading'); |
76 }); | 93 }); |
OLD | NEW |