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_DO_REPORT = 'doReport'; | |
| 7 var SB_CMD_DONT_REPORT = 'dontReport'; | |
| 8 var SB_CMD_EXPANDED_SEE_MORE = 'expandedSeeMore'; | |
| 9 var SB_CMD_LEARN_MORE_2 = 'learnMore2'; | |
| 10 var SB_CMD_PROCEED = 'proceed'; | |
| 11 var SB_CMD_REPORT_ERROR = 'reportError'; | |
| 12 var SB_CMD_SHOW_DIAGNOSTIC = 'showDiagnostic'; | |
| 13 var SB_CMD_SHOW_PRIVACY = 'showPrivacy'; | |
| 14 var SB_CMD_TAKE_ME_BACK = 'takeMeBack'; | |
| 15 | |
| 16 // Other constants defined in safe_browsing_blocking_page.cc. | |
| 17 var SB_BOX_CHECKED = 'boxchecked'; | |
| 18 var SB_DISPLAY_CHECK_BOX = 'displaycheckbox'; | |
| 19 | |
| 20 function applyMalwareStyle() { | |
|
mattm
2014/06/10 23:37:08
It's confusing that "malware" is used to refer to
felt
2014/06/11 00:12:09
I've renamed this (and all the CSS classes) to saf
| |
| 21 // Dynamically add the second and third paragraphs. | |
| 22 var secondParagraph = document.createTextNode( | |
| 23 loadTimeData.getString('secondParagraph')); | |
| 24 $('second-paragraph').appendChild(secondParagraph); | |
| 25 if (!loadTimeData.getBoolean('phishing')) { | |
| 26 var thirdParagraph = document.createTextNode( | |
| 27 loadTimeData.getString('thirdParagraph')); | |
| 28 $('third-paragraph').appendChild(thirdParagraph); | |
| 29 } | |
| 30 | |
| 31 // Add the link to the diagnostic page (malware) or reporting (phishing). | |
| 32 // TODO(felt): Put the link definition into the grd file once we have new | |
| 33 // wording. | |
| 34 var detailsText = document.createTextNode( | |
| 35 loadTimeData.getString('detailsText')); | |
| 36 var detailsLink = document.createElement('a'); | |
| 37 detailsLink.setAttribute('href', '#'); | |
| 38 detailsLink.setAttribute('id', 'help-link'); | |
| 39 detailsLink.appendChild(detailsText); | |
| 40 $('explanation-paragraph').appendChild(detailsLink); | |
| 41 | |
| 42 // Add the link to proceed. | |
| 43 if (loadTimeData.getBoolean('overridable')) { | |
| 44 var proceedText = document.createTextNode( | |
| 45 loadTimeData.getString('proceedText')); | |
| 46 var proceedLink = document.createElement('a'); | |
| 47 proceedLink.setAttribute('href', '#'); | |
| 48 proceedLink.setAttribute('id', 'proceed-link'); | |
| 49 proceedLink.appendChild(proceedText); | |
| 50 $('final-paragraph').appendChild(proceedLink); | |
| 51 } | |
| 52 | |
| 53 // Swap in the appropriate styling. | |
| 54 $('body').classList.add('malware'); | |
| 55 | |
| 56 // Remove the 'hidden' class from the paragraphs that we use. | |
| 57 $('second-paragraph').classList.toggle('hidden'); | |
| 58 if (!loadTimeData.getBoolean('phishing')) | |
| 59 $('third-paragraph').classList.toggle('hidden'); | |
| 60 $('explanation-paragraph').classList.toggle('hidden'); | |
| 61 $('final-paragraph').classList.toggle('hidden'); | |
| 62 } | |
| OLD | NEW |