Chromium Code Reviews| Index: chrome/browser/resources/safe_browsing/safe_browsing_v3.js |
| diff --git a/chrome/browser/resources/safe_browsing/safe_browsing_v3.js b/chrome/browser/resources/safe_browsing/safe_browsing_v3.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c6ca348f0521423de8ec78650135ba72782bbcfe |
| --- /dev/null |
| +++ b/chrome/browser/resources/safe_browsing/safe_browsing_v3.js |
| @@ -0,0 +1,63 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +// Must match the commands handled by SafeBrowsingBlockingPage::CommandReceived. |
| +var SB_CMD_SHOW_DIAGNOSTIC = 'showDiagnostic'; |
|
Bernhard Bauer
2014/06/09 10:04:02
Sort these alphabetically? It might also make sens
felt
2014/06/09 14:24:09
I sorted them alphabetically. I don't want to rena
|
| +var SB_CMD_REPORT_ERROR = 'reportError'; |
| +var SB_CMD_LEARN_MORE = 'learnMore2'; |
| +var SB_CMD_SHOW_PRIVACY = 'showPrivacy'; |
| +var SB_CMD_PROCEED = 'proceed'; |
| +var SB_CMD_GO_BACK = 'takeMeBack'; |
| +var SB_CMD_DO_REPORT = 'doReport'; |
| +var SB_CMD_DONT_REPORT = 'dontReport'; |
| +var SB_CMD_DISPLAY_CHECK = 'displaycheckbox'; |
| +var SB_CMD_BOX_CHECKED = 'boxchecked'; |
| +var SB_CMD_EXPANDED_MORE = 'expandedSeeMore'; |
| + |
| +function applyMalwareStyle() { |
| + // Dynamically add the second and third paragraphs. |
| + var secondParagraph = document.createTextNode( |
| + loadTimeData.getString('secondParagraph')); |
| + $('second-paragraph').appendChild(secondParagraph); |
| + if (!loadTimeData.getBoolean('phishing')) { |
| + var thirdParagraph = document.createTextNode( |
| + loadTimeData.getString('thirdParagraph')); |
| + $('third-paragraph').appendChild(thirdParagraph); |
| + } |
| + |
| + // Add the link to the diagnostic page (malware) or reporting (phishing). |
| + var detailsText = document.createTextNode( |
| + loadTimeData.getString('detailsText')); |
|
Bernhard Bauer
2014/06/09 10:04:03
Could you put this into the template and hide it i
felt
2014/06/09 14:24:09
If I put it into the template, I get JS console er
Bernhard Bauer
2014/06/09 14:45:41
Hm, set the value to an empty string otherwise?
felt
2014/06/09 15:24:02
Sorry, I just realized that I was thinking of some
|
| + var detailsLink = document.createElement('a'); |
| + detailsLink.setAttribute('href', '#'); |
| + detailsLink.setAttribute('id', 'help-link'); |
| + detailsLink.appendChild(detailsText); |
| + $('explanation-paragraph').appendChild(detailsLink); |
| + |
| + // Add the link to proceed. |
| + if (loadTimeData.getBoolean('overridable')) { |
| + var proceedText = document.createTextNode( |
| + loadTimeData.getString('proceedText')); |
| + var proceedLink = document.createElement('a'); |
| + proceedLink.setAttribute('href', '#'); |
| + proceedLink.setAttribute('id', 'proceed-link'); |
| + proceedLink.appendChild(proceedText); |
| + $('final-paragraph').appendChild(proceedLink); |
| + } |
| + |
| + // Make the background red. |
| + $('icon').classList.add('icon-malware'); |
| + $('body').classList.add('body-red'); |
| + $('primary-button').classList.add('button-red'); |
| + var links = document.getElementsByTagName('a'); |
| + for (var i = 0; i < links.length; i++) |
| + links[i].classList.add('a-red'); |
| + |
| + // Remove the 'hidden' class from the paragraphs that we use. |
| + $('second-paragraph').classList.toggle('hidden'); |
| + if (!loadTimeData.getBoolean('phishing')) |
| + $('third-paragraph').classList.toggle('hidden'); |
| + $('explanation-paragraph').classList.toggle('hidden'); |
| + $('final-paragraph').classList.toggle('hidden'); |
| +} |