Commit 93f5f005 authored by dgozman's avatar dgozman Committed by Commit bot

[DevTools] Remove SidebarTreeElement from SecurityPanel.

This is a step towards removing SidebarTreeElement, and moving
all tree outlines into shadow dom.

BUG=none

Review-Url: https://codereview.chromium.org/2347483002
Cr-Commit-Position: refs/heads/master@{#419062}
parent 5c77780d
...@@ -5,13 +5,14 @@ InspectorTest.preloadPanel("security"); ...@@ -5,13 +5,14 @@ InspectorTest.preloadPanel("security");
InspectorTest.dumpSecurityPanelSidebarOrigins = function() { InspectorTest.dumpSecurityPanelSidebarOrigins = function() {
for (var key in WebInspector.SecurityPanelSidebarTree.OriginGroupName) { for (var key in WebInspector.SecurityPanelSidebarTree.OriginGroupName) {
var originGroupName = WebInspector.SecurityPanelSidebarTree.OriginGroupName[key]; var originGroupName = WebInspector.SecurityPanelSidebarTree.OriginGroupName[key];
var originTitles = WebInspector.SecurityPanel._instance()._sidebarTree._originGroups.get(originGroupName).childrenListElement.getElementsByClassName("title"); var originGroup = WebInspector.SecurityPanel._instance()._sidebarTree._originGroups.get(originGroupName);
if (originTitles.length > 0) { if (originGroup.hidden)
continue;
InspectorTest.addResult("Group: " + originGroupName); InspectorTest.addResult("Group: " + originGroupName);
var originTitles = originGroup.childrenListElement.getElementsByClassName("title");
for (var originTitle of originTitles) for (var originTitle of originTitles)
InspectorTest.dumpDeepInnerHTML(originTitle); InspectorTest.dumpDeepInnerHTML(originTitle);
} }
}
} }
/** /**
......
Tests that blank origins aren't shown in the security panel origins list. Tests that blank origins aren't shown in the security panel origins list.
Group: Main Origin Group: Main Origin
<SPAN class=title >
Reload to view details
</SPAN>
Group: Unknown / Canceled Group: Unknown / Canceled
<SPAN class=title > <SPAN class=title >
https://foo.test https://foo.test
......
Tests that origins with failed requests are shown correctly in the security panel origins list. Tests that origins with failed requests are shown correctly in the security panel origins list.
Group: Main Origin Group: Main Origin
<SPAN class=title >
Reload to view details
</SPAN>
Group: Secure Origins Group: Secure Origins
<SPAN class=title > <SPAN class=title >
https://foo.test https://foo.test
......
Tests that requests to unresolved origins result in unknown security state and show up in the sidebar origin list. Tests that requests to unresolved origins result in unknown security state and show up in the sidebar origin list.
Group: Main Origin Group: Main Origin
<SPAN class=title >
Reload to view details
</SPAN>
Group: Unknown / Canceled Group: Unknown / Canceled
<SPAN class=title > <SPAN class=title >
http://unknown http://unknown
......
...@@ -381,18 +381,19 @@ WebInspector.SecurityPanelSidebarTree = function(mainViewElement, showOriginInPa ...@@ -381,18 +381,19 @@ WebInspector.SecurityPanelSidebarTree = function(mainViewElement, showOriginInPa
this._mainOrigin = null; this._mainOrigin = null;
TreeOutlineInShadow.call(this); TreeOutlineInShadow.call(this);
this.element.classList.add("sidebar-tree");
this.registerRequiredCSS("security/sidebar.css"); this.registerRequiredCSS("security/sidebar.css");
this.registerRequiredCSS("security/lockIcon.css"); this.registerRequiredCSS("security/lockIcon.css");
this.appendChild(mainViewElement); this.appendChild(mainViewElement);
/** @type {!Map<!WebInspector.SecurityPanelSidebarTree.OriginGroupName, !WebInspector.SidebarSectionTreeElement>} */ /** @type {!Map<!WebInspector.SecurityPanelSidebarTree.OriginGroupName, !TreeElement>} */
this._originGroups = new Map(); this._originGroups = new Map();
for (var key in WebInspector.SecurityPanelSidebarTree.OriginGroupName) { for (var key in WebInspector.SecurityPanelSidebarTree.OriginGroupName) {
var originGroupName = WebInspector.SecurityPanelSidebarTree.OriginGroupName[key]; var originGroupName = WebInspector.SecurityPanelSidebarTree.OriginGroupName[key];
var originGroup = new WebInspector.SidebarSectionTreeElement(WebInspector.UIString(originGroupName)); var originGroup = new TreeElement(originGroupName, true);
originGroup.selectable = false;
originGroup.expand();
originGroup.listItemElement.classList.add("security-sidebar-origins"); originGroup.listItemElement.classList.add("security-sidebar-origins");
this._originGroups.set(originGroupName, originGroup); this._originGroups.set(originGroupName, originGroup);
this.appendChild(originGroup); this.appendChild(originGroup);
...@@ -400,8 +401,9 @@ WebInspector.SecurityPanelSidebarTree = function(mainViewElement, showOriginInPa ...@@ -400,8 +401,9 @@ WebInspector.SecurityPanelSidebarTree = function(mainViewElement, showOriginInPa
this._clearOriginGroups(); this._clearOriginGroups();
// This message will be removed by clearOrigins() during the first new page load after the panel was opened. // This message will be removed by clearOrigins() during the first new page load after the panel was opened.
var mainViewReloadMessage = new WebInspector.SidebarTreeElement("security-main-view-reload-message", WebInspector.UIString("Reload to view details")); var mainViewReloadMessage = new TreeElement(WebInspector.UIString("Reload to view details"));
mainViewReloadMessage.selectable = false; mainViewReloadMessage.selectable = false;
mainViewReloadMessage.listItemElement.classList.add("security-main-view-reload-message");
this._originGroups.get(WebInspector.SecurityPanelSidebarTree.OriginGroupName.MainOrigin).appendChild(mainViewReloadMessage); this._originGroups.get(WebInspector.SecurityPanelSidebarTree.OriginGroupName.MainOrigin).appendChild(mainViewReloadMessage);
/** @type {!Map<!WebInspector.SecurityPanel.Origin, !WebInspector.SecurityPanelSidebarTreeElement>} */ /** @type {!Map<!WebInspector.SecurityPanel.Origin, !WebInspector.SecurityPanelSidebarTreeElement>} */
...@@ -506,16 +508,16 @@ WebInspector.SecurityPanelSidebarTree.prototype = { ...@@ -506,16 +508,16 @@ WebInspector.SecurityPanelSidebarTree.prototype = {
* @enum {string} * @enum {string}
*/ */
WebInspector.SecurityPanelSidebarTree.OriginGroupName = { WebInspector.SecurityPanelSidebarTree.OriginGroupName = {
MainOrigin: "Main Origin", MainOrigin: WebInspector.UIString("Main Origin"),
NonSecure: "Non-Secure Origins", NonSecure: WebInspector.UIString("Non-Secure Origins"),
Secure: "Secure Origins", Secure: WebInspector.UIString("Secure Origins"),
Unknown: "Unknown / Canceled" Unknown: WebInspector.UIString("Unknown / Canceled")
} }
/** /**
* @constructor * @constructor
* @extends {WebInspector.SidebarTreeElement} * @extends {TreeElement}
* @param {string} text * @param {string} text
* @param {function()} selectCallback * @param {function()} selectCallback
* @param {string} className * @param {string} className
...@@ -523,12 +525,13 @@ WebInspector.SecurityPanelSidebarTree.OriginGroupName = { ...@@ -523,12 +525,13 @@ WebInspector.SecurityPanelSidebarTree.OriginGroupName = {
*/ */
WebInspector.SecurityPanelSidebarTreeElement = function(text, selectCallback, className, cssPrefix) WebInspector.SecurityPanelSidebarTreeElement = function(text, selectCallback, className, cssPrefix)
{ {
TreeElement.call(this, "", false);
this._selectCallback = selectCallback; this._selectCallback = selectCallback;
this._cssPrefix = cssPrefix; this._cssPrefix = cssPrefix;
this.listItemElement.classList.add(className);
WebInspector.SidebarTreeElement.call(this, className, text); this._iconElement = this.listItemElement.createChild("div", "icon");
this.iconElement.classList.add(this._cssPrefix); this._iconElement.classList.add(this._cssPrefix);
this.listItemElement.createChild("span", "title").textContent = text;
this.setSecurityState(SecurityAgent.SecurityState.Unknown); this.setSecurityState(SecurityAgent.SecurityState.Unknown);
} }
...@@ -539,10 +542,10 @@ WebInspector.SecurityPanelSidebarTreeElement.prototype = { ...@@ -539,10 +542,10 @@ WebInspector.SecurityPanelSidebarTreeElement.prototype = {
setSecurityState: function(newSecurityState) setSecurityState: function(newSecurityState)
{ {
if (this._securityState) if (this._securityState)
this.iconElement.classList.remove(this._cssPrefix + "-" + this._securityState) this._iconElement.classList.remove(this._cssPrefix + "-" + this._securityState);
this._securityState = newSecurityState; this._securityState = newSecurityState;
this.iconElement.classList.add(this._cssPrefix + "-" + newSecurityState); this._iconElement.classList.add(this._cssPrefix + "-" + newSecurityState);
}, },
/** /**
...@@ -563,7 +566,7 @@ WebInspector.SecurityPanelSidebarTreeElement.prototype = { ...@@ -563,7 +566,7 @@ WebInspector.SecurityPanelSidebarTreeElement.prototype = {
return true; return true;
}, },
__proto__: WebInspector.SidebarTreeElement.prototype __proto__: TreeElement.prototype
} }
/** /**
......
...@@ -11,6 +11,11 @@ ...@@ -11,6 +11,11 @@
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
padding: 2px 5px;
overflow: hidden;
margin: 2px 0;
border-top: 1px solid transparent;
white-space: nowrap;
} }
.tree-outline:focus li.selected .lock-icon, .tree-outline:focus li.selected .lock-icon,
...@@ -24,11 +29,14 @@ ...@@ -24,11 +29,14 @@
padding: 16px 0; padding: 16px 0;
} }
.tree-outline .security-sidebar-origins { .tree-outline li.security-sidebar-origins {
padding: 1px 8px 6px 8px; padding: 1px 8px 1px 13px;
margin-top: 1em; margin-top: 1em;
margin-bottom: 0.5em; margin-bottom: 0.5em;
color: rgb(90, 90, 90); color: rgb(90, 90, 90);
border-top: none;
line-height: 16px;
text-shadow: rgba(255, 255, 255, 0.75) 0 1px 0;
} }
.tree-outline ol { .tree-outline ol {
...@@ -41,12 +49,12 @@ ...@@ -41,12 +49,12 @@
.tree-outline .security-main-view-sidebar-tree-item, .tree-outline .security-main-view-sidebar-tree-item,
.tree-outline .security-sidebar-origins, .tree-outline .security-sidebar-origins,
.tree-outline .sidebar-tree-section + .children > .sidebar-tree-item { .tree-outline li.security-sidebar-origins + .children > li {
padding-left: 16px; padding-left: 16px;
} }
.tree-outline .sidebar-tree-item .lock-icon, .tree-outline .lock-icon,
.tree-outline .sidebar-tree-item .security-property { .tree-outline .security-property {
margin-right: 4px; margin-right: 4px;
flex: none; flex: none;
} }
...@@ -55,12 +63,12 @@ ...@@ -55,12 +63,12 @@
padding: 2px 0; padding: 2px 0;
} }
.security-sidebar-tree-item .titles { .security-sidebar-tree-item .title {
overflow: hidden; overflow: hidden;
margin-right: 5px; margin-right: 5px;
} }
.sidebar-tree-item.security-main-view-reload-message .title { .security-main-view-reload-message .tree-element-title {
color: rgba(0, 0, 0, 0.5); color: rgba(0, 0, 0, 0.5);
padding-left: 8px; padding-left: 8px;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment