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.
7 // Other constants defined in security_interstitial_page.h.
8 var SB_BOX_CHECKED = 'boxchecked';
9 var SB_DISPLAY_CHECK_BOX = 'displaycheckbox';
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 or CAPTIVE_PORTAL.
14 function setupExtendedReportingCheckbox() {
15 var interstitialType = loadTimeData.getString('type');
16 if (interstitialType != 'SAFEBROWSING' && interstitialType != 'SSL' &&
17 interstitialType != 'CAPTIVE_PORTAL') {
21 if (!loadTimeData.getBoolean(SB_DISPLAY_CHECK_BOX)) {
25 $('opt-in-label').innerHTML = loadTimeData.getString('optInLink');
26 $('opt-in-checkbox').checked = loadTimeData.getBoolean(SB_BOX_CHECKED);
27 $('extended-reporting-opt-in').classList.remove('hidden');
29 var className = interstitialType == 'SAFEBROWSING' ?
30 'safe-browsing-opt-in' :
32 $('extended-reporting-opt-in').classList.add(className);
34 $('body').classList.add('extended-reporting-has-checkbox');
36 $('opt-in-checkbox').addEventListener('click', function() {
37 sendCommand($('opt-in-checkbox').checked ?