| OLD | NEW |
| 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 Loading... |
| 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 | |
| 45 this._sidebarTree = new UI.TreeOutlineInShadow(); | 43 this._sidebarTree = new UI.TreeOutlineInShadow(); |
| 46 this._sidebarTree.element.classList.add('resources-sidebar'); | 44 this._sidebarTree.element.classList.add('resources-sidebar'); |
| 47 this._sidebarTree.registerRequiredCSS('resources/resourcesSidebar.css'); | 45 this._sidebarTree.registerRequiredCSS('resources/resourcesSidebar.css'); |
| 48 this._sidebarTree.element.classList.add('filter-all'); | 46 this._sidebarTree.element.classList.add('filter-all'); |
| 49 // Listener needs to have been set up before the elements are added | 47 // Listener needs to have been set up before the elements are added |
| 50 this._sidebarTree.addEventListener(UI.TreeOutline.Events.ElementAttached, th
is._treeElementAdded, this); | 48 this._sidebarTree.addEventListener(UI.TreeOutline.Events.ElementAttached, th
is._treeElementAdded, this); |
| 51 | 49 |
| 52 this.contentElement.appendChild(this._sidebarTree.element); | 50 this.contentElement.appendChild(this._sidebarTree.element); |
| 53 this._applicationTreeElement = this._addSidebarSection(Common.UIString('Appl
ication')); | 51 this._applicationTreeElement = this._addSidebarSection(Common.UIString('Appl
ication')); |
| 54 this._manifestTreeElement = new Resources.AppManifestTreeElement(panel); | 52 this._manifestTreeElement = new Resources.AppManifestTreeElement(panel); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 this._domStorageTreeElements = new Map(); | 104 this._domStorageTreeElements = new Map(); |
| 107 /** @type {!Object.<string, boolean>} */ | 105 /** @type {!Object.<string, boolean>} */ |
| 108 this._domains = {}; | 106 this._domains = {}; |
| 109 | 107 |
| 110 this._sidebarTree.contentElement.addEventListener('mousemove', this._onmouse
move.bind(this), false); | 108 this._sidebarTree.contentElement.addEventListener('mousemove', this._onmouse
move.bind(this), false); |
| 111 this._sidebarTree.contentElement.addEventListener('mouseleave', this._onmous
eleave.bind(this), false); | 109 this._sidebarTree.contentElement.addEventListener('mouseleave', this._onmous
eleave.bind(this), false); |
| 112 | 110 |
| 113 SDK.targetManager.observeTargets(this); | 111 SDK.targetManager.observeTargets(this); |
| 114 SDK.targetManager.addModelListener( | 112 SDK.targetManager.addModelListener( |
| 115 SDK.ResourceTreeModel, SDK.ResourceTreeModel.Events.FrameNavigated, this
._frameNavigated, this); | 113 SDK.ResourceTreeModel, SDK.ResourceTreeModel.Events.FrameNavigated, this
._frameNavigated, this); |
| 116 SDK.targetManager.addModelListener( | |
| 117 SDK.ResourceTreeModel, SDK.ResourceTreeModel.Events.WillReloadPage, this
._willReloadPage, this); | |
| 118 | 114 |
| 119 var selection = this._panel.lastSelectedItemPath(); | 115 var selection = this._panel.lastSelectedItemPath(); |
| 120 if (this._shouldRestoreSelection && !selection.length) | 116 if (!selection.length) |
| 121 this._manifestTreeElement.select(); | 117 this._manifestTreeElement.select(); |
| 122 } | 118 } |
| 123 | 119 |
| 124 /** | 120 /** |
| 125 * @param {string} title | 121 * @param {string} title |
| 126 * @return {!UI.TreeElement} | 122 * @return {!UI.TreeElement} |
| 127 */ | 123 */ |
| 128 _addSidebarSection(title) { | 124 _addSidebarSection(title) { |
| 129 var treeElement = new UI.TreeElement(title, true); | 125 var treeElement = new UI.TreeElement(title, true); |
| 130 treeElement.listItemElement.classList.add('storage-group-list-item'); | 126 treeElement.listItemElement.classList.add('storage-group-list-item'); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 this.databasesListTreeElement.removeChildren(); | 222 this.databasesListTreeElement.removeChildren(); |
| 227 this.databasesListTreeElement.setExpandable(false); | 223 this.databasesListTreeElement.setExpandable(false); |
| 228 } | 224 } |
| 229 | 225 |
| 230 _resetAppCache() { | 226 _resetAppCache() { |
| 231 for (var frameId of Object.keys(this._applicationCacheFrameElements)) | 227 for (var frameId of Object.keys(this._applicationCacheFrameElements)) |
| 232 this._applicationCacheFrameManifestRemoved({data: frameId}); | 228 this._applicationCacheFrameManifestRemoved({data: frameId}); |
| 233 this.applicationCacheListTreeElement.setExpandable(false); | 229 this.applicationCacheListTreeElement.setExpandable(false); |
| 234 } | 230 } |
| 235 | 231 |
| 236 _willReloadPage() { | |
| 237 this._shouldRestoreSelection = true; | |
| 238 } | |
| 239 | |
| 240 /** | 232 /** |
| 241 * @param {!Common.Event} event | 233 * @param {!Common.Event} event |
| 242 */ | 234 */ |
| 243 _treeElementAdded(event) { | 235 _treeElementAdded(event) { |
| 244 if (!this._shouldRestoreSelection) | |
| 245 return; | |
| 246 var selection = this._panel.lastSelectedItemPath(); | 236 var selection = this._panel.lastSelectedItemPath(); |
| 247 if (!selection.length) | 237 if (!selection.length) |
| 248 return; | 238 return; |
| 249 var element = event.data; | 239 var element = event.data; |
| 250 var index = selection.indexOf(element.itemURL); | 240 var index = selection.indexOf(element.itemURL); |
| 251 if (index < 0) | 241 if (index < 0) |
| 252 return; | 242 return; |
| 253 for (var parent = element.parent; parent; parent = parent.parent) | 243 for (var parent = element.parent; parent; parent = parent.parent) |
| 254 parent.expand(); | 244 parent.expand(); |
| 255 if (index > 0) | 245 if (index > 0) |
| 256 element.expand(); | 246 element.expand(); |
| 257 element.select(); | 247 element.select(); |
| 258 if (index === 0) | |
| 259 this._shouldRestoreSelection = false; | |
| 260 } | 248 } |
| 261 | 249 |
| 262 _reset() { | 250 _reset() { |
| 263 this._domains = {}; | 251 this._domains = {}; |
| 264 this._resetWebSQL(); | 252 this._resetWebSQL(); |
| 265 this.cookieListTreeElement.removeChildren(); | 253 this.cookieListTreeElement.removeChildren(); |
| 266 } | 254 } |
| 267 | 255 |
| 268 _frameNavigated(event) { | 256 _frameNavigated(event) { |
| 269 var frame = event.data; | 257 var frame = event.data; |
| (...skipping 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1653 | 1641 |
| 1654 this.element.classList.add('storage-view'); | 1642 this.element.classList.add('storage-view'); |
| 1655 this._emptyWidget = new UI.EmptyWidget(''); | 1643 this._emptyWidget = new UI.EmptyWidget(''); |
| 1656 this._emptyWidget.show(this.element); | 1644 this._emptyWidget.show(this.element); |
| 1657 } | 1645 } |
| 1658 | 1646 |
| 1659 setText(text) { | 1647 setText(text) { |
| 1660 this._emptyWidget.text = text; | 1648 this._emptyWidget.text = text; |
| 1661 } | 1649 } |
| 1662 }; | 1650 }; |
| OLD | NEW |