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 setupFinch() { |
| 42 var condition = $('trial-type').innerHTML; |
| 43 if (condition == '') { |
| 44 return; // This is the most common case. |
| 45 } else if (condition == 'Cond2MalwareNoBrand' || |
| 46 condition == 'Cond4PhishingNoBrand') { |
| 47 $('logo').style.display = 'none'; |
| 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 } else if (condition == 'Cond7MalwareFearMsg') { |
| 54 $('headline').innerText = 'Your computer might get malware if you ' + |
| 55 'proceed. Go back!'; |
| 56 } else if (condition == 'Cond8PhishingFearMsg') { |
| 57 $('headline').innerText = 'You might be the victim of a phishing attack ' + |
| 58 'if you proceed. Go back!'; |
| 59 } else if (condition == 'Cond9MalwareCollabMsg') { |
| 60 $('headline').innerText = 'Help Google stop the spread of malware. ' + |
| 61 'Go back!'; |
| 62 } else if (condition == 'Cond10PhishingCollabMsg') { |
| 63 $('headline').innerText = 'Help Google stop phishing attacks. ' + |
| 64 'Go back!'; |
| 65 } else if (condition == 'Cond11MalwareQuestion') { |
| 66 $('headline').innerText = 'Do you want to infect your computer with a ' + |
| 67 'virus? If not, go back!'; |
| 68 } else if (condition == 'Cond12PhishingQuestion') { |
| 69 $('headline').innerText = 'Do you want to be the victim of a phishing ' + |
| 70 'attack? If not, go back!'; |
| 71 } else if (condition == 'Cond13MalwareGoBack') { |
| 72 $('headline').innerText = 'The Website Ahead Contains Malware! ' + |
| 73 'Go Back!'; |
| 74 } else if (condition == 'Cond14PhishingGoBack') { |
| 75 $('headline').innerText = 'Reported Phishing Website Ahead! ' + |
| 76 'Go Back!'; |
| 77 } |
| 78 } |
| 79 |
41 /** | 80 /** |
42 * Onload listener to initialize javascript handlers. | 81 * Onload listener to initialize javascript handlers. |
43 */ | 82 */ |
44 document.addEventListener('DOMContentLoaded', function() { | 83 document.addEventListener('DOMContentLoaded', function() { |
45 $('proceed-span').hidden = templateData.proceedDisabled; | 84 $('proceed-span').hidden = templateData.proceedDisabled; |
46 | 85 |
47 $('back').onclick = function() { | 86 $('back').onclick = function() { |
48 sendCommand('takeMeBack'); | 87 sendCommand('takeMeBack'); |
49 }; | 88 }; |
50 $('proceed').onclick = function(e) { | 89 $('proceed').onclick = function(e) { |
(...skipping 13 matching lines...) Expand all Loading... |
64 // preventDefaultOnPoundLinkClicks doesn't work for this link since it | 103 // preventDefaultOnPoundLinkClicks doesn't work for this link since it |
65 // contains <span>s, which confuse preventDefaultOnPoundLinkClicks. | 104 // contains <span>s, which confuse preventDefaultOnPoundLinkClicks. |
66 e.preventDefault(); | 105 e.preventDefault(); |
67 }; | 106 }; |
68 $('check-report').onclick = savePreference; | 107 $('check-report').onclick = savePreference; |
69 | 108 |
70 // All the links are handled by javascript sending commands back to the C++ | 109 // All the links are handled by javascript sending commands back to the C++ |
71 // handler, we don't want the default actions. | 110 // handler, we don't want the default actions. |
72 preventDefaultOnPoundLinkClicks(); // From webui/js/util.js. | 111 preventDefaultOnPoundLinkClicks(); // From webui/js/util.js. |
73 | 112 |
| 113 setupFinch(); |
| 114 |
74 // Allow jsdisplay elements to be visible now. | 115 // Allow jsdisplay elements to be visible now. |
75 document.documentElement.classList.remove('loading'); | 116 document.documentElement.classList.remove('loading'); |
76 }); | 117 }); |
OLD | NEW |