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

Side by Side Diff: components/security_interstitials/core/browser/resources/interstitial_v2.js

Issue 2257173005: Add "learn more" links to SSL and SB interstitials (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update browser tests Created 4 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This is the shared code for the new (Chrome 37) security interstitials. It is 5 // This is the shared code for the new (Chrome 37) security interstitials. It is
6 // used for both SSL interstitials and Safe Browsing interstitials. 6 // used for both SSL interstitials and Safe Browsing interstitials.
7 7
8 var expandedDetails = false; 8 var expandedDetails = false;
9 var keyPressState = 0; 9 var keyPressState = 0;
10 10
11 // Should match SecurityInterstitialCommands in security_interstitial_page.h 11 // Should match security_interstitials::SecurityInterstitialCommands
12 var CMD_DONT_PROCEED = 0; 12 var CMD_DONT_PROCEED = 0;
13 var CMD_PROCEED = 1; 13 var CMD_PROCEED = 1;
14 // Ways for user to get more information 14 // Ways for user to get more information
15 var CMD_SHOW_MORE_SECTION = 2; 15 var CMD_SHOW_MORE_SECTION = 2;
16 var CMD_OPEN_HELP_CENTER = 3; 16 var CMD_OPEN_HELP_CENTER = 3;
17 var CMD_OPEN_DIAGNOSTIC = 4; 17 var CMD_OPEN_DIAGNOSTIC = 4;
18 // Primary button actions 18 // Primary button actions
19 var CMD_RELOAD = 5; 19 var CMD_RELOAD = 5;
20 var CMD_OPEN_DATE_SETTINGS = 6; 20 var CMD_OPEN_DATE_SETTINGS = 6;
21 var CMD_OPEN_LOGIN = 7; 21 var CMD_OPEN_LOGIN = 7;
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 // Captive portal page isn't overridable. 146 // Captive portal page isn't overridable.
147 $('proceed-link').addEventListener('click', function(event) { 147 $('proceed-link').addEventListener('click', function(event) {
148 sendCommand(CMD_PROCEED); 148 sendCommand(CMD_PROCEED);
149 }); 149 });
150 } else if (!ssl) { 150 } else if (!ssl) {
151 $('final-paragraph').classList.add('hidden'); 151 $('final-paragraph').classList.add('hidden');
152 } 152 }
153 153
154 if (ssl && overridable) { 154 if (ssl && overridable) {
155 $('proceed-link').classList.add('small-link'); 155 $('proceed-link').classList.add('small-link');
156 } else if ($('help-link')) { 156 }
157 // Overridable SSL page doesn't have this link. 157
158 $('help-link').addEventListener('click', function(event) { 158 if ($('diagnostic-link')) {
159 if (ssl || loadTimeData.getBoolean('phishing')) 159 $('diagnostic-link').addEventListener('click', function(event) {
160 sendCommand(CMD_OPEN_HELP_CENTER); 160 sendCommand(CMD_OPEN_DIAGNOSTIC);
161 else
162 sendCommand(CMD_OPEN_DIAGNOSTIC);
163 }); 161 });
164 } 162 }
165 163
164 if ($('learn-more-link')) {
165 $('learn-more-link').addEventListener('click', function(event) {
166 sendCommand(CMD_OPEN_HELP_CENTER);
167 });
168 }
169
166 if (captivePortal) { 170 if (captivePortal) {
167 // Captive portal page doesn't have details button. 171 // Captive portal page doesn't have details button.
168 $('details-button').classList.add('hidden'); 172 $('details-button').classList.add('hidden');
169 } else { 173 } else {
170 $('details-button').addEventListener('click', function(event) { 174 $('details-button').addEventListener('click', function(event) {
171 var hiddenDetails = $('details').classList.toggle('hidden'); 175 var hiddenDetails = $('details').classList.toggle('hidden');
172 176
173 if (mobileNav) { 177 if (mobileNav) {
174 // Details appear over the main content on small screens. 178 // Details appear over the main content on small screens.
175 $('main-content').classList.toggle('hidden', !hiddenDetails); 179 $('main-content').classList.toggle('hidden', !hiddenDetails);
(...skipping 21 matching lines...) Expand all
197 }); 201 });
198 } 202 }
199 203
200 preventDefaultOnPoundLinkClicks(); 204 preventDefaultOnPoundLinkClicks();
201 setupExtendedReportingCheckbox(); 205 setupExtendedReportingCheckbox();
202 setupSSLDebuggingInfo(); 206 setupSSLDebuggingInfo();
203 document.addEventListener('keypress', handleKeypress); 207 document.addEventListener('keypress', handleKeypress);
204 } 208 }
205 209
206 document.addEventListener('DOMContentLoaded', setupEvents); 210 document.addEventListener('DOMContentLoaded', setupEvents);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698