OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 /** | 5 /** |
6 * @constructor | 6 * @constructor |
7 * @extends {WebInspector.PanelWithSidebar} | 7 * @extends {WebInspector.PanelWithSidebar} |
8 * @implements {WebInspector.TargetManager.Observer} | 8 * @implements {WebInspector.TargetManager.Observer} |
9 */ | 9 */ |
10 WebInspector.SecurityPanel = function() { | 10 WebInspector.SecurityPanel = function() |
11 { | |
11 WebInspector.PanelWithSidebar.call(this, "security"); | 12 WebInspector.PanelWithSidebar.call(this, "security"); |
12 this.registerRequiredCSS("security/securityPanel.css"); | 13 this.registerRequiredCSS("security/securityPanel.css"); |
13 this.registerRequiredCSS("security/lockIcon.css"); | 14 this.registerRequiredCSS("security/lockIcon.css"); |
14 | 15 |
15 var sidebarTree = new TreeOutlineInShadow(); | 16 var sidebarTree = new TreeOutlineInShadow(); |
16 sidebarTree.element.classList.add("sidebar-tree"); | 17 sidebarTree.element.classList.add("sidebar-tree"); |
17 this.panelSidebarElement().appendChild(sidebarTree.element); | 18 this.panelSidebarElement().appendChild(sidebarTree.element); |
19 sidebarTree.registerRequiredCSS("security/sidebar.css"); | |
18 sidebarTree.registerRequiredCSS("security/lockIcon.css"); | 20 sidebarTree.registerRequiredCSS("security/lockIcon.css"); |
19 this.setDefaultFocusedElement(sidebarTree.element); | 21 this.setDefaultFocusedElement(sidebarTree.element); |
20 | 22 |
21 this._sidebarMainViewElement = new WebInspector.SecurityMainViewSidebarTreeE lement(this); | 23 this._sidebarMainViewElement = new WebInspector.SecurityMainViewSidebarTreeE lement(this); |
22 sidebarTree.appendChild(this._sidebarMainViewElement); | 24 sidebarTree.appendChild(this._sidebarMainViewElement); |
23 | 25 |
26 // TODO(lgarron): Add a section for the main origin. (https://crbug.com/5235 86) | |
27 this._sidebarOriginSection = new WebInspector.SidebarSectionTreeElement(WebI nspector.UIString("Origins")); | |
28 this._sidebarOriginSection.listItemElement.classList.add("security-sidebar-o rigins"); | |
29 sidebarTree.appendChild(this._sidebarOriginSection); | |
30 | |
24 this._mainView = new WebInspector.SecurityMainView(); | 31 this._mainView = new WebInspector.SecurityMainView(); |
25 this.showMainView(); | |
26 | 32 |
27 /** @type {!Map<string, !{securityState: !SecurityAgent.SecurityState, secur ityDetails: ?NetworkAgent.SecurityDetails}>} */ | 33 /** @type {!Map<!WebInspector.SecurityPanel.Origin, !WebInspector.SecurityPa nel.OriginState>} */ |
28 this._origins = new Map(); | 34 this._origins = new Map(); |
29 WebInspector.targetManager.addEventListener(WebInspector.ResourceTreeModel.E ventTypes.InspectedURLChanged, this._clear, this); | 35 // TODO(lgarron): add event listeners to call _clear() once we figure out ho w to clear the panel properly (https://crbug.com/522762). |
30 WebInspector.targetManager.addEventListener(WebInspector.ResourceTreeModel.E ventTypes.WillReloadPage, this._clear, this); | |
31 WebInspector.targetManager.addEventListener(WebInspector.ResourceTreeModel.E ventTypes.MainFrameNavigated, this._clear, this); | |
32 | 36 |
33 WebInspector.targetManager.observeTargets(this); | 37 WebInspector.targetManager.observeTargets(this); |
34 } | 38 } |
35 | 39 |
40 /** @typedef {string} */ | |
41 WebInspector.SecurityPanel.Origin; | |
42 | |
43 /** | |
44 * @typedef {Object} | |
45 * @property {!SecurityAgent.SecurityState} securityState - Current security state of the origin. | |
46 * @property {!NetworkAgent.SecurityDetails} securityDetails - Security details of the origin, if available. | |
47 * @property {?NetworkAgent.CertificateDetails} securityDetails.certificateDetai ls - Certificate details of the origin (attached to security details), if availa ble. | |
48 * @property {?WebInspector.SecurityOriginView} originView - Current SecurityOriginView corresponding to origin. | |
49 */ | |
50 WebInspector.SecurityPanel.OriginState; | |
lgarron
2015/08/25 21:03:07
dgozman@: I've added this definition to use in the
dgozman
2015/08/25 23:26:50
Looks good, but don't align the field names (simil
| |
51 | |
36 WebInspector.SecurityPanel.prototype = { | 52 WebInspector.SecurityPanel.prototype = { |
37 | 53 |
38 /** | 54 /** |
39 * @param {!SecurityAgent.SecurityState} newSecurityState | 55 * @param {!SecurityAgent.SecurityState} newSecurityState |
40 * @param {!Array<!SecurityAgent.SecurityStateExplanation>} explanations | 56 * @param {!Array<!SecurityAgent.SecurityStateExplanation>} explanations |
41 */ | 57 */ |
42 _updateSecurityState: function(newSecurityState, explanations) | 58 _updateSecurityState: function(newSecurityState, explanations) |
43 { | 59 { |
44 this._sidebarMainViewElement.setSecurityState(newSecurityState); | 60 this._sidebarMainViewElement.setSecurityState(newSecurityState); |
45 this._mainView.updateSecurityState(newSecurityState, explanations); | 61 this._mainView.updateSecurityState(newSecurityState, explanations); |
46 }, | 62 }, |
47 | 63 |
48 /** | 64 /** |
49 * @param {!WebInspector.Event} event | 65 * @param {!WebInspector.Event} event |
50 */ | 66 */ |
51 _onSecurityStateChanged: function(event) | 67 _onSecurityStateChanged: function(event) |
52 { | 68 { |
53 var securityState = /** @type {!SecurityAgent.SecurityState} */ (event.d ata.securityState); | 69 var securityState = /** @type {!SecurityAgent.SecurityState} */ (event.d ata.securityState); |
54 var explanations = /** @type {!Array<!SecurityAgent.SecurityStateExplana tion>} */ (event.data.explanations); | 70 var explanations = /** @type {!Array<!SecurityAgent.SecurityStateExplana tion>} */ (event.data.explanations); |
55 this._updateSecurityState(securityState, explanations); | 71 this._updateSecurityState(securityState, explanations); |
56 }, | 72 }, |
57 | 73 |
58 showMainView: function() | 74 showMainView: function() |
59 { | 75 { |
60 this._setVisibleView(this._mainView); | 76 this._setVisibleView(this._mainView); |
61 }, | 77 }, |
62 | 78 |
63 /** | 79 /** |
80 * @param {!WebInspector.SecurityPanel.Origin} origin | |
81 */ | |
82 showOrigin: function(origin) | |
83 { | |
84 var originState = this._origins.get(origin); | |
85 if (!originState.originView) | |
86 originState.originView = new WebInspector.SecurityOriginView(this, o rigin, originState.securityState, originState.securityDetails); | |
87 | |
88 this._setVisibleView(originState.originView); | |
89 }, | |
90 | |
91 wasShown: function() | |
92 { | |
93 WebInspector.Panel.prototype.wasShown.call(this); | |
94 if (!this._visibleView) | |
95 this._sidebarMainViewElement.select(); | |
96 }, | |
97 | |
98 /** | |
64 * @param {!WebInspector.VBox} view | 99 * @param {!WebInspector.VBox} view |
65 */ | 100 */ |
66 _setVisibleView: function(view) | 101 _setVisibleView: function(view) |
67 { | 102 { |
68 if (this._visibleView === view) | 103 if (this._visibleView === view) |
69 return; | 104 return; |
70 | 105 |
71 if (this._visibleView) | 106 if (this._visibleView) |
72 this._visibleView.detach(); | 107 this._visibleView.detach(); |
73 | 108 |
74 this._visibleView = view; | 109 this._visibleView = view; |
75 | 110 |
76 if (view) | 111 if (view) |
77 this.splitWidget().setMainWidget(view); | 112 this.splitWidget().setMainWidget(view); |
78 }, | 113 }, |
79 | 114 |
80 /** | 115 /** |
81 * @param {!WebInspector.Event} event | 116 * @param {!WebInspector.Event} event |
82 */ | 117 */ |
83 _onResponseReceivedSecurityDetails: function(event) | 118 _onResponseReceivedSecurityDetails: function(event) |
84 { | 119 { |
85 var data = event.data; | 120 var data = event.data; |
86 var origin = /** @type {string} */ (data.origin); | 121 var origin = /** @type {string} */ (data.origin); |
87 var securityState = /** @type {!SecurityAgent.SecurityState} */ (data.se curityState); | 122 var securityState = /** @type {!SecurityAgent.SecurityState} */ (data.se curityState); |
88 | 123 |
89 if (this._origins.has(origin)) { | 124 if (this._origins.has(origin)) { |
90 var originData = this._origins.get(origin); | 125 var originState = this._origins.get(origin); |
91 originData.securityState = this._securityStateMin(originData.securit yState, securityState); | 126 var oldSecurityState = originState.securityState; |
127 originState.securityState = this._securityStateMin(oldSecurityState, securityState); | |
128 if (oldSecurityState != originState.securityState) { | |
129 originState.sidebarElement.setSecurityState(securityState); | |
130 if (originState.originView) | |
131 originState.originView.setSecurityState(securityState); | |
132 } | |
92 } else { | 133 } else { |
93 // TODO(lgarron): Store a (deduplicated) list of different security details we have seen. | 134 // TODO(lgarron): Store a (deduplicated) list of different security details we have seen. https://crbug.com/503170 |
94 var originData = {}; | 135 var originState = {}; |
95 originData.securityState = securityState; | 136 originState.securityState = securityState; |
96 if (data.securityDetails) | 137 if (data.securityDetails) |
97 originData.securityDetails = data.securityDetails; | 138 originState.securityDetails = data.securityDetails; |
98 | 139 |
99 this._origins.set(origin, originData); | 140 this._origins.set(origin, originState); |
141 | |
142 originState.sidebarElement = new WebInspector.SecurityOriginViewSide barTreeElement(this, origin); | |
143 this._sidebarOriginSection.appendChild(originState.sidebarElement); | |
144 originState.sidebarElement.setSecurityState(securityState); | |
145 | |
146 // Don't construct the origin view yet (let it happen lazily). | |
100 } | 147 } |
101 }, | 148 }, |
102 | 149 |
103 /** | 150 /** |
104 * @param {!SecurityAgent.SecurityState} stateA | 151 * @param {!SecurityAgent.SecurityState} stateA |
105 * @param {!SecurityAgent.SecurityState} stateB | 152 * @param {!SecurityAgent.SecurityState} stateB |
106 * @return {!SecurityAgent.SecurityState} | 153 * @return {!SecurityAgent.SecurityState} |
107 */ | 154 */ |
108 _securityStateMin: function(stateA, stateB) | 155 _securityStateMin: function(stateA, stateB) |
109 { | 156 { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
141 this._networkManager.removeEventListener(WebInspector.NetworkManager .EventTypes.ResponseReceivedSecurityDetails, this._onResponseReceivedSecurityDet ails, this); | 188 this._networkManager.removeEventListener(WebInspector.NetworkManager .EventTypes.ResponseReceivedSecurityDetails, this._onResponseReceivedSecurityDet ails, this); |
142 delete this._networkManager; | 189 delete this._networkManager; |
143 delete this._target; | 190 delete this._target; |
144 this._clear(); | 191 this._clear(); |
145 } | 192 } |
146 }, | 193 }, |
147 | 194 |
148 _clear: function() | 195 _clear: function() |
149 { | 196 { |
150 this._updateSecurityState(SecurityAgent.SecurityState.Unknown, []); | 197 this._updateSecurityState(SecurityAgent.SecurityState.Unknown, []); |
198 this._sidebarMainViewElement.select(); | |
199 this._sidebarOriginSection.removeChildren(); | |
151 this._origins.clear(); | 200 this._origins.clear(); |
152 }, | 201 }, |
153 | 202 |
154 __proto__: WebInspector.PanelWithSidebar.prototype | 203 __proto__: WebInspector.PanelWithSidebar.prototype |
155 } | 204 } |
156 | 205 |
157 /** | 206 /** |
158 * @return {!WebInspector.SecurityPanel} | 207 * @return {!WebInspector.SecurityPanel} |
159 */ | 208 */ |
160 WebInspector.SecurityPanel._instance = function() | 209 WebInspector.SecurityPanel._instance = function() |
161 { | 210 { |
162 if (!WebInspector.SecurityPanel._instanceObject) | 211 if (!WebInspector.SecurityPanel._instanceObject) |
163 WebInspector.SecurityPanel._instanceObject = new WebInspector.SecurityPa nel(); | 212 WebInspector.SecurityPanel._instanceObject = new WebInspector.SecurityPa nel(); |
164 return WebInspector.SecurityPanel._instanceObject; | 213 return WebInspector.SecurityPanel._instanceObject; |
165 } | 214 } |
166 | 215 |
167 /** | 216 /** |
168 * @constructor | 217 * @constructor |
169 * @extends {WebInspector.SidebarTreeElement} | 218 * @extends {WebInspector.SidebarTreeElement} |
170 * @param {!WebInspector.SecurityPanel} panel | 219 * @param {!WebInspector.SecurityPanel} panel |
171 */ | 220 */ |
172 WebInspector.SecurityMainViewSidebarTreeElement = function(panel) | 221 WebInspector.SecurityMainViewSidebarTreeElement = function(panel) |
173 { | 222 { |
174 this._panel = panel; | 223 this._panel = panel; |
175 this.small = true; | 224 WebInspector.SidebarTreeElement.call(this, "security-main-view-sidebar-tree- item", WebInspector.UIString("Overview")); |
176 WebInspector.SidebarTreeElement.call(this, "security-sidebar-tree-item", Web Inspector.UIString("Overview")); | |
177 this.iconElement.classList.add("lock-icon"); | 225 this.iconElement.classList.add("lock-icon"); |
178 } | 226 } |
179 | 227 |
180 WebInspector.SecurityMainViewSidebarTreeElement.prototype = { | 228 WebInspector.SecurityMainViewSidebarTreeElement.prototype = { |
181 onattach: function() | 229 onattach: function() |
182 { | 230 { |
183 WebInspector.SidebarTreeElement.prototype.onattach.call(this); | 231 WebInspector.SidebarTreeElement.prototype.onattach.call(this); |
184 }, | 232 }, |
185 | 233 |
186 /** | 234 /** |
187 * @param {!SecurityAgent.SecurityState} newSecurityState | 235 * @param {!SecurityAgent.SecurityState} newSecurityState |
188 */ | 236 */ |
189 setSecurityState: function(newSecurityState) | 237 setSecurityState: function(newSecurityState) |
190 { | 238 { |
191 for (var className of this.iconElement.classList) | 239 for (var className of Array.prototype.slice.call(this.iconElement.classL ist)) { |
192 if (className.indexOf("lock-icon-") === 0) | 240 if (className.startsWith("lock-icon-")) |
193 this.iconElement.classList.remove(className); | 241 this.iconElement.classList.remove(className); |
242 } | |
194 | 243 |
195 this.iconElement.classList.add("lock-icon-" + newSecurityState); | 244 this.iconElement.classList.add("lock-icon-" + newSecurityState); |
196 }, | 245 }, |
197 | 246 |
198 /** | 247 /** |
199 * @override | 248 * @override |
200 * @return {boolean} | 249 * @return {boolean} |
201 */ | 250 */ |
202 onselect: function() | 251 onselect: function() |
203 { | 252 { |
204 this._panel.showMainView(); | 253 this._panel.showMainView(); |
205 return true; | 254 return true; |
206 }, | 255 }, |
207 | 256 |
208 __proto__: WebInspector.SidebarTreeElement.prototype | 257 __proto__: WebInspector.SidebarTreeElement.prototype |
209 } | 258 } |
210 | 259 |
211 /** | 260 /** |
212 * @constructor | 261 * @constructor |
262 * @extends {WebInspector.SidebarTreeElement} | |
263 * @param {!WebInspector.SecurityPanel} panel | |
264 * @param {!WebInspector.SecurityPanel.Origin} origin | |
265 */ | |
266 WebInspector.SecurityOriginViewSidebarTreeElement = function(panel, origin) | |
267 { | |
268 this._panel = panel; | |
269 this._origin = origin; | |
270 this.small = true; | |
271 WebInspector.SidebarTreeElement.call(this, "security-sidebar-tree-item", ori gin); | |
272 this.iconElement.classList.add("security-property"); | |
273 } | |
274 | |
275 WebInspector.SecurityOriginViewSidebarTreeElement.prototype = { | |
276 /** | |
277 * @override | |
278 * @return {boolean} | |
279 */ | |
280 onselect: function() | |
281 { | |
282 this._panel.showOrigin(this._origin); | |
283 return true; | |
284 }, | |
285 | |
286 /** | |
287 * @param {!SecurityAgent.SecurityState} newSecurityState | |
288 */ | |
289 setSecurityState: function(newSecurityState) | |
290 { | |
291 for (var className of Array.prototype.slice.call(this.iconElement.classL ist)) { | |
292 if (className.startsWith("security-property-")) | |
293 this.iconElement.classList.remove(className); | |
294 } | |
295 | |
296 this.iconElement.classList.add("security-property-" + newSecurityState); | |
297 }, | |
298 | |
299 __proto__: WebInspector.SidebarTreeElement.prototype | |
300 } | |
301 | |
302 /** | |
303 * @constructor | |
213 * @implements {WebInspector.PanelFactory} | 304 * @implements {WebInspector.PanelFactory} |
214 */ | 305 */ |
215 WebInspector.SecurityPanelFactory = function() | 306 WebInspector.SecurityPanelFactory = function() |
216 { | 307 { |
217 } | 308 } |
218 | 309 |
219 WebInspector.SecurityPanelFactory.prototype = { | 310 WebInspector.SecurityPanelFactory.prototype = { |
220 /** | 311 /** |
221 * @override | 312 * @override |
222 * @return {!WebInspector.Panel} | 313 * @return {!WebInspector.Panel} |
(...skipping 27 matching lines...) Expand all Loading... | |
250 WebInspector.SecurityMainView.prototype = { | 341 WebInspector.SecurityMainView.prototype = { |
251 /** | 342 /** |
252 * @param {!SecurityAgent.SecurityStateExplanation} explanation | 343 * @param {!SecurityAgent.SecurityStateExplanation} explanation |
253 */ | 344 */ |
254 _addExplanation: function(explanation) | 345 _addExplanation: function(explanation) |
255 { | 346 { |
256 var explanationDiv = this._securityExplanations.createChild("div", "secu rity-explanation"); | 347 var explanationDiv = this._securityExplanations.createChild("div", "secu rity-explanation"); |
257 | 348 |
258 var explanationLockIcon = explanationDiv.createChild("div", "lock-icon") ; | 349 var explanationLockIcon = explanationDiv.createChild("div", "lock-icon") ; |
259 explanationLockIcon.classList.add("lock-icon-" + explanation.securitySta te); | 350 explanationLockIcon.classList.add("lock-icon-" + explanation.securitySta te); |
260 explanationDiv.createChild("div", "explanation-title").textContent = exp lanation.summary; | 351 explanationDiv.createChild("div", "explanation-title").textContent = Web Inspector.UIString(explanation.summary); |
261 explanationDiv.createChild("div", "explanation-text").textContent = expl anation.description; | 352 explanationDiv.createChild("div", "explanation-text").textContent = WebI nspector.UIString(explanation.description); |
262 }, | 353 }, |
263 | 354 |
264 /** | 355 /** |
265 * @param {!SecurityAgent.SecurityState} newSecurityState | 356 * @param {!SecurityAgent.SecurityState} newSecurityState |
266 * @param {!Array<!SecurityAgent.SecurityStateExplanation>} explanations | 357 * @param {!Array<!SecurityAgent.SecurityStateExplanation>} explanations |
267 */ | 358 */ |
268 updateSecurityState: function(newSecurityState, explanations) | 359 updateSecurityState: function(newSecurityState, explanations) |
269 { | 360 { |
270 // Remove old state. | 361 // Remove old state. |
271 // It's safe to call this even when this._securityState is undefined. | 362 // It's safe to call this even when this._securityState is undefined. |
272 this._lockIcon.classList.remove("lock-icon-" + this._securityState); | 363 this._lockIcon.classList.remove("lock-icon-" + this._securityState); |
273 | 364 |
274 // Add new state. | 365 // Add new state. |
275 this._securityState = newSecurityState; | 366 this._securityState = newSecurityState; |
276 this._lockIcon.classList.add("lock-icon-" + this._securityState); | 367 this._lockIcon.classList.add("lock-icon-" + this._securityState); |
277 this._securityStateText.textContent = WebInspector.UIString("Page securi ty state: %s", this._securityState); | 368 this._securityStateText.textContent = WebInspector.UIString("Page securi ty state: %s", this._securityState); |
278 | 369 |
279 this._securityExplanations.removeChildren(); | 370 this._securityExplanations.removeChildren(); |
280 for (var explanation of explanations) | 371 for (var explanation of explanations) |
281 this._addExplanation(explanation); | 372 this._addExplanation(explanation); |
282 }, | 373 }, |
283 | 374 |
284 __proto__: WebInspector.VBox.prototype | 375 __proto__: WebInspector.VBox.prototype |
285 } | 376 } |
377 | |
378 /** | |
379 * @constructor | |
380 * @extends {WebInspector.VBox} | |
381 * @param {!WebInspector.SecurityPanel} panel | |
382 * @param {!WebInspector.SecurityPanel.Origin} origin | |
383 * @param {!SecurityAgent.SecurityState} securityState | |
384 * @param {?NetworkAgent.SecurityDetails} securityDetails | |
385 */ | |
386 WebInspector.SecurityOriginView = function(panel, origin, securityState, securit yDetails) | |
387 { | |
388 this._panel = panel; | |
389 WebInspector.VBox.call(this); | |
390 this.setMinimumSize(200, 100); | |
391 | |
392 this.element.classList.add("security-origin-view"); | |
393 this.registerRequiredCSS("security/originView.css"); | |
394 this.registerRequiredCSS("security/lockIcon.css"); | |
395 | |
396 var titleSection = this.element.createChild("div", "origin-view-section titl e-section"); | |
397 titleSection.createChild("div", "origin-view-title").textContent = WebInspec tor.UIString("Origin"); | |
398 var originDisplay = titleSection.createChild("div", "origin-display"); | |
399 this._originLockIcon = originDisplay.createChild("span", "security-property" ); | |
400 this._originLockIcon.classList.add("security-property-" + securityState); | |
401 // TODO(lgarron): Highlight the origin scheme. https://crbug.com/523589 | |
402 originDisplay.createChild("span", "origin").textContent = origin; | |
403 | |
404 if (securityDetails && securityDetails.certificateDetails) { | |
405 var connectionSection = this.element.createChild("div", "origin-view-sec tion"); | |
406 connectionSection.createChild("div", "origin-view-section-title").textCo ntent = WebInspector.UIString("Connection"); | |
407 | |
408 var table = new WebInspector.SecurityDetailsTable(); | |
409 connectionSection.appendChild(table.element()); | |
410 table.addRow("Protocol", securityDetails.protocol); | |
411 table.addRow("Key Exchange", securityDetails.keyExchange); | |
412 table.addRow("Cipher Suite", securityDetails.cipher + (securityDetails.m ac ? " with " + securityDetails.mac : "")); | |
413 } | |
414 | |
415 if (securityDetails) { | |
416 var certificateSection = this.element.createChild("div", "origin-view-se ction"); | |
417 certificateSection.createChild("div", "origin-view-section-title").textC ontent = WebInspector.UIString("Certificate"); | |
418 | |
419 var sanDiv = this._createSanDiv(securityDetails); | |
420 var validFromString = new Date(1000 * securityDetails.certificateDetails .validFrom).toUTCString(); | |
421 var validUntilString = new Date(1000 * securityDetails.certificateDetail s.validTo).toUTCString(); | |
422 | |
423 var table = new WebInspector.SecurityDetailsTable(); | |
424 certificateSection.appendChild(table.element()); | |
425 table.addRow("Subject", securityDetails.certificateDetails.subject.name) ; | |
426 table.addRow("SAN", sanDiv); | |
427 table.addRow("Valid From", validFromString); | |
428 table.addRow("Valid Until", validUntilString); | |
429 table.addRow("Issuer", securityDetails.certificateDetails.issuer); | |
430 // TODO(lgarron): Make SCT status available in certificate details and s how it here. | |
431 | |
432 // TODO(lgarron): Implement a link to get certificateDetails. https://cr bug.com/506468 | |
433 | |
434 var noteSection = this.element.createChild("div", "origin-view-section") ; | |
435 noteSection.createChild("div", "origin-view-section-title").textContent = WebInspector.UIString("Development Note"); | |
436 // TODO(lgarron): Fix the issue and then remove this section. See commen t in _onResponseReceivedSecurityDetails | |
437 noteSection.createChild("div").textContent = WebInspector.UIString("At t he moment, this view only shows security details from the first connection made to %s", origin); | |
438 } | |
439 | |
440 if (!securityDetails) { | |
441 var notSecureSection = this.element.createChild("div", "origin-view-sect ion"); | |
442 notSecureSection.createChild("div", "origin-view-section-title").textCon tent = WebInspector.UIString("Not Secure"); | |
443 notSecureSection.createChild("div").textContent = WebInspector.UIString( "Your connection to this origin is not secure."); | |
444 } | |
445 } | |
446 | |
447 WebInspector.SecurityOriginView.prototype = { | |
448 | |
449 /** | |
450 * @param {!NetworkAgent.SecurityDetails} securityDetails | |
451 * *return {!Element} | |
452 */ | |
453 _createSanDiv: function(securityDetails) | |
454 { | |
455 // TODO(lgarron): Truncate the display of SAN entries and add a button t o toggle the full list. https://crbug.com/523591 | |
456 var sanDiv = createElement("div"); | |
457 var sanList = securityDetails.certificateDetails.subject.sanDnsNames.con cat(securityDetails.certificateDetails.subject.sanIpAddresses); | |
458 if (sanList.length === 0) { | |
459 sanDiv.textContent = WebInspector.UIString("(N/A)"); | |
460 } else { | |
461 for (var sanEntry of sanList) { | |
462 var span = sanDiv.createChild("span", "san-entry"); | |
463 span.textContent = WebInspector.UIString(sanEntry); | |
464 } | |
465 } | |
466 return sanDiv; | |
467 }, | |
468 | |
469 /** | |
470 * @param {!SecurityAgent.SecurityState} newSecurityState | |
471 */ | |
472 setSecurityState: function(newSecurityState) | |
473 { | |
474 for (var className of Array.prototype.slice.call(this._originLockIcon.cl assList)) { | |
475 if (className.startsWith("security-property-")) | |
476 this._originLockIcon.classList.remove(className); | |
477 } | |
478 | |
479 this._originLockIcon.classList.add("security-property-" + newSecuritySta te); | |
480 }, | |
481 | |
482 __proto__: WebInspector.VBox.prototype | |
483 } | |
484 | |
485 /** | |
486 * @constructor | |
487 */ | |
488 WebInspector.SecurityDetailsTable = function() | |
489 { | |
490 this._element = createElement("table"); | |
491 this._element.classList.add("details-table"); | |
492 } | |
493 | |
494 WebInspector.SecurityDetailsTable.prototype = { | |
495 | |
496 /** | |
497 * @return: {!Element} | |
498 */ | |
499 element: function() | |
500 { | |
501 return this._element; | |
502 }, | |
503 | |
504 /** | |
505 * @param {string} key | |
506 * @param {string|!HTMLDivElement} value | |
507 */ | |
508 addRow: function(key, value) | |
509 { | |
510 var row = this._element.createChild("div", "details-table-row"); | |
511 row.createChild("div").textContent = WebInspector.UIString(key); | |
512 | |
513 var valueDiv = row.createChild("div"); | |
514 if (value instanceof HTMLDivElement) { | |
515 valueDiv.appendChild(value); | |
516 } else { | |
517 valueDiv.textContent = value; | |
518 } | |
519 } | |
520 } | |
521 | |
OLD | NEW |