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 // Other constants defined in security_interstitial_page.h. |
| 8 var SB_BOX_CHECKED = 'boxchecked'; |
| 9 var SB_DISPLAY_CHECK_BOX = 'displaycheckbox'; |
| 10 |
| 11 // This sets up the Extended Safe Browsing Reporting opt-in, either for |
| 12 // reporting malware or invalid certificate chains. Does nothing if the |
| 13 // interstitial type is not SAFEBROWSING or SSL. |
| 14 function setupExtendedReportingCheckbox() { |
| 15 var interstitialType = loadTimeData.getString('type'); |
| 16 if (interstitialType != 'SAFEBROWSING' && interstitialType != 'SSL') { |
| 17 return; |
| 18 } |
| 19 |
| 20 if (!loadTimeData.getBoolean(SB_DISPLAY_CHECK_BOX)) { |
| 21 return; |
| 22 } |
| 23 |
| 24 $('opt-in-label').innerHTML = loadTimeData.getString('optInLink'); |
| 25 $('opt-in-checkbox').checked = loadTimeData.getBoolean(SB_BOX_CHECKED); |
| 26 $('extended-reporting-opt-in').classList.remove('hidden'); |
| 27 |
| 28 var className = interstitialType == 'SAFEBROWSING' ? |
| 29 'safe-browsing-opt-in' : |
| 30 'ssl-opt-in'; |
| 31 $('extended-reporting-opt-in').classList.add(className); |
| 32 |
| 33 $('body').classList.add('extended-reporting-has-checkbox'); |
| 34 |
| 35 $('opt-in-checkbox').addEventListener('click', function() { |
| 36 sendCommand($('opt-in-checkbox').checked ? |
| 37 CMD_DO_REPORT : |
| 38 CMD_DONT_REPORT); |
| 39 }); |
| 40 } |
OLD | NEW |