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..6db2e757d75bd2782f80a9c5c9ddeaaea79c451c |
--- /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_BOX_CHECKED = 'boxchecked'; |
+var SB_CMD_DISPLAY_CHECK = 'displaycheckbox'; |
Bernhard Bauer
2014/06/09 14:45:41
Hm, this is called kDisplayCheckBox in safe_browsi
felt
2014/06/09 15:24:02
These need to be JS style though right? I was tryi
Bernhard Bauer
2014/06/09 15:43:00
Yes, but with _BOX at the end please.
felt
2014/06/09 16:55:27
Done. Apparently my brain cannot see the differenc
|
+var SB_CMD_DO_REPORT = 'doReport'; |
+var SB_CMD_DONT_REPORT = 'dontReport'; |
+var SB_CMD_EXPANDED_MORE = 'expandedSeeMore'; |
+var SB_CMD_GO_BACK = 'takeMeBack'; |
Bernhard Bauer
2014/06/09 14:45:41
This one is called kTakeMeBackCommand.
felt
2014/06/09 15:24:02
Done.
|
+var SB_CMD_LEARN_MORE = 'learnMore2'; |
Bernhard Bauer
2014/06/09 14:45:42
This one is called kLearnMoreCommandV2.
felt
2014/06/09 15:24:02
Done.
|
+var SB_CMD_PROCEED = 'proceed'; |
+var SB_CMD_REPORT_ERROR = 'reportError'; |
+var SB_CMD_SHOW_DIAGNOSTIC = 'showDiagnostic'; |
+var SB_CMD_SHOW_PRIVACY = 'showPrivacy'; |
+ |
+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')); |
+ 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'); |
+} |