Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 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 | |
| 5 // Must match the commands handled by SafeBrowsingBlockingPage::CommandReceived. | |
| 6 var SB_CMD_BOX_CHECKED = 'boxchecked'; | |
| 7 var SB_CMD_DISPLAY_CHECK_BOX = 'displaycheckbox'; | |
| 8 var SB_CMD_DO_REPORT = 'doReport'; | |
| 9 var SB_CMD_DONT_REPORT = 'dontReport'; | |
| 10 var SB_CMD_EXPANDED_SEE_MORE = 'expandedSeeMore'; | |
| 11 var SB_CMD_LEARN_MORE_2 = 'learnMore2'; | |
| 12 var SB_CMD_PROCEED = 'proceed'; | |
| 13 var SB_CMD_REPORT_ERROR = 'reportError'; | |
| 14 var SB_CMD_SHOW_DIAGNOSTIC = 'showDiagnostic'; | |
| 15 var SB_CMD_SHOW_PRIVACY = 'showPrivacy'; | |
| 16 var SB_CMD_TAKE_ME_BACK = 'takeMeBack'; | |
| 17 | |
| 18 function applyMalwareStyle() { | |
| 19 // Dynamically add the second and third paragraphs. | |
| 20 var secondParagraph = document.createTextNode( | |
| 21 loadTimeData.getString('secondParagraph')); | |
| 22 $('second-paragraph').appendChild(secondParagraph); | |
| 23 if (!loadTimeData.getBoolean('phishing')) { | |
| 24 var thirdParagraph = document.createTextNode( | |
| 25 loadTimeData.getString('thirdParagraph')); | |
| 26 $('third-paragraph').appendChild(thirdParagraph); | |
| 27 } | |
| 28 | |
| 29 // Add the link to the diagnostic page (malware) or reporting (phishing). | |
| 30 // TODO(felt): Put the link definition into the grd file once we have new | |
| 31 // wording. | |
| 32 var detailsText = document.createTextNode( | |
| 33 loadTimeData.getString('detailsText')); | |
| 34 var detailsLink = document.createElement('a'); | |
| 35 detailsLink.setAttribute('href', '#'); | |
| 36 detailsLink.setAttribute('id', 'help-link'); | |
| 37 detailsLink.appendChild(detailsText); | |
| 38 $('explanation-paragraph').appendChild(detailsLink); | |
| 39 | |
| 40 // Add the link to proceed. | |
| 41 if (loadTimeData.getBoolean('overridable')) { | |
| 42 var proceedText = document.createTextNode( | |
| 43 loadTimeData.getString('proceedText')); | |
| 44 var proceedLink = document.createElement('a'); | |
| 45 proceedLink.setAttribute('href', '#'); | |
| 46 proceedLink.setAttribute('id', 'proceed-link'); | |
| 47 proceedLink.appendChild(proceedText); | |
| 48 $('final-paragraph').appendChild(proceedLink); | |
| 49 } | |
| 50 | |
| 51 // Make the background red. | |
| 52 $('icon').classList.add('icon-malware'); | |
| 53 $('body').classList.add('body-red'); | |
| 54 $('primary-button').classList.add('button-red'); | |
| 55 var links = document.getElementsByTagName('a'); | |
| 56 for (var i = 0; i < links.length; i++) | |
| 57 links[i].classList.add('a-red'); | |
|
edwardjung
2014/06/09 18:37:29
It'll be cleaner to just add a single class to the
felt
2014/06/10 05:21:02
Good idea, done.
| |
| 58 | |
| 59 // Remove the 'hidden' class from the paragraphs that we use. | |
| 60 $('second-paragraph').classList.toggle('hidden'); | |
| 61 if (!loadTimeData.getBoolean('phishing')) | |
| 62 $('third-paragraph').classList.toggle('hidden'); | |
| 63 $('explanation-paragraph').classList.toggle('hidden'); | |
| 64 $('final-paragraph').classList.toggle('hidden'); | |
| 65 } | |
| OLD | NEW |