Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 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 'use strict'; | |
| 6 | |
| 7 // Must match the commands handled by SafeBrowsingBlockingPage::CommandReceived. | |
|
mattm
2015/03/17 20:58:12
This file also needs to be updated for the command
estark
2015/03/18 15:57:18
Done.
| |
| 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_SHOW_DIAGNOSTIC = 'showDiagnostic'; | |
| 14 var SB_CMD_SHOW_PRIVACY = 'showPrivacy'; | |
| 15 var SB_CMD_TAKE_ME_BACK = 'takeMeBack'; | |
| 16 | |
| 17 // Other constants defined in security_interstitial_page.h. | |
| 18 var SB_BOX_CHECKED = 'boxchecked'; | |
| 19 var SB_DISPLAY_CHECK_BOX = 'displaycheckbox'; | |
| 20 | |
| 21 // This sets up the Extended Safe Browsing Reporting opt-in, either for | |
| 22 // reporting malware or invalid certificate chains. Does nothing if the | |
| 23 // interstitial type is not SAFEBROWSING or SSL. | |
| 24 function setupExtendedReportingCheckbox() { | |
| 25 var interstitialType = loadTimeData.getString('type'); | |
| 26 if (interstitialType != 'SAFEBROWSING' && interstitialType != 'SSL') { | |
| 27 return; | |
| 28 } | |
| 29 | |
| 30 if (!loadTimeData.getBoolean(SB_DISPLAY_CHECK_BOX)) { | |
| 31 return; | |
| 32 } | |
| 33 | |
| 34 $('opt-in-label').innerHTML = loadTimeData.getString('optInLink'); | |
| 35 $('opt-in-checkbox').checked = loadTimeData.getBoolean(SB_BOX_CHECKED); | |
| 36 $('extended-reporting-opt-in').classList.remove('hidden'); | |
| 37 | |
| 38 var className = interstitialType == 'SAFEBROWSING' ? 'safe-browsing-opt-in' : | |
| 39 'ssl-opt-in'; | |
| 40 $('extended-reporting-opt-in').classList.add(className); | |
| 41 | |
| 42 $('body').classList.add('extended-reporting-has-checkbox'); | |
| 43 | |
| 44 $('opt-in-checkbox').addEventListener('click', function() { | |
| 45 var command; | |
| 46 if ($('opt-in-checkbox').checked) { | |
| 47 command = interstitialType == 'SAFEBROWSING' ? | |
| 48 SB_CMD_DO_REPORT : SSL_CMD_DO_REPORT; | |
| 49 } else { | |
| 50 command = interstitialType == 'SAFEBROWSING' ? | |
| 51 SB_CMD_DONT_REPORT : SSL_CMD_DONT_REPORT; | |
| 52 } | |
| 53 sendCommand(command); | |
| 54 }); | |
| 55 } | |
| OLD | NEW |