Chromium Code Reviews| Index: chrome/browser/resources/security_warnings/extended_reporting.js |
| diff --git a/chrome/browser/resources/security_warnings/extended_reporting.js b/chrome/browser/resources/security_warnings/extended_reporting.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..ac38a6bbe6eaa165e1a0f40c2b4c7cffd84d2cd2 |
| --- /dev/null |
| +++ b/chrome/browser/resources/security_warnings/extended_reporting.js |
| @@ -0,0 +1,38 @@ |
| +// Copyright 2015 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. |
| + |
| +'use strict'; |
| + |
| +// Other constants defined in security_interstitial_page.h. |
| +var SB_BOX_CHECKED = 'boxchecked'; |
| +var SB_DISPLAY_CHECK_BOX = 'displaycheckbox'; |
| + |
| +// This sets up the Extended Safe Browsing Reporting opt-in, either for |
| +// reporting malware or invalid certificate chains. Does nothing if the |
| +// interstitial type is not SAFEBROWSING or SSL. |
| +function setupExtendedReportingCheckbox() { |
| + var interstitialType = loadTimeData.getString('type'); |
| + if (interstitialType != 'SAFEBROWSING' && interstitialType != 'SSL') { |
| + return; |
| + } |
| + |
| + if (!loadTimeData.getBoolean(SB_DISPLAY_CHECK_BOX)) { |
| + return; |
| + } |
| + |
| + $('opt-in-label').innerHTML = loadTimeData.getString('optInLink'); |
| + $('opt-in-checkbox').checked = loadTimeData.getBoolean(SB_BOX_CHECKED); |
| + $('extended-reporting-opt-in').classList.remove('hidden'); |
| + |
| + var className = interstitialType == 'SAFEBROWSING' ? 'safe-browsing-opt-in' : |
| + 'ssl-opt-in'; |
|
Ryan Sleevi
2015/03/25 04:49:45
Don't think this seems consistent with https://goo
estark
2015/03/25 05:34:33
Done.
|
| + $('extended-reporting-opt-in').classList.add(className); |
| + |
| + $('body').classList.add('extended-reporting-has-checkbox'); |
| + |
| + $('opt-in-checkbox').addEventListener('click', function() { |
| + sendCommand( |
| + $('opt-in-checkbox').checked ? CMD_DO_REPORT : CMD_DONT_REPORT); |
|
Ryan Sleevi
2015/03/25 04:49:45
ditto this
estark
2015/03/25 05:34:33
Done.
|
| + }); |
| +} |