Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1201)

Unified Diff: chrome/browser/resources/security_warnings/extended_reporting.js

Issue 935663004: Add checkbox for reporting invalid TLS/SSL cert chains (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: revert accidental deletion (fixes failing CaptivePortal tests) Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..51b4b21c4f9d8a7655cd1e6c4411f04f46705717
--- /dev/null
+++ b/chrome/browser/resources/security_warnings/extended_reporting.js
@@ -0,0 +1,40 @@
+// 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';
+ $('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);
+ });
+}

Powered by Google App Engine
This is Rietveld 408576698