OLD | NEW |
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 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 sendCommand(SB_CMD_SHOW_DIAGNOSTIC); | 132 sendCommand(SB_CMD_SHOW_DIAGNOSTIC); |
133 }); | 133 }); |
134 } | 134 } |
135 | 135 |
136 if (captivePortal) { | 136 if (captivePortal) { |
137 // Captive portal page doesn't have details button. | 137 // Captive portal page doesn't have details button. |
138 $('details-button').classList.add('hidden'); | 138 $('details-button').classList.add('hidden'); |
139 } else { | 139 } else { |
140 $('details-button').addEventListener('click', function(event) { | 140 $('details-button').addEventListener('click', function(event) { |
141 var hiddenDetails = $('details').classList.toggle('hidden'); | 141 var hiddenDetails = $('details').classList.toggle('hidden'); |
142 | |
143 if (mobileNav) { | |
144 // Details appear over the main content on small screens. | |
145 $('main-content').classList.toggle('hidden', !hiddenDetails); | |
146 } else { | |
147 $('main-content').classList.remove('hidden'); | |
148 } | |
149 | |
150 $('details-button').innerText = hiddenDetails ? | 142 $('details-button').innerText = hiddenDetails ? |
151 loadTimeData.getString('openDetails') : | 143 loadTimeData.getString('openDetails') : |
152 loadTimeData.getString('closeDetails'); | 144 loadTimeData.getString('closeDetails'); |
153 if (!expandedDetails) { | 145 if (!expandedDetails) { |
154 // Record a histogram entry only the first time that details is opened. | 146 // Record a histogram entry only the first time that details is opened. |
155 sendCommand(ssl ? SSL_CMD_MORE : SB_CMD_EXPANDED_SEE_MORE); | 147 sendCommand(ssl ? SSL_CMD_MORE : SB_CMD_EXPANDED_SEE_MORE); |
156 expandedDetails = true; | 148 expandedDetails = true; |
157 } | 149 } |
158 }); | 150 }); |
159 } | 151 } |
160 | 152 |
161 preventDefaultOnPoundLinkClicks(); | 153 preventDefaultOnPoundLinkClicks(); |
162 setupCheckbox(); | 154 setupCheckbox(); |
163 setupSSLDebuggingInfo(); | 155 setupSSLDebuggingInfo(); |
164 document.addEventListener('keypress', handleKeypress); | 156 document.addEventListener('keypress', handleKeypress); |
165 } | 157 } |
166 | 158 |
167 document.addEventListener('DOMContentLoaded', setupEvents); | 159 document.addEventListener('DOMContentLoaded', setupEvents); |
OLD | NEW |