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 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
374 * @param {!WebInspector.SecurityPanelSidebarTreeElement} mainViewElement | 374 * @param {!WebInspector.SecurityPanelSidebarTreeElement} mainViewElement |
375 * @param {function(!WebInspector.SecurityPanel.Origin)} showOriginInPanel | 375 * @param {function(!WebInspector.SecurityPanel.Origin)} showOriginInPanel |
376 */ | 376 */ |
377 WebInspector.SecurityPanelSidebarTree = function(mainViewElement, showOriginInPa nel) | 377 WebInspector.SecurityPanelSidebarTree = function(mainViewElement, showOriginInPa nel) |
378 { | 378 { |
379 this._showOriginInPanel = showOriginInPanel; | 379 this._showOriginInPanel = showOriginInPanel; |
380 | 380 |
381 this._mainOrigin = null; | 381 this._mainOrigin = null; |
382 | 382 |
383 TreeOutlineInShadow.call(this); | 383 TreeOutlineInShadow.call(this); |
384 this.element.classList.add("sidebar-tree"); | |
385 this.registerRequiredCSS("security/sidebar.css"); | 384 this.registerRequiredCSS("security/sidebar.css"); |
386 this.registerRequiredCSS("security/lockIcon.css"); | 385 this.registerRequiredCSS("security/lockIcon.css"); |
387 | 386 |
388 this.appendChild(mainViewElement); | 387 this.appendChild(mainViewElement); |
389 | 388 |
390 /** @type {!Map<!WebInspector.SecurityPanelSidebarTree.OriginGroupName, !Web Inspector.SidebarSectionTreeElement>} */ | 389 /** @type {!Map<!WebInspector.SecurityPanelSidebarTree.OriginGroupName, !Tre eElement>} */ |
391 this._originGroups = new Map(); | 390 this._originGroups = new Map(); |
392 | 391 |
393 for (var key in WebInspector.SecurityPanelSidebarTree.OriginGroupName) { | 392 for (var key in WebInspector.SecurityPanelSidebarTree.OriginGroupName) { |
394 var originGroupName = WebInspector.SecurityPanelSidebarTree.OriginGroupN ame[key]; | 393 var originGroupName = WebInspector.SecurityPanelSidebarTree.OriginGroupN ame[key]; |
395 var originGroup = new WebInspector.SidebarSectionTreeElement(WebInspecto r.UIString(originGroupName)); | 394 var originGroup = new TreeElement(WebInspector.UIString(originGroupName) , true); |
alph
2016/09/15 17:24:16
drop UIString.
dgozman
2016/09/15 17:25:51
I'll move it to the literal instead.
| |
395 originGroup.selectable = false; | |
396 originGroup.expand(); | |
396 originGroup.listItemElement.classList.add("security-sidebar-origins"); | 397 originGroup.listItemElement.classList.add("security-sidebar-origins"); |
397 this._originGroups.set(originGroupName, originGroup); | 398 this._originGroups.set(originGroupName, originGroup); |
398 this.appendChild(originGroup); | 399 this.appendChild(originGroup); |
399 } | 400 } |
400 this._clearOriginGroups(); | 401 this._clearOriginGroups(); |
401 | 402 |
402 // This message will be removed by clearOrigins() during the first new page load after the panel was opened. | 403 // This message will be removed by clearOrigins() during the first new page load after the panel was opened. |
403 var mainViewReloadMessage = new WebInspector.SidebarTreeElement("security-ma in-view-reload-message", WebInspector.UIString("Reload to view details")); | 404 var mainViewReloadMessage = new TreeElement(WebInspector.UIString("Reload to view details")); |
404 mainViewReloadMessage.selectable = false; | 405 mainViewReloadMessage.selectable = false; |
406 mainViewReloadMessage.listItemElement.classList.add("security-main-view-relo ad-message"); | |
405 this._originGroups.get(WebInspector.SecurityPanelSidebarTree.OriginGroupName .MainOrigin).appendChild(mainViewReloadMessage); | 407 this._originGroups.get(WebInspector.SecurityPanelSidebarTree.OriginGroupName .MainOrigin).appendChild(mainViewReloadMessage); |
406 | 408 |
407 /** @type {!Map<!WebInspector.SecurityPanel.Origin, !WebInspector.SecurityPa nelSidebarTreeElement>} */ | 409 /** @type {!Map<!WebInspector.SecurityPanel.Origin, !WebInspector.SecurityPa nelSidebarTreeElement>} */ |
408 this._elementsByOrigin = new Map(); | 410 this._elementsByOrigin = new Map(); |
409 } | 411 } |
410 | 412 |
411 WebInspector.SecurityPanelSidebarTree.prototype = { | 413 WebInspector.SecurityPanelSidebarTree.prototype = { |
412 /** | 414 /** |
413 * @param {boolean} hidden | 415 * @param {boolean} hidden |
414 */ | 416 */ |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
508 WebInspector.SecurityPanelSidebarTree.OriginGroupName = { | 510 WebInspector.SecurityPanelSidebarTree.OriginGroupName = { |
509 MainOrigin: "Main Origin", | 511 MainOrigin: "Main Origin", |
510 NonSecure: "Non-Secure Origins", | 512 NonSecure: "Non-Secure Origins", |
511 Secure: "Secure Origins", | 513 Secure: "Secure Origins", |
512 Unknown: "Unknown / Canceled" | 514 Unknown: "Unknown / Canceled" |
513 } | 515 } |
514 | 516 |
515 | 517 |
516 /** | 518 /** |
517 * @constructor | 519 * @constructor |
518 * @extends {WebInspector.SidebarTreeElement} | 520 * @extends {TreeElement} |
519 * @param {string} text | 521 * @param {string} text |
520 * @param {function()} selectCallback | 522 * @param {function()} selectCallback |
521 * @param {string} className | 523 * @param {string} className |
522 * @param {string} cssPrefix | 524 * @param {string} cssPrefix |
523 */ | 525 */ |
524 WebInspector.SecurityPanelSidebarTreeElement = function(text, selectCallback, cl assName, cssPrefix) | 526 WebInspector.SecurityPanelSidebarTreeElement = function(text, selectCallback, cl assName, cssPrefix) |
525 { | 527 { |
528 TreeElement.call(this, "", false); | |
526 this._selectCallback = selectCallback; | 529 this._selectCallback = selectCallback; |
527 this._cssPrefix = cssPrefix; | 530 this._cssPrefix = cssPrefix; |
528 | 531 this.listItemElement.classList.add(className); |
529 WebInspector.SidebarTreeElement.call(this, className, text); | 532 this._iconElement = this.listItemElement.createChild("div", "icon"); |
530 this.iconElement.classList.add(this._cssPrefix); | 533 this._iconElement.classList.add(this._cssPrefix); |
531 | 534 this.listItemElement.createChild("span", "title").textContent = text; |
532 this.setSecurityState(SecurityAgent.SecurityState.Unknown); | 535 this.setSecurityState(SecurityAgent.SecurityState.Unknown); |
533 } | 536 } |
534 | 537 |
535 WebInspector.SecurityPanelSidebarTreeElement.prototype = { | 538 WebInspector.SecurityPanelSidebarTreeElement.prototype = { |
536 /** | 539 /** |
537 * @param {!SecurityAgent.SecurityState} newSecurityState | 540 * @param {!SecurityAgent.SecurityState} newSecurityState |
538 */ | 541 */ |
539 setSecurityState: function(newSecurityState) | 542 setSecurityState: function(newSecurityState) |
540 { | 543 { |
541 if (this._securityState) | 544 if (this._securityState) |
542 this.iconElement.classList.remove(this._cssPrefix + "-" + this._secu rityState) | 545 this._iconElement.classList.remove(this._cssPrefix + "-" + this._sec urityState); |
543 | 546 |
544 this._securityState = newSecurityState; | 547 this._securityState = newSecurityState; |
545 this.iconElement.classList.add(this._cssPrefix + "-" + newSecurityState) ; | 548 this._iconElement.classList.add(this._cssPrefix + "-" + newSecurityState ); |
546 }, | 549 }, |
547 | 550 |
548 /** | 551 /** |
549 * @return {!SecurityAgent.SecurityState} | 552 * @return {!SecurityAgent.SecurityState} |
550 */ | 553 */ |
551 securityState: function() | 554 securityState: function() |
552 { | 555 { |
553 return this._securityState; | 556 return this._securityState; |
554 }, | 557 }, |
555 | 558 |
556 /** | 559 /** |
557 * @override | 560 * @override |
558 * @return {boolean} | 561 * @return {boolean} |
559 */ | 562 */ |
560 onselect: function() | 563 onselect: function() |
561 { | 564 { |
562 this._selectCallback(); | 565 this._selectCallback(); |
563 return true; | 566 return true; |
564 }, | 567 }, |
565 | 568 |
566 __proto__: WebInspector.SidebarTreeElement.prototype | 569 __proto__: TreeElement.prototype |
567 } | 570 } |
568 | 571 |
569 /** | 572 /** |
570 * @param {!WebInspector.SecurityPanelSidebarTreeElement} a | 573 * @param {!WebInspector.SecurityPanelSidebarTreeElement} a |
571 * @param {!WebInspector.SecurityPanelSidebarTreeElement} b | 574 * @param {!WebInspector.SecurityPanelSidebarTreeElement} b |
572 * @return {number} | 575 * @return {number} |
573 */ | 576 */ |
574 WebInspector.SecurityPanelSidebarTreeElement.SecurityStateComparator = function( a, b) | 577 WebInspector.SecurityPanelSidebarTreeElement.SecurityStateComparator = function( a, b) |
575 { | 578 { |
576 return WebInspector.SecurityModel.SecurityStateComparator(a.securityState(), b.securityState()); | 579 return WebInspector.SecurityModel.SecurityStateComparator(a.securityState(), b.securityState()); |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1032 row.createChild("div").textContent = key; | 1035 row.createChild("div").textContent = key; |
1033 | 1036 |
1034 var valueDiv = row.createChild("div"); | 1037 var valueDiv = row.createChild("div"); |
1035 if (typeof value === "string") { | 1038 if (typeof value === "string") { |
1036 valueDiv.textContent = value; | 1039 valueDiv.textContent = value; |
1037 } else { | 1040 } else { |
1038 valueDiv.appendChild(value); | 1041 valueDiv.appendChild(value); |
1039 } | 1042 } |
1040 } | 1043 } |
1041 } | 1044 } |
OLD | NEW |