Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(196)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/resources/ApplicationPanelSidebar.js

Issue 2887183002: [DevTools] Fix Application Panel initial selection (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2009 Joseph Pecoraro 3 * Copyright (C) 2009 Joseph Pecoraro
4 * Copyright (C) 2013 Samsung Electronics. All rights reserved. 4 * Copyright (C) 2013 Samsung Electronics. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 22 matching lines...) Expand all
33 */ 33 */
34 Resources.ApplicationPanelSidebar = class extends UI.VBox { 34 Resources.ApplicationPanelSidebar = class extends UI.VBox {
35 /** 35 /**
36 * @param {!Resources.ResourcesPanel} panel 36 * @param {!Resources.ResourcesPanel} panel
37 */ 37 */
38 constructor(panel) { 38 constructor(panel) {
39 super(); 39 super();
40 40
41 this._panel = panel; 41 this._panel = panel;
42 42
43 this._shouldRestoreSelection = true;
44
43 this._sidebarTree = new UI.TreeOutlineInShadow(); 45 this._sidebarTree = new UI.TreeOutlineInShadow();
44 this._sidebarTree.element.classList.add('resources-sidebar'); 46 this._sidebarTree.element.classList.add('resources-sidebar');
45 this._sidebarTree.registerRequiredCSS('resources/resourcesSidebar.css'); 47 this._sidebarTree.registerRequiredCSS('resources/resourcesSidebar.css');
46 this._sidebarTree.element.classList.add('filter-all'); 48 this._sidebarTree.element.classList.add('filter-all');
47 // Listener needs to have been set up before the elements are added 49 // Listener needs to have been set up before the elements are added
48 this._sidebarTree.addEventListener(UI.TreeOutline.Events.ElementAttached, th is._treeElementAdded, this); 50 this._sidebarTree.addEventListener(UI.TreeOutline.Events.ElementAttached, th is._treeElementAdded, this);
49 51
50 this.contentElement.appendChild(this._sidebarTree.element); 52 this.contentElement.appendChild(this._sidebarTree.element);
51 this._applicationTreeElement = this._addSidebarSection(Common.UIString('Appl ication')); 53 this._applicationTreeElement = this._addSidebarSection(Common.UIString('Appl ication'));
52 this._manifestTreeElement = new Resources.AppManifestTreeElement(panel); 54 this._manifestTreeElement = new Resources.AppManifestTreeElement(panel);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 this._databaseTableViews = new Map(); 100 this._databaseTableViews = new Map();
99 /** @type {!Map.<!Resources.Database, !Resources.DatabaseQueryView>} */ 101 /** @type {!Map.<!Resources.Database, !Resources.DatabaseQueryView>} */
100 this._databaseQueryViews = new Map(); 102 this._databaseQueryViews = new Map();
101 /** @type {!Map.<!Resources.Database, !Resources.DatabaseTreeElement>} */ 103 /** @type {!Map.<!Resources.Database, !Resources.DatabaseTreeElement>} */
102 this._databaseTreeElements = new Map(); 104 this._databaseTreeElements = new Map();
103 /** @type {!Map.<!Resources.DOMStorage, !Resources.DOMStorageTreeElement>} * / 105 /** @type {!Map.<!Resources.DOMStorage, !Resources.DOMStorageTreeElement>} * /
104 this._domStorageTreeElements = new Map(); 106 this._domStorageTreeElements = new Map();
105 /** @type {!Object.<string, boolean>} */ 107 /** @type {!Object.<string, boolean>} */
106 this._domains = {}; 108 this._domains = {};
107 109
108 this._shouldRestoreSelection = true;
109
110 this._sidebarTree.contentElement.addEventListener('mousemove', this._onmouse move.bind(this), false); 110 this._sidebarTree.contentElement.addEventListener('mousemove', this._onmouse move.bind(this), false);
111 this._sidebarTree.contentElement.addEventListener('mouseleave', this._onmous eleave.bind(this), false); 111 this._sidebarTree.contentElement.addEventListener('mouseleave', this._onmous eleave.bind(this), false);
112 112
113 SDK.targetManager.observeTargets(this); 113 SDK.targetManager.observeTargets(this);
114 SDK.targetManager.addModelListener( 114 SDK.targetManager.addModelListener(
115 SDK.ResourceTreeModel, SDK.ResourceTreeModel.Events.FrameNavigated, this ._frameNavigated, this); 115 SDK.ResourceTreeModel, SDK.ResourceTreeModel.Events.FrameNavigated, this ._frameNavigated, this);
116 SDK.targetManager.addModelListener( 116 SDK.targetManager.addModelListener(
117 SDK.ResourceTreeModel, SDK.ResourceTreeModel.Events.WillReloadPage, this ._willReloadPage, this); 117 SDK.ResourceTreeModel, SDK.ResourceTreeModel.Events.WillReloadPage, this ._willReloadPage, this);
118
119 var selection = this._panel.lastSelectedItemPath();
120 if (this._shouldRestoreSelection && !selection.length)
121 this._manifestTreeElement.select();
118 } 122 }
119 123
120 /** 124 /**
121 * @param {string} title 125 * @param {string} title
122 * @return {!UI.TreeElement} 126 * @return {!UI.TreeElement}
123 */ 127 */
124 _addSidebarSection(title) { 128 _addSidebarSection(title) {
125 var treeElement = new UI.TreeElement(title, true); 129 var treeElement = new UI.TreeElement(title, true);
126 treeElement.listItemElement.classList.add('storage-group-list-item'); 130 treeElement.listItemElement.classList.add('storage-group-list-item');
127 treeElement.setCollapsible(false); 131 treeElement.setCollapsible(false);
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 * @param {!Common.Event} event 241 * @param {!Common.Event} event
238 */ 242 */
239 _treeElementAdded(event) { 243 _treeElementAdded(event) {
240 if (!this._shouldRestoreSelection) 244 if (!this._shouldRestoreSelection)
241 return; 245 return;
242 var selection = this._panel.lastSelectedItemPath(); 246 var selection = this._panel.lastSelectedItemPath();
243 if (!selection.length) 247 if (!selection.length)
244 return; 248 return;
245 var element = event.data; 249 var element = event.data;
246 var index = selection.indexOf(element.itemURL); 250 var index = selection.indexOf(element.itemURL);
247 if (index > 0) 251 if (index < 0)
248 element.expand();
249 if (index)
250 return; 252 return;
251 for (var parent = element.parent; parent; parent = parent.parent) 253 for (var parent = element.parent; parent; parent = parent.parent)
252 parent.expand(); 254 parent.expand();
255 if (index > 0)
256 element.expand();
253 element.select(); 257 element.select();
254 this._shouldRestoreSelection = false; 258 if (index === 0)
259 this._shouldRestoreSelection = false;
255 } 260 }
256 261
257 _reset() { 262 _reset() {
258 this._domains = {}; 263 this._domains = {};
259 this._resetWebSQL(); 264 this._resetWebSQL();
260 this.cookieListTreeElement.removeChildren(); 265 this.cookieListTreeElement.removeChildren();
261 } 266 }
262 267
263 _frameNavigated(event) { 268 _frameNavigated(event) {
264 var frame = event.data; 269 var frame = event.data;
(...skipping 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after
1648 1653
1649 this.element.classList.add('storage-view'); 1654 this.element.classList.add('storage-view');
1650 this._emptyWidget = new UI.EmptyWidget(''); 1655 this._emptyWidget = new UI.EmptyWidget('');
1651 this._emptyWidget.show(this.element); 1656 this._emptyWidget.show(this.element);
1652 } 1657 }
1653 1658
1654 setText(text) { 1659 setText(text) {
1655 this._emptyWidget.text = text; 1660 this._emptyWidget.text = text;
1656 } 1661 }
1657 }; 1662 };
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698