Chromium Code Reviews| Index: chrome/browser/resources/security_warnings/safe_browsing.js |
| diff --git a/chrome/browser/resources/security_warnings/safe_browsing.js b/chrome/browser/resources/security_warnings/safe_browsing.js |
| index 3673da5ceefcc616a57118fa3d285c562b05d3a0..8283d6bec35e91189fcf5413ddcf2ba3624ad838 100644 |
| --- a/chrome/browser/resources/security_warnings/safe_browsing.js |
| +++ b/chrome/browser/resources/security_warnings/safe_browsing.js |
| @@ -12,13 +12,24 @@ var SB_CMD_SHOW_DIAGNOSTIC = 'showDiagnostic'; |
| var SB_CMD_SHOW_PRIVACY = 'showPrivacy'; |
| var SB_CMD_TAKE_ME_BACK = 'takeMeBack'; |
| -// Other constants defined in safe_browsing_blocking_page.cc. |
| +// Must match SSLBlockingPageCommands in ssl_blocking_page.h. |
|
felt
2015/02/19 00:32:32
Hmm, seems unfortunate to have SSLBlockingPageComm
estark
2015/02/19 02:32:08
Hm, when you say "setupCheckbox should be moved" y
felt
2015/02/24 01:57:52
Yes, renaming it to extended_reporting.js could wo
estark
2015/02/24 18:47:08
Done.
|
| +var SSL_CMD_DO_REPORT = 6; |
| +var SSL_CMD_DONT_REPORT = 7; |
| + |
| +// 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. |
| -function setupCheckbox() { |
| - if (loadTimeData.getString('type') != 'SAFEBROWSING' || |
| +// This sets up the Extended Safe Browsing Reporting opt-in, either for |
| +// reporting malware or invalid certificate chains, depending on which |
| +// |type| is passed in. |type| can be 'SAFEBROWSING' or |
| +// 'SSL' (to set up the invalid cert collection checkbox). |
| +function setupCheckbox(type) { |
| + if (type != 'SAFEBROWSING' && type != 'SSL') { |
|
felt
2015/02/19 00:32:32
what other type might this be? what are you checki
estark
2015/02/19 02:32:08
Oops, this check was blatantly wrong: replaced it
|
| + throw new Error('setupCheckbox called for invalid interstitial.'); |
| + } |
| + |
| + if (loadTimeData.getString('type') != type || |
|
felt
2015/02/19 00:32:32
if you're going to check loadTimeData.getString('t
estark
2015/02/19 02:32:08
Done.
|
| !loadTimeData.getBoolean(SB_DISPLAY_CHECK_BOX)) { |
| return; |
| } |
| @@ -29,7 +40,13 @@ function setupCheckbox() { |
| $('body').classList.add('safe-browsing-has-checkbox'); |
| $('opt-in-checkbox').addEventListener('click', function() { |
| - sendCommand( |
| - $('opt-in-checkbox').checked ? SB_CMD_DO_REPORT : SB_CMD_DONT_REPORT); |
| + var command; |
| + if ($('opt-in-checkbox').checked) { |
| + command = type == 'SAFEBROWSING' ? SB_CMD_DO_REPORT : SSL_CMD_DO_REPORT; |
| + } else { |
| + command = type == 'SAFEBROWSING' ? |
| + SB_CMD_DONT_REPORT : SSL_CMD_DONT_REPORT; |
| + } |
| + sendCommand(command); |
| }); |
| } |