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() |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
451 * *return {!Element} | 451 * *return {!Element} |
452 */ | 452 */ |
453 _createSanDiv: function(securityDetails) | 453 _createSanDiv: function(securityDetails) |
454 { | 454 { |
455 // TODO(lgarron): Truncate the display of SAN entries and add a button t o toggle the full list. https://crbug.com/523591 | 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"); | 456 var sanDiv = createElement("div"); |
457 var sanList = securityDetails.certificateDetails.subject.sanDnsNames.con cat(securityDetails.certificateDetails.subject.sanIpAddresses); | 457 var sanList = securityDetails.certificateDetails.subject.sanDnsNames.con cat(securityDetails.certificateDetails.subject.sanIpAddresses); |
458 if (sanList.length === 0) { | 458 if (sanList.length === 0) { |
459 sanDiv.textContent = WebInspector.UIString("(N/A)"); | 459 sanDiv.textContent = WebInspector.UIString("(N/A)"); |
460 } else { | 460 } else { |
461 for (var sanEntry of sanList) { | 461 var truncatedNumToShow = 2; |
462 var listIsTruncated = sanList.length > truncatedNumToShow; | |
463 for (var i = 0; i < sanList.length; i++) { | |
462 var span = sanDiv.createChild("span", "san-entry"); | 464 var span = sanDiv.createChild("span", "san-entry"); |
463 span.textContent = WebInspector.UIString(sanEntry); | 465 span.textContent = sanList[i]; |
466 if (listIsTruncated && i >= truncatedNumToShow) { | |
dgozman
2015/09/03 20:11:05
no { for one-liners
| |
467 span.classList.add("truncated-entry"); | |
468 } | |
469 } | |
470 if (listIsTruncated) { | |
471 var truncatedSANToggle = sanDiv.createChild("div", "link"); | |
472 truncatedSANToggle.href = ""; | |
473 | |
474 function toggleSANTruncation() { | |
dgozman
2015/09/03 20:11:05
nit: { on next line
| |
475 if (sanDiv.classList.contains("truncated-san")) { | |
476 sanDiv.classList.remove("truncated-san") | |
477 truncatedSANToggle.textContent = WebInspector.UIString(" Show fewer"); | |
dgozman
2015/09/03 20:11:05
But all the UIs I've seen have "Show more/less".
lgarron
2015/09/03 20:29:46
"Show less" makes sense when there is a bunch of s
| |
478 } else { | |
479 sanDiv.classList.add("truncated-san") | |
dgozman
2015/09/03 20:11:05
;
| |
480 truncatedSANToggle.textContent = WebInspector.UIString(" Show more (%d in total)", sanList.length); | |
481 } | |
482 } | |
483 truncatedSANToggle.addEventListener("click", toggleSANTruncation , false); | |
484 toggleSANTruncation(); | |
464 } | 485 } |
465 } | 486 } |
466 return sanDiv; | 487 return sanDiv; |
467 }, | 488 }, |
468 | 489 |
469 /** | 490 /** |
470 * @param {!SecurityAgent.SecurityState} newSecurityState | 491 * @param {!SecurityAgent.SecurityState} newSecurityState |
471 */ | 492 */ |
472 setSecurityState: function(newSecurityState) | 493 setSecurityState: function(newSecurityState) |
473 { | 494 { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
512 | 533 |
513 var valueDiv = row.createChild("div"); | 534 var valueDiv = row.createChild("div"); |
514 if (value instanceof HTMLDivElement) { | 535 if (value instanceof HTMLDivElement) { |
515 valueDiv.appendChild(value); | 536 valueDiv.appendChild(value); |
516 } else { | 537 } else { |
517 valueDiv.textContent = value; | 538 valueDiv.textContent = value; |
518 } | 539 } |
519 } | 540 } |
520 } | 541 } |
521 | 542 |
OLD | NEW |