| 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 13 matching lines...) Expand all Loading... |
| 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 /** | 30 /** |
| 31 * @implements {SDK.TargetManager.Observer} | 31 * @implements {SDK.TargetManager.Observer} |
| 32 * @unrestricted | 32 * @unrestricted |
| 33 */ | 33 */ |
| 34 Resources.ResourcesPanel = class extends UI.PanelWithSidebar { | 34 Resources.ApplicationPanelSidebar = class extends UI.VBox { |
| 35 constructor() { | 35 /** |
| 36 super('resources'); | 36 * @param {!Resources.ResourcesPanel} panel |
| 37 this.registerRequiredCSS('resources/resourcesPanel.css'); | 37 */ |
| 38 constructor(panel) { |
| 39 super(); |
| 38 | 40 |
| 39 this._resourcesLastSelectedItemSetting = Common.settings.createSetting('reso
urcesLastSelectedItem', {}); | 41 this._panel = panel; |
| 40 | 42 |
| 41 this._sidebarTree = new UI.TreeOutlineInShadow(); | 43 this._sidebarTree = new UI.TreeOutlineInShadow(); |
| 42 this._sidebarTree.element.classList.add('resources-sidebar'); | 44 this._sidebarTree.element.classList.add('resources-sidebar'); |
| 43 this._sidebarTree.registerRequiredCSS('resources/resourcesSidebar.css'); | 45 this._sidebarTree.registerRequiredCSS('resources/resourcesSidebar.css'); |
| 44 this._sidebarTree.element.classList.add('filter-all'); | 46 this._sidebarTree.element.classList.add('filter-all'); |
| 45 this.panelSidebarElement().appendChild(this._sidebarTree.element); | 47 this.contentElement.appendChild(this._sidebarTree.element); |
| 46 | 48 |
| 47 this._applicationTreeElement = this._addSidebarSection(Common.UIString('Appl
ication')); | 49 this._applicationTreeElement = this._addSidebarSection(Common.UIString('Appl
ication')); |
| 48 this._manifestTreeElement = new Resources.AppManifestTreeElement(this); | 50 this._manifestTreeElement = new Resources.AppManifestTreeElement(panel); |
| 49 this._applicationTreeElement.appendChild(this._manifestTreeElement); | 51 this._applicationTreeElement.appendChild(this._manifestTreeElement); |
| 50 this.serviceWorkersTreeElement = new Resources.ServiceWorkersTreeElement(thi
s); | 52 this.serviceWorkersTreeElement = new Resources.ServiceWorkersTreeElement(pan
el); |
| 51 this._applicationTreeElement.appendChild(this.serviceWorkersTreeElement); | 53 this._applicationTreeElement.appendChild(this.serviceWorkersTreeElement); |
| 52 var clearStorageTreeElement = new Resources.ClearStorageTreeElement(this); | 54 var clearStorageTreeElement = new Resources.ClearStorageTreeElement(panel); |
| 53 this._applicationTreeElement.appendChild(clearStorageTreeElement); | 55 this._applicationTreeElement.appendChild(clearStorageTreeElement); |
| 54 | 56 |
| 55 var storageTreeElement = this._addSidebarSection(Common.UIString('Storage'))
; | 57 var storageTreeElement = this._addSidebarSection(Common.UIString('Storage'))
; |
| 56 this.localStorageListTreeElement = | 58 this.localStorageListTreeElement = |
| 57 new Resources.StorageCategoryTreeElement(this, Common.UIString('Local St
orage'), 'LocalStorage'); | 59 new Resources.StorageCategoryTreeElement(panel, Common.UIString('Local S
torage'), 'LocalStorage'); |
| 58 var localStorageIcon = UI.Icon.create('mediumicon-table', 'resource-tree-ite
m'); | 60 var localStorageIcon = UI.Icon.create('mediumicon-table', 'resource-tree-ite
m'); |
| 59 this.localStorageListTreeElement.setLeadingIcons([localStorageIcon]); | 61 this.localStorageListTreeElement.setLeadingIcons([localStorageIcon]); |
| 60 | 62 |
| 61 storageTreeElement.appendChild(this.localStorageListTreeElement); | 63 storageTreeElement.appendChild(this.localStorageListTreeElement); |
| 62 this.sessionStorageListTreeElement = | 64 this.sessionStorageListTreeElement = |
| 63 new Resources.StorageCategoryTreeElement(this, Common.UIString('Session
Storage'), 'SessionStorage'); | 65 new Resources.StorageCategoryTreeElement(panel, Common.UIString('Session
Storage'), 'SessionStorage'); |
| 64 var sessionStorageIcon = UI.Icon.create('mediumicon-table', 'resource-tree-i
tem'); | 66 var sessionStorageIcon = UI.Icon.create('mediumicon-table', 'resource-tree-i
tem'); |
| 65 this.sessionStorageListTreeElement.setLeadingIcons([sessionStorageIcon]); | 67 this.sessionStorageListTreeElement.setLeadingIcons([sessionStorageIcon]); |
| 66 | 68 |
| 67 storageTreeElement.appendChild(this.sessionStorageListTreeElement); | 69 storageTreeElement.appendChild(this.sessionStorageListTreeElement); |
| 68 this.indexedDBListTreeElement = new Resources.IndexedDBTreeElement(this); | 70 this.indexedDBListTreeElement = new Resources.IndexedDBTreeElement(panel); |
| 69 storageTreeElement.appendChild(this.indexedDBListTreeElement); | 71 storageTreeElement.appendChild(this.indexedDBListTreeElement); |
| 70 this.databasesListTreeElement = | 72 this.databasesListTreeElement = |
| 71 new Resources.StorageCategoryTreeElement(this, Common.UIString('Web SQL'
), 'Databases'); | 73 new Resources.StorageCategoryTreeElement(panel, Common.UIString('Web SQL
'), 'Databases'); |
| 72 var databaseIcon = UI.Icon.create('mediumicon-database', 'resource-tree-item
'); | 74 var databaseIcon = UI.Icon.create('mediumicon-database', 'resource-tree-item
'); |
| 73 this.databasesListTreeElement.setLeadingIcons([databaseIcon]); | 75 this.databasesListTreeElement.setLeadingIcons([databaseIcon]); |
| 74 | 76 |
| 75 storageTreeElement.appendChild(this.databasesListTreeElement); | 77 storageTreeElement.appendChild(this.databasesListTreeElement); |
| 76 this.cookieListTreeElement = new Resources.StorageCategoryTreeElement(this,
Common.UIString('Cookies'), 'Cookies'); | 78 this.cookieListTreeElement = new Resources.StorageCategoryTreeElement(panel,
Common.UIString('Cookies'), 'Cookies'); |
| 77 var cookieIcon = UI.Icon.create('mediumicon-cookie', 'resource-tree-item'); | 79 var cookieIcon = UI.Icon.create('mediumicon-cookie', 'resource-tree-item'); |
| 78 this.cookieListTreeElement.setLeadingIcons([cookieIcon]); | 80 this.cookieListTreeElement.setLeadingIcons([cookieIcon]); |
| 79 storageTreeElement.appendChild(this.cookieListTreeElement); | 81 storageTreeElement.appendChild(this.cookieListTreeElement); |
| 80 | 82 |
| 81 var cacheTreeElement = this._addSidebarSection(Common.UIString('Cache')); | 83 var cacheTreeElement = this._addSidebarSection(Common.UIString('Cache')); |
| 82 this.cacheStorageListTreeElement = new Resources.ServiceWorkerCacheTreeEleme
nt(this); | 84 this.cacheStorageListTreeElement = new Resources.ServiceWorkerCacheTreeEleme
nt(panel); |
| 83 cacheTreeElement.appendChild(this.cacheStorageListTreeElement); | 85 cacheTreeElement.appendChild(this.cacheStorageListTreeElement); |
| 84 this.applicationCacheListTreeElement = | 86 this.applicationCacheListTreeElement = |
| 85 new Resources.StorageCategoryTreeElement(this, Common.UIString('Applicat
ion Cache'), 'ApplicationCache'); | 87 new Resources.StorageCategoryTreeElement(panel, Common.UIString('Applica
tion Cache'), 'ApplicationCache'); |
| 86 var applicationCacheIcon = UI.Icon.create('mediumicon-table', 'resource-tree
-item'); | 88 var applicationCacheIcon = UI.Icon.create('mediumicon-table', 'resource-tree
-item'); |
| 87 this.applicationCacheListTreeElement.setLeadingIcons([applicationCacheIcon])
; | 89 this.applicationCacheListTreeElement.setLeadingIcons([applicationCacheIcon])
; |
| 88 | 90 |
| 89 cacheTreeElement.appendChild(this.applicationCacheListTreeElement); | 91 cacheTreeElement.appendChild(this.applicationCacheListTreeElement); |
| 90 | 92 |
| 91 this._resourcesSection = new Resources.ResourcesSection(this, this._addSideb
arSection(Common.UIString('Frames'))); | 93 this._resourcesSection = new Resources.ResourcesSection(panel, this._addSide
barSection(Common.UIString('Frames'))); |
| 92 | |
| 93 var mainContainer = new UI.VBox(); | |
| 94 this.storageViews = mainContainer.element.createChild('div', 'vbox flex-auto
'); | |
| 95 this._storageViewToolbar = new UI.Toolbar('resources-toolbar', mainContainer
.element); | |
| 96 this.splitWidget().setMainWidget(mainContainer); | |
| 97 | 94 |
| 98 /** @type {!Map.<!Resources.Database, !Object.<string, !Resources.DatabaseTa
bleView>>} */ | 95 /** @type {!Map.<!Resources.Database, !Object.<string, !Resources.DatabaseTa
bleView>>} */ |
| 99 this._databaseTableViews = new Map(); | 96 this._databaseTableViews = new Map(); |
| 100 /** @type {!Map.<!Resources.Database, !Resources.DatabaseQueryView>} */ | 97 /** @type {!Map.<!Resources.Database, !Resources.DatabaseQueryView>} */ |
| 101 this._databaseQueryViews = new Map(); | 98 this._databaseQueryViews = new Map(); |
| 102 /** @type {!Map.<!Resources.Database, !Resources.DatabaseTreeElement>} */ | 99 /** @type {!Map.<!Resources.Database, !Resources.DatabaseTreeElement>} */ |
| 103 this._databaseTreeElements = new Map(); | 100 this._databaseTreeElements = new Map(); |
| 104 /** @type {!Map.<!Resources.DOMStorage, !Resources.DOMStorageTreeElement>} *
/ | 101 /** @type {!Map.<!Resources.DOMStorage, !Resources.DOMStorageTreeElement>} *
/ |
| 105 this._domStorageTreeElements = new Map(); | 102 this._domStorageTreeElements = new Map(); |
| 106 /** @type {!Object.<string, boolean>} */ | 103 /** @type {!Object.<string, boolean>} */ |
| 107 this._domains = {}; | 104 this._domains = {}; |
| 108 | 105 |
| 109 /** @type {?Resources.DOMStorageItemsView} */ | 106 this._sidebarTree.contentElement.addEventListener('mousemove', this._onmouse
move.bind(this), false); |
| 110 this._domStorageView = null; | 107 this._sidebarTree.contentElement.addEventListener('mouseleave', this._onmous
eleave.bind(this), false); |
| 111 /** @type {?Resources.CookieItemsView} */ | |
| 112 this._cookieView = null; | |
| 113 | |
| 114 this.panelSidebarElement().addEventListener('mousemove', this._onmousemove.b
ind(this), false); | |
| 115 this.panelSidebarElement().addEventListener('mouseleave', this._onmouseleave
.bind(this), false); | |
| 116 | 108 |
| 117 SDK.targetManager.observeTargets(this); | 109 SDK.targetManager.observeTargets(this); |
| 118 SDK.targetManager.addModelListener( | 110 SDK.targetManager.addModelListener( |
| 119 SDK.ResourceTreeModel, SDK.ResourceTreeModel.Events.FrameNavigated, this
._frameNavigated, this); | 111 SDK.ResourceTreeModel, SDK.ResourceTreeModel.Events.FrameNavigated, this
._frameNavigated, this); |
| 120 } | 112 } |
| 121 | 113 |
| 122 /** | 114 /** |
| 123 * @return {!Resources.ResourcesPanel} | |
| 124 */ | |
| 125 static _instance() { | |
| 126 return /** @type {!Resources.ResourcesPanel} */ (self.runtime.sharedInstance
(Resources.ResourcesPanel)); | |
| 127 } | |
| 128 | |
| 129 /** | |
| 130 * @param {string} title | 115 * @param {string} title |
| 131 * @return {!UI.TreeElement} | 116 * @return {!UI.TreeElement} |
| 132 */ | 117 */ |
| 133 _addSidebarSection(title) { | 118 _addSidebarSection(title) { |
| 134 var treeElement = new UI.TreeElement(title, true); | 119 var treeElement = new UI.TreeElement(title, true); |
| 135 treeElement.listItemElement.classList.add('storage-group-list-item'); | 120 treeElement.listItemElement.classList.add('storage-group-list-item'); |
| 136 treeElement.setCollapsible(false); | 121 treeElement.setCollapsible(false); |
| 137 treeElement.selectable = false; | 122 treeElement.selectable = false; |
| 138 this._sidebarTree.appendChild(treeElement); | 123 this._sidebarTree.appendChild(treeElement); |
| 139 return treeElement; | 124 return treeElement; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 var cacheStorageModel = SDK.ServiceWorkerCacheModel.fromTarget(this._target)
; | 189 var cacheStorageModel = SDK.ServiceWorkerCacheModel.fromTarget(this._target)
; |
| 205 if (cacheStorageModel) | 190 if (cacheStorageModel) |
| 206 cacheStorageModel.enable(); | 191 cacheStorageModel.enable(); |
| 207 var resourceTreeModel = SDK.ResourceTreeModel.fromTarget(this._target); | 192 var resourceTreeModel = SDK.ResourceTreeModel.fromTarget(this._target); |
| 208 if (resourceTreeModel) | 193 if (resourceTreeModel) |
| 209 this._populateApplicationCacheTree(resourceTreeModel); | 194 this._populateApplicationCacheTree(resourceTreeModel); |
| 210 var domStorageModel = Resources.DOMStorageModel.fromTarget(this._target); | 195 var domStorageModel = Resources.DOMStorageModel.fromTarget(this._target); |
| 211 if (domStorageModel) | 196 if (domStorageModel) |
| 212 this._populateDOMStorageTree(domStorageModel); | 197 this._populateDOMStorageTree(domStorageModel); |
| 213 this.indexedDBListTreeElement._initialize(); | 198 this.indexedDBListTreeElement._initialize(); |
| 214 this.cacheStorageListTreeElement._initialize(); | 199 var serviceWorkerCacheModel = SDK.ServiceWorkerCacheModel.fromTarget(this._t
arget); |
| 200 this.cacheStorageListTreeElement._initialize(serviceWorkerCacheModel); |
| 215 this._initDefaultSelection(); | 201 this._initDefaultSelection(); |
| 216 } | 202 } |
| 217 | 203 |
| 218 _initDefaultSelection() { | 204 _initDefaultSelection() { |
| 219 var itemURL = this._resourcesLastSelectedItemSetting.get(); | 205 var itemURL = this._panel.lastSelectedItemURL(); |
| 220 if (itemURL) { | 206 if (itemURL) { |
| 221 var rootElement = this._sidebarTree.rootElement(); | 207 var rootElement = this._sidebarTree.rootElement(); |
| 222 for (var treeElement = rootElement.firstChild(); treeElement; | 208 for (var treeElement = rootElement.firstChild(); treeElement; |
| 223 treeElement = treeElement.traverseNextTreeElement(false, rootElement,
true)) { | 209 treeElement = treeElement.traverseNextTreeElement(false, rootElement,
true)) { |
| 224 if (treeElement.itemURL === itemURL) { | 210 if (treeElement.itemURL === itemURL) { |
| 225 treeElement.revealAndSelect(true); | 211 treeElement.revealAndSelect(true); |
| 226 return; | 212 return; |
| 227 } | 213 } |
| 228 } | 214 } |
| 229 } | 215 } |
| 230 this._manifestTreeElement.select(); | 216 this._manifestTreeElement.select(); |
| 231 } | 217 } |
| 232 | 218 |
| 233 _resetWithFrames() { | 219 _resetWithFrames() { |
| 234 this._resourcesSection.reset(); | 220 this._resourcesSection.reset(); |
| 235 this._reset(); | 221 this._reset(); |
| 236 } | 222 } |
| 237 | 223 |
| 238 _resetWebSQL() { | 224 _resetWebSQL() { |
| 239 if (this.visibleView instanceof Resources.DatabaseQueryView || | |
| 240 this.visibleView instanceof Resources.DatabaseTableView) { | |
| 241 this.visibleView.detach(); | |
| 242 delete this.visibleView; | |
| 243 } | |
| 244 | |
| 245 var queryViews = this._databaseQueryViews.valuesArray(); | 225 var queryViews = this._databaseQueryViews.valuesArray(); |
| 246 for (var i = 0; i < queryViews.length; ++i) { | 226 for (var i = 0; i < queryViews.length; ++i) { |
| 247 queryViews[i].removeEventListener( | 227 queryViews[i].removeEventListener( |
| 248 Resources.DatabaseQueryView.Events.SchemaUpdated, this._updateDatabase
Tables, this); | 228 Resources.DatabaseQueryView.Events.SchemaUpdated, this._updateDatabase
Tables, this); |
| 249 } | 229 } |
| 250 this._databaseTableViews.clear(); | 230 this._databaseTableViews.clear(); |
| 251 this._databaseQueryViews.clear(); | 231 this._databaseQueryViews.clear(); |
| 252 this._databaseTreeElements.clear(); | 232 this._databaseTreeElements.clear(); |
| 253 this.databasesListTreeElement.removeChildren(); | 233 this.databasesListTreeElement.removeChildren(); |
| 254 this.databasesListTreeElement.setExpandable(false); | 234 this.databasesListTreeElement.setExpandable(false); |
| 255 } | 235 } |
| 256 | 236 |
| 257 _resetDOMStorage() { | 237 _resetDOMStorage() { |
| 258 if (this.visibleView === this._domStorageView) { | |
| 259 this.visibleView.detach(); | |
| 260 delete this.visibleView; | |
| 261 } | |
| 262 | |
| 263 this._domStorageTreeElements.clear(); | 238 this._domStorageTreeElements.clear(); |
| 264 this.localStorageListTreeElement.removeChildren(); | 239 this.localStorageListTreeElement.removeChildren(); |
| 265 this.sessionStorageListTreeElement.removeChildren(); | 240 this.sessionStorageListTreeElement.removeChildren(); |
| 266 } | 241 } |
| 267 | 242 |
| 268 _resetCookies() { | 243 _resetCookies() { |
| 269 if (this.visibleView instanceof Resources.CookieItemsView) { | |
| 270 this.visibleView.detach(); | |
| 271 delete this.visibleView; | |
| 272 } | |
| 273 this.cookieListTreeElement.removeChildren(); | 244 this.cookieListTreeElement.removeChildren(); |
| 274 } | 245 } |
| 275 | 246 |
| 276 _resetCacheStorage() { | 247 _resetCacheStorage() { |
| 277 if (this.visibleView instanceof Resources.ServiceWorkerCacheView) { | |
| 278 this.visibleView.detach(); | |
| 279 delete this.visibleView; | |
| 280 } | |
| 281 this.cacheStorageListTreeElement.removeChildren(); | 248 this.cacheStorageListTreeElement.removeChildren(); |
| 282 this.cacheStorageListTreeElement.setExpandable(false); | 249 this.cacheStorageListTreeElement.setExpandable(false); |
| 283 } | 250 } |
| 284 | 251 |
| 285 _resetAppCache() { | 252 _resetAppCache() { |
| 286 for (var frameId of Object.keys(this._applicationCacheFrameElements)) | 253 for (var frameId of Object.keys(this._applicationCacheFrameElements)) |
| 287 this._applicationCacheFrameManifestRemoved({data: frameId}); | 254 this._applicationCacheFrameManifestRemoved({data: frameId}); |
| 288 this.applicationCacheListTreeElement.setExpandable(false); | 255 this.applicationCacheListTreeElement.setExpandable(false); |
| 289 } | 256 } |
| 290 | 257 |
| 291 _reset() { | 258 _reset() { |
| 292 this._domains = {}; | 259 this._domains = {}; |
| 293 this._resetWebSQL(); | 260 this._resetWebSQL(); |
| 294 this._resetDOMStorage(); | 261 this._resetDOMStorage(); |
| 295 this._resetCookies(); | 262 this._resetCookies(); |
| 296 this._resetCacheStorage(); | 263 this._resetCacheStorage(); |
| 297 // No need to this._resetAppCache. | 264 // No need to this._resetAppCache. |
| 298 | 265 |
| 299 if ((this.visibleView instanceof SourceFrame.ResourceSourceFrame) || | 266 this._panel.resetView(); |
| 300 (this.visibleView instanceof SourceFrame.ImageView) || (this.visibleView
instanceof SourceFrame.FontView)) { | |
| 301 this.visibleView.detach(); | |
| 302 delete this.visibleView; | |
| 303 } | |
| 304 | |
| 305 this._storageViewToolbar.removeToolbarItems(); | |
| 306 | 267 |
| 307 if (this._sidebarTree.selectedTreeElement) | 268 if (this._sidebarTree.selectedTreeElement) |
| 308 this._sidebarTree.selectedTreeElement.deselect(); | 269 this._sidebarTree.selectedTreeElement.deselect(); |
| 309 } | 270 } |
| 310 | 271 |
| 311 _frameNavigated(event) { | 272 _frameNavigated(event) { |
| 312 var frame = event.data; | 273 var frame = event.data; |
| 313 | 274 |
| 314 if (!frame.parentFrame) | 275 if (!frame.parentFrame) |
| 315 this._reset(); | 276 this._reset(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 333 * @param {!SDK.ResourceTreeFrame} frame | 294 * @param {!SDK.ResourceTreeFrame} frame |
| 334 */ | 295 */ |
| 335 _addCookieDocument(frame) { | 296 _addCookieDocument(frame) { |
| 336 var parsedURL = frame.url.asParsedURL(); | 297 var parsedURL = frame.url.asParsedURL(); |
| 337 if (!parsedURL || (parsedURL.scheme !== 'http' && parsedURL.scheme !== 'http
s' && parsedURL.scheme !== 'file')) | 298 if (!parsedURL || (parsedURL.scheme !== 'http' && parsedURL.scheme !== 'http
s' && parsedURL.scheme !== 'file')) |
| 338 return; | 299 return; |
| 339 | 300 |
| 340 var domain = parsedURL.securityOrigin(); | 301 var domain = parsedURL.securityOrigin(); |
| 341 if (!this._domains[domain]) { | 302 if (!this._domains[domain]) { |
| 342 this._domains[domain] = true; | 303 this._domains[domain] = true; |
| 343 var cookieDomainTreeElement = new Resources.CookieTreeElement(this, frame,
domain); | 304 var cookieDomainTreeElement = new Resources.CookieTreeElement(this._panel,
frame, domain); |
| 344 this.cookieListTreeElement.appendChild(cookieDomainTreeElement); | 305 this.cookieListTreeElement.appendChild(cookieDomainTreeElement); |
| 345 } | 306 } |
| 346 } | 307 } |
| 347 | 308 |
| 348 /** | 309 /** |
| 349 * @param {!Common.Event} event | 310 * @param {!Common.Event} event |
| 350 */ | 311 */ |
| 351 _domStorageAdded(event) { | 312 _domStorageAdded(event) { |
| 352 var domStorage = /** @type {!Resources.DOMStorage} */ (event.data); | 313 var domStorage = /** @type {!Resources.DOMStorage} */ (event.data); |
| 353 this._addDOMStorage(domStorage); | 314 this._addDOMStorage(domStorage); |
| 354 } | 315 } |
| 355 | 316 |
| 356 /** | 317 /** |
| 357 * @param {!Resources.DOMStorage} domStorage | 318 * @param {!Resources.DOMStorage} domStorage |
| 358 */ | 319 */ |
| 359 _addDOMStorage(domStorage) { | 320 _addDOMStorage(domStorage) { |
| 360 console.assert(!this._domStorageTreeElements.get(domStorage)); | 321 console.assert(!this._domStorageTreeElements.get(domStorage)); |
| 361 | 322 |
| 362 var domStorageTreeElement = new Resources.DOMStorageTreeElement(this, domSto
rage); | 323 var domStorageTreeElement = new Resources.DOMStorageTreeElement(this._panel,
domStorage); |
| 363 this._domStorageTreeElements.set(domStorage, domStorageTreeElement); | 324 this._domStorageTreeElements.set(domStorage, domStorageTreeElement); |
| 364 if (domStorage.isLocalStorage) | 325 if (domStorage.isLocalStorage) |
| 365 this.localStorageListTreeElement.appendChild(domStorageTreeElement); | 326 this.localStorageListTreeElement.appendChild(domStorageTreeElement); |
| 366 else | 327 else |
| 367 this.sessionStorageListTreeElement.appendChild(domStorageTreeElement); | 328 this.sessionStorageListTreeElement.appendChild(domStorageTreeElement); |
| 368 } | 329 } |
| 369 | 330 |
| 370 /** | 331 /** |
| 371 * @param {!Common.Event} event | 332 * @param {!Common.Event} event |
| 372 */ | 333 */ |
| (...skipping 21 matching lines...) Expand all Loading... |
| 394 * @param {!Resources.Database} database | 355 * @param {!Resources.Database} database |
| 395 */ | 356 */ |
| 396 selectDatabase(database) { | 357 selectDatabase(database) { |
| 397 if (database) { | 358 if (database) { |
| 398 this._showDatabase(database); | 359 this._showDatabase(database); |
| 399 this._databaseTreeElements.get(database).select(); | 360 this._databaseTreeElements.get(database).select(); |
| 400 } | 361 } |
| 401 } | 362 } |
| 402 | 363 |
| 403 /** | 364 /** |
| 404 * @param {!Resources.DOMStorage} domStorage | |
| 405 */ | |
| 406 selectDOMStorage(domStorage) { | |
| 407 if (domStorage) { | |
| 408 this._showDOMStorage(domStorage); | |
| 409 this._domStorageTreeElements.get(domStorage).select(); | |
| 410 } | |
| 411 } | |
| 412 | |
| 413 /** | |
| 414 * @param {!SDK.Resource} resource | 365 * @param {!SDK.Resource} resource |
| 415 * @param {number=} line | 366 * @param {number=} line |
| 416 * @param {number=} column | 367 * @param {number=} column |
| 417 * @return {boolean} | 368 * @return {boolean} |
| 418 */ | 369 */ |
| 419 showResource(resource, line, column) { | 370 showResource(resource, line, column) { |
| 420 var resourceTreeElement = Resources.FrameResourceTreeElement.forResource(res
ource); | 371 var resourceTreeElement = Resources.FrameResourceTreeElement.forResource(res
ource); |
| 421 if (resourceTreeElement) | 372 if (resourceTreeElement) |
| 422 resourceTreeElement.revealAndSelect(true); | 373 resourceTreeElement.revealAndSelect(true); |
| 423 | 374 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 if (!view) { | 416 if (!view) { |
| 466 view = new Resources.DatabaseQueryView(database); | 417 view = new Resources.DatabaseQueryView(database); |
| 467 this._databaseQueryViews.set(database, view); | 418 this._databaseQueryViews.set(database, view); |
| 468 view.addEventListener(Resources.DatabaseQueryView.Events.SchemaUpdated,
this._updateDatabaseTables, this); | 419 view.addEventListener(Resources.DatabaseQueryView.Events.SchemaUpdated,
this._updateDatabaseTables, this); |
| 469 } | 420 } |
| 470 } | 421 } |
| 471 | 422 |
| 472 this._innerShowView(view); | 423 this._innerShowView(view); |
| 473 } | 424 } |
| 474 | 425 |
| 475 /** | 426 _showApplicationCache(frameId) { |
| 476 * @param {!Resources.DOMStorage} domStorage | |
| 477 */ | |
| 478 _showDOMStorage(domStorage) { | |
| 479 if (!domStorage) | |
| 480 return; | |
| 481 | |
| 482 if (!this._domStorageView) | |
| 483 this._domStorageView = new Resources.DOMStorageItemsView(domStorage); | |
| 484 else | |
| 485 this._domStorageView.setStorage(domStorage); | |
| 486 this._innerShowView(this._domStorageView); | |
| 487 } | |
| 488 | |
| 489 /** | |
| 490 * @param {!Resources.CookieTreeElement} treeElement | |
| 491 * @param {string} cookieDomain | |
| 492 * @param {!SDK.Target} cookieFrameTarget | |
| 493 */ | |
| 494 showCookies(treeElement, cookieDomain, cookieFrameTarget) { | |
| 495 var model = SDK.CookieModel.fromTarget(cookieFrameTarget); | |
| 496 if (!this._cookieView) | |
| 497 this._cookieView = new Resources.CookieItemsView(treeElement, model, cooki
eDomain); | |
| 498 else | |
| 499 this._cookieView.setCookiesDomain(model, cookieDomain); | |
| 500 this._innerShowView(this._cookieView); | |
| 501 } | |
| 502 | |
| 503 /** | |
| 504 * @param {!SDK.Target} target | |
| 505 * @param {string} cookieDomain | |
| 506 */ | |
| 507 _clearCookies(target, cookieDomain) { | |
| 508 SDK.CookieModel.fromTarget(target).clear(cookieDomain, () => { | |
| 509 if (this._cookieView) | |
| 510 this._cookieView.refreshItems(); | |
| 511 }); | |
| 512 } | |
| 513 | |
| 514 showApplicationCache(frameId) { | |
| 515 if (!this._applicationCacheViews[frameId]) { | 427 if (!this._applicationCacheViews[frameId]) { |
| 516 this._applicationCacheViews[frameId] = | 428 this._applicationCacheViews[frameId] = |
| 517 new Resources.ApplicationCacheItemsView(this._applicationCacheModel, f
rameId); | 429 new Resources.ApplicationCacheItemsView(this._applicationCacheModel, f
rameId); |
| 518 } | 430 } |
| 519 | 431 |
| 520 this._innerShowView(this._applicationCacheViews[frameId]); | 432 this._innerShowView(this._applicationCacheViews[frameId]); |
| 521 } | 433 } |
| 522 | 434 |
| 523 /** | 435 /** |
| 524 * @param {!UI.Widget} view | 436 * @param {!UI.Widget} view |
| 525 */ | 437 */ |
| 526 showFileSystem(view) { | 438 showFileSystem(view) { |
| 527 this._innerShowView(view); | 439 this._innerShowView(view); |
| 528 } | 440 } |
| 529 | 441 |
| 530 showCategoryView(categoryName) { | |
| 531 if (!this._categoryView) | |
| 532 this._categoryView = new Resources.StorageCategoryView(); | |
| 533 this._categoryView.setText(categoryName); | |
| 534 this._innerShowView(this._categoryView); | |
| 535 } | |
| 536 | |
| 537 _innerShowView(view) { | 442 _innerShowView(view) { |
| 538 if (this.visibleView === view) | 443 this._panel.showView(view); |
| 539 return; | |
| 540 | |
| 541 if (this.visibleView) | |
| 542 this.visibleView.detach(); | |
| 543 | |
| 544 view.show(this.storageViews); | |
| 545 this.visibleView = view; | |
| 546 | |
| 547 this._storageViewToolbar.removeToolbarItems(); | |
| 548 var toolbarItems = (view instanceof UI.SimpleView && view.syncToolbarItems()
) || []; | |
| 549 for (var i = 0; i < toolbarItems.length; ++i) | |
| 550 this._storageViewToolbar.appendToolbarItem(toolbarItems[i]); | |
| 551 this._storageViewToolbar.element.classList.toggle('hidden', !toolbarItems.le
ngth); | |
| 552 } | |
| 553 | |
| 554 closeVisibleView() { | |
| 555 if (!this.visibleView) | |
| 556 return; | |
| 557 this.visibleView.detach(); | |
| 558 delete this.visibleView; | |
| 559 } | 444 } |
| 560 | 445 |
| 561 _updateDatabaseTables(event) { | 446 _updateDatabaseTables(event) { |
| 562 var database = event.data; | 447 var database = event.data; |
| 563 | 448 |
| 564 if (!database) | 449 if (!database) |
| 565 return; | 450 return; |
| 566 | 451 |
| 567 var databasesTreeElement = this._databaseTreeElements.get(database); | 452 var databasesTreeElement = this._databaseTreeElements.get(database); |
| 568 if (!databasesTreeElement) | 453 if (!databasesTreeElement) |
| 569 return; | 454 return; |
| 570 | 455 |
| 571 databasesTreeElement.invalidateChildren(); | 456 databasesTreeElement.invalidateChildren(); |
| 572 var tableViews = this._databaseTableViews.get(database); | 457 var tableViews = this._databaseTableViews.get(database); |
| 573 | 458 |
| 574 if (!tableViews) | 459 if (!tableViews) |
| 575 return; | 460 return; |
| 576 | 461 |
| 577 var tableNamesHash = {}; | 462 var tableNamesHash = {}; |
| 578 var self = this; | 463 var panel = this._panel; |
| 579 function tableNamesCallback(tableNames) { | 464 function tableNamesCallback(tableNames) { |
| 580 var tableNamesLength = tableNames.length; | 465 var tableNamesLength = tableNames.length; |
| 581 for (var i = 0; i < tableNamesLength; ++i) | 466 for (var i = 0; i < tableNamesLength; ++i) |
| 582 tableNamesHash[tableNames[i]] = true; | 467 tableNamesHash[tableNames[i]] = true; |
| 583 | 468 |
| 584 for (var tableName in tableViews) { | 469 for (var tableName in tableViews) { |
| 585 if (!(tableName in tableNamesHash)) { | 470 if (!(tableName in tableNamesHash)) { |
| 586 if (self.visibleView === tableViews[tableName]) | 471 if (panel.visibleView === tableViews[tableName]) |
| 587 self.closeVisibleView(); | 472 panel.showView(null); |
| 588 delete tableViews[tableName]; | 473 delete tableViews[tableName]; |
| 589 } | 474 } |
| 590 } | 475 } |
| 591 } | 476 } |
| 592 database.getTableNames(tableNamesCallback); | 477 database.getTableNames(tableNamesCallback); |
| 593 } | 478 } |
| 594 | 479 |
| 595 /** | 480 /** |
| 596 * @param {!Resources.DOMStorageModel} domStorageModel | 481 * @param {!Resources.DOMStorageModel} domStorageModel |
| 597 */ | 482 */ |
| (...skipping 27 matching lines...) Expand all Loading... |
| 625 this._applicationCacheModel.addEventListener( | 510 this._applicationCacheModel.addEventListener( |
| 626 Resources.ApplicationCacheModel.Events.NetworkStateChanged, this._applic
ationCacheNetworkStateChanged, this); | 511 Resources.ApplicationCacheModel.Events.NetworkStateChanged, this._applic
ationCacheNetworkStateChanged, this); |
| 627 } | 512 } |
| 628 | 513 |
| 629 _applicationCacheFrameManifestAdded(event) { | 514 _applicationCacheFrameManifestAdded(event) { |
| 630 var frameId = event.data; | 515 var frameId = event.data; |
| 631 var manifestURL = this._applicationCacheModel.frameManifestURL(frameId); | 516 var manifestURL = this._applicationCacheModel.frameManifestURL(frameId); |
| 632 | 517 |
| 633 var manifestTreeElement = this._applicationCacheManifestElements[manifestURL
]; | 518 var manifestTreeElement = this._applicationCacheManifestElements[manifestURL
]; |
| 634 if (!manifestTreeElement) { | 519 if (!manifestTreeElement) { |
| 635 manifestTreeElement = new Resources.ApplicationCacheManifestTreeElement(th
is, manifestURL); | 520 manifestTreeElement = new Resources.ApplicationCacheManifestTreeElement(th
is._panel, manifestURL); |
| 636 this.applicationCacheListTreeElement.appendChild(manifestTreeElement); | 521 this.applicationCacheListTreeElement.appendChild(manifestTreeElement); |
| 637 this._applicationCacheManifestElements[manifestURL] = manifestTreeElement; | 522 this._applicationCacheManifestElements[manifestURL] = manifestTreeElement; |
| 638 } | 523 } |
| 639 | 524 |
| 640 var frameTreeElement = new Resources.ApplicationCacheFrameTreeElement(this,
frameId, manifestURL); | 525 var model = SDK.ResourceTreeModel.fromTarget(this._target); |
| 526 var frameTreeElement = new Resources.ApplicationCacheFrameTreeElement(this,
model.frameForId(frameId), manifestURL); |
| 641 manifestTreeElement.appendChild(frameTreeElement); | 527 manifestTreeElement.appendChild(frameTreeElement); |
| 642 manifestTreeElement.expand(); | 528 manifestTreeElement.expand(); |
| 643 this._applicationCacheFrameElements[frameId] = frameTreeElement; | 529 this._applicationCacheFrameElements[frameId] = frameTreeElement; |
| 644 } | 530 } |
| 645 | 531 |
| 646 _applicationCacheFrameManifestRemoved(event) { | 532 _applicationCacheFrameManifestRemoved(event) { |
| 647 var frameId = event.data; | 533 var frameId = event.data; |
| 648 var frameTreeElement = this._applicationCacheFrameElements[frameId]; | 534 var frameTreeElement = this._applicationCacheFrameElements[frameId]; |
| 649 if (!frameTreeElement) | 535 if (!frameTreeElement) |
| 650 return; | 536 return; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 708 | 594 |
| 709 _onmouseleave(event) { | 595 _onmouseleave(event) { |
| 710 if (this._previousHoveredElement) { | 596 if (this._previousHoveredElement) { |
| 711 this._previousHoveredElement.hovered = false; | 597 this._previousHoveredElement.hovered = false; |
| 712 delete this._previousHoveredElement; | 598 delete this._previousHoveredElement; |
| 713 } | 599 } |
| 714 } | 600 } |
| 715 }; | 601 }; |
| 716 | 602 |
| 717 /** | 603 /** |
| 718 * @implements {Common.Revealer} | |
| 719 * @unrestricted | |
| 720 */ | |
| 721 Resources.ResourcesPanel.ResourceRevealer = class { | |
| 722 /** | |
| 723 * @override | |
| 724 * @param {!Object} resource | |
| 725 * @return {!Promise} | |
| 726 */ | |
| 727 reveal(resource) { | |
| 728 if (!(resource instanceof SDK.Resource)) | |
| 729 return Promise.reject(new Error('Internal error: not a resource')); | |
| 730 var panel = Resources.ResourcesPanel._instance(); | |
| 731 return UI.viewManager.showView('resources').then(panel.showResource.bind(pan
el, resource)); | |
| 732 } | |
| 733 }; | |
| 734 | |
| 735 /** | |
| 736 * @unrestricted | 604 * @unrestricted |
| 737 */ | 605 */ |
| 738 Resources.BaseStorageTreeElement = class extends UI.TreeElement { | 606 Resources.BaseStorageTreeElement = class extends UI.TreeElement { |
| 739 /** | 607 /** |
| 740 * @param {!Resources.ResourcesPanel} storagePanel | 608 * @param {!Resources.ResourcesPanel} storagePanel |
| 741 * @param {string} title | 609 * @param {string} title |
| 742 * @param {boolean} expandable | 610 * @param {boolean} expandable |
| 743 */ | 611 */ |
| 744 constructor(storagePanel, title, expandable) { | 612 constructor(storagePanel, title, expandable) { |
| 745 super(title, expandable); | 613 super(title, expandable); |
| 746 this._storagePanel = storagePanel; | 614 this._storagePanel = storagePanel; |
| 747 } | 615 } |
| 748 | 616 |
| 749 /** | 617 /** |
| 750 * @override | 618 * @override |
| 751 * @return {boolean} | 619 * @return {boolean} |
| 752 */ | 620 */ |
| 753 onselect(selectedByUser) { | 621 onselect(selectedByUser) { |
| 754 if (!selectedByUser) | 622 if (!selectedByUser) |
| 755 return false; | 623 return false; |
| 756 var itemURL = this.itemURL; | 624 var itemURL = this.itemURL; |
| 757 if (itemURL) | 625 if (itemURL) |
| 758 this._storagePanel._resourcesLastSelectedItemSetting.set(itemURL); | 626 this._storagePanel.setLastSelectedItemURL(itemURL); |
| 759 return false; | 627 return false; |
| 760 } | 628 } |
| 761 | 629 |
| 762 /** | 630 /** |
| 763 * @protected | 631 * @protected |
| 764 * @param {?UI.Widget} view | 632 * @param {?UI.Widget} view |
| 765 */ | 633 */ |
| 766 showView(view) { | 634 showView(view) { |
| 767 if (!view) { | 635 this._storagePanel.showView(view); |
| 768 this._storagePanel.visibleView.detach(); | |
| 769 return; | |
| 770 } | |
| 771 this._storagePanel._innerShowView(view); | |
| 772 } | 636 } |
| 773 }; | 637 }; |
| 774 | 638 |
| 775 /** | |
| 776 * @unrestricted | |
| 777 */ | |
| 778 Resources.StorageCategoryTreeElement = class extends Resources.BaseStorageTreeEl
ement { | 639 Resources.StorageCategoryTreeElement = class extends Resources.BaseStorageTreeEl
ement { |
| 779 /** | 640 /** |
| 780 * @param {!Resources.ResourcesPanel} storagePanel | 641 * @param {!Resources.ResourcesPanel} storagePanel |
| 781 * @param {string} categoryName | 642 * @param {string} categoryName |
| 782 * @param {string} settingsKey | 643 * @param {string} settingsKey |
| 783 */ | 644 */ |
| 784 constructor(storagePanel, categoryName, settingsKey) { | 645 constructor(storagePanel, categoryName, settingsKey) { |
| 785 super(storagePanel, categoryName, false); | 646 super(storagePanel, categoryName, false); |
| 786 this._expandedSetting = | 647 this._expandedSetting = |
| 787 Common.settings.createSetting('resources' + settingsKey + 'Expanded', se
ttingsKey === 'Frames'); | 648 Common.settings.createSetting('resources' + settingsKey + 'Expanded', se
ttingsKey === 'Frames'); |
| 788 this._categoryName = categoryName; | 649 this._categoryName = categoryName; |
| 789 } | 650 } |
| 790 | 651 |
| 791 /** | |
| 792 * @return {!SDK.Target} | |
| 793 */ | |
| 794 target() { | |
| 795 return this._storagePanel._target; | |
| 796 } | |
| 797 | 652 |
| 798 get itemURL() { | 653 get itemURL() { |
| 799 return 'category://' + this._categoryName; | 654 return 'category://' + this._categoryName; |
| 800 } | 655 } |
| 801 | 656 |
| 802 /** | 657 /** |
| 803 * @override | 658 * @override |
| 804 * @return {boolean} | 659 * @return {boolean} |
| 805 */ | 660 */ |
| 806 onselect(selectedByUser) { | 661 onselect(selectedByUser) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 831 oncollapse() { | 686 oncollapse() { |
| 832 this._expandedSetting.set(false); | 687 this._expandedSetting.set(false); |
| 833 } | 688 } |
| 834 }; | 689 }; |
| 835 | 690 |
| 836 /** | 691 /** |
| 837 * @unrestricted | 692 * @unrestricted |
| 838 */ | 693 */ |
| 839 Resources.DatabaseTreeElement = class extends Resources.BaseStorageTreeElement { | 694 Resources.DatabaseTreeElement = class extends Resources.BaseStorageTreeElement { |
| 840 /** | 695 /** |
| 841 * @param {!Resources.ResourcesPanel} storagePanel | 696 * @param {!Resources.ApplicationPanelSidebar} sidebar |
| 842 * @param {!Resources.Database} database | 697 * @param {!Resources.Database} database |
| 843 */ | 698 */ |
| 844 constructor(storagePanel, database) { | 699 constructor(sidebar, database) { |
| 845 super(storagePanel, database.name, true); | 700 super(sidebar._panel, database.name, true); |
| 701 this._sidebar = sidebar; |
| 846 this._database = database; | 702 this._database = database; |
| 847 | 703 |
| 848 var icon = UI.Icon.create('mediumicon-database', 'resource-tree-item'); | 704 var icon = UI.Icon.create('mediumicon-database', 'resource-tree-item'); |
| 849 this.setLeadingIcons([icon]); | 705 this.setLeadingIcons([icon]); |
| 850 } | 706 } |
| 851 | 707 |
| 852 get itemURL() { | 708 get itemURL() { |
| 853 return 'database://' + encodeURI(this._database.name); | 709 return 'database://' + encodeURI(this._database.name); |
| 854 } | 710 } |
| 855 | 711 |
| 856 /** | 712 /** |
| 857 * @override | 713 * @override |
| 858 * @return {boolean} | 714 * @return {boolean} |
| 859 */ | 715 */ |
| 860 onselect(selectedByUser) { | 716 onselect(selectedByUser) { |
| 861 super.onselect(selectedByUser); | 717 super.onselect(selectedByUser); |
| 862 this._storagePanel._showDatabase(this._database); | 718 this._sidebar._showDatabase(this._database); |
| 863 return false; | 719 return false; |
| 864 } | 720 } |
| 865 | 721 |
| 866 /** | 722 /** |
| 867 * @override | 723 * @override |
| 868 */ | 724 */ |
| 869 onexpand() { | 725 onexpand() { |
| 870 this._updateChildren(); | 726 this._updateChildren(); |
| 871 } | 727 } |
| 872 | 728 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 883 this.appendChild(new Resources.DatabaseTableTreeElement(this._storagePan
el, this._database, tableNames[i])); | 739 this.appendChild(new Resources.DatabaseTableTreeElement(this._storagePan
el, this._database, tableNames[i])); |
| 884 } | 740 } |
| 885 this._database.getTableNames(tableNamesCallback.bind(this)); | 741 this._database.getTableNames(tableNamesCallback.bind(this)); |
| 886 } | 742 } |
| 887 }; | 743 }; |
| 888 | 744 |
| 889 /** | 745 /** |
| 890 * @unrestricted | 746 * @unrestricted |
| 891 */ | 747 */ |
| 892 Resources.DatabaseTableTreeElement = class extends Resources.BaseStorageTreeElem
ent { | 748 Resources.DatabaseTableTreeElement = class extends Resources.BaseStorageTreeElem
ent { |
| 893 constructor(storagePanel, database, tableName) { | 749 constructor(sidebar, database, tableName) { |
| 894 super(storagePanel, tableName, false); | 750 super(sidebar._panel, tableName, false); |
| 751 this._sidebar = sidebar; |
| 895 this._database = database; | 752 this._database = database; |
| 896 this._tableName = tableName; | 753 this._tableName = tableName; |
| 897 var icon = UI.Icon.create('mediumicon-table', 'resource-tree-item'); | 754 var icon = UI.Icon.create('mediumicon-table', 'resource-tree-item'); |
| 898 this.setLeadingIcons([icon]); | 755 this.setLeadingIcons([icon]); |
| 899 } | 756 } |
| 900 | 757 |
| 901 get itemURL() { | 758 get itemURL() { |
| 902 return 'database://' + encodeURI(this._database.name) + '/' + encodeURI(this
._tableName); | 759 return 'database://' + encodeURI(this._database.name) + '/' + encodeURI(this
._tableName); |
| 903 } | 760 } |
| 904 | 761 |
| 905 /** | 762 /** |
| 906 * @override | 763 * @override |
| 907 * @return {boolean} | 764 * @return {boolean} |
| 908 */ | 765 */ |
| 909 onselect(selectedByUser) { | 766 onselect(selectedByUser) { |
| 910 super.onselect(selectedByUser); | 767 super.onselect(selectedByUser); |
| 911 this._storagePanel._showDatabase(this._database, this._tableName); | 768 this._sidebar._showDatabase(this._database, this._tableName); |
| 912 return false; | 769 return false; |
| 913 } | 770 } |
| 914 }; | 771 }; |
| 915 | 772 |
| 916 /** | 773 /** |
| 917 * @unrestricted | 774 * @unrestricted |
| 918 */ | 775 */ |
| 919 Resources.ServiceWorkerCacheTreeElement = class extends Resources.StorageCategor
yTreeElement { | 776 Resources.ServiceWorkerCacheTreeElement = class extends Resources.StorageCategor
yTreeElement { |
| 920 /** | 777 /** |
| 921 * @param {!Resources.ResourcesPanel} storagePanel | 778 * @param {!Resources.ResourcesPanel} storagePanel |
| 922 */ | 779 */ |
| 923 constructor(storagePanel) { | 780 constructor(storagePanel) { |
| 924 super(storagePanel, Common.UIString('Cache Storage'), 'CacheStorage'); | 781 super(storagePanel, Common.UIString('Cache Storage'), 'CacheStorage'); |
| 925 var icon = UI.Icon.create('mediumicon-database', 'resource-tree-item'); | 782 var icon = UI.Icon.create('mediumicon-database', 'resource-tree-item'); |
| 926 this.setLeadingIcons([icon]); | 783 this.setLeadingIcons([icon]); |
| 784 /** @type {?SDK.ServiceWorkerCacheModel} */ |
| 785 this._swCacheModel = null; |
| 927 } | 786 } |
| 928 | 787 |
| 929 _initialize() { | 788 /** |
| 789 * @param {?SDK.ServiceWorkerCacheModel} model |
| 790 */ |
| 791 _initialize(model) { |
| 930 /** @type {!Array.<!Resources.SWCacheTreeElement>} */ | 792 /** @type {!Array.<!Resources.SWCacheTreeElement>} */ |
| 931 this._swCacheTreeElements = []; | 793 this._swCacheTreeElements = []; |
| 932 var target = this._storagePanel._target; | 794 this._swCacheModel = model; |
| 933 var model = target && SDK.ServiceWorkerCacheModel.fromTarget(target); | |
| 934 if (model) { | 795 if (model) { |
| 935 for (var cache of model.caches()) | 796 for (var cache of model.caches()) |
| 936 this._addCache(model, cache); | 797 this._addCache(model, cache); |
| 937 } | 798 } |
| 938 SDK.targetManager.addModelListener( | 799 SDK.targetManager.addModelListener( |
| 939 SDK.ServiceWorkerCacheModel, SDK.ServiceWorkerCacheModel.Events.CacheAdd
ed, this._cacheAdded, this); | 800 SDK.ServiceWorkerCacheModel, SDK.ServiceWorkerCacheModel.Events.CacheAdd
ed, this._cacheAdded, this); |
| 940 SDK.targetManager.addModelListener( | 801 SDK.targetManager.addModelListener( |
| 941 SDK.ServiceWorkerCacheModel, SDK.ServiceWorkerCacheModel.Events.CacheRem
oved, this._cacheRemoved, this); | 802 SDK.ServiceWorkerCacheModel, SDK.ServiceWorkerCacheModel.Events.CacheRem
oved, this._cacheRemoved, this); |
| 942 } | 803 } |
| 943 | 804 |
| 944 /** | 805 /** |
| 945 * @override | 806 * @override |
| 946 */ | 807 */ |
| 947 onattach() { | 808 onattach() { |
| 948 super.onattach(); | 809 super.onattach(); |
| 949 this.listItemElement.addEventListener('contextmenu', this._handleContextMenu
Event.bind(this), true); | 810 this.listItemElement.addEventListener('contextmenu', this._handleContextMenu
Event.bind(this), true); |
| 950 } | 811 } |
| 951 | 812 |
| 952 _handleContextMenuEvent(event) { | 813 _handleContextMenuEvent(event) { |
| 953 var contextMenu = new UI.ContextMenu(event); | 814 var contextMenu = new UI.ContextMenu(event); |
| 954 contextMenu.appendItem(Common.UIString('Refresh Caches'), this._refreshCache
s.bind(this)); | 815 contextMenu.appendItem(Common.UIString('Refresh Caches'), this._refreshCache
s.bind(this)); |
| 955 contextMenu.show(); | 816 contextMenu.show(); |
| 956 } | 817 } |
| 957 | 818 |
| 958 _refreshCaches() { | 819 _refreshCaches() { |
| 959 var target = this._storagePanel._target; | 820 if (this._swCacheModel) |
| 960 if (target) { | 821 this._swCacheModel.refreshCacheNames(); |
| 961 var model = SDK.ServiceWorkerCacheModel.fromTarget(target); | |
| 962 if (!model) | |
| 963 return; | |
| 964 model.refreshCacheNames(); | |
| 965 } | |
| 966 } | 822 } |
| 967 | 823 |
| 968 /** | 824 /** |
| 969 * @param {!Common.Event} event | 825 * @param {!Common.Event} event |
| 970 */ | 826 */ |
| 971 _cacheAdded(event) { | 827 _cacheAdded(event) { |
| 972 var cache = /** @type {!SDK.ServiceWorkerCacheModel.Cache} */ (event.data.ca
che); | 828 var cache = /** @type {!SDK.ServiceWorkerCacheModel.Cache} */ (event.data.ca
che); |
| 973 var model = /** @type {!SDK.ServiceWorkerCacheModel} */ (event.data.model); | 829 var model = /** @type {!SDK.ServiceWorkerCacheModel} */ (event.data.model); |
| 974 this._addCache(model, cache); | 830 this._addCache(model, cache); |
| 975 } | 831 } |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1173 return 'clear-storage://'; | 1029 return 'clear-storage://'; |
| 1174 } | 1030 } |
| 1175 | 1031 |
| 1176 /** | 1032 /** |
| 1177 * @override | 1033 * @override |
| 1178 * @return {boolean} | 1034 * @return {boolean} |
| 1179 */ | 1035 */ |
| 1180 onselect(selectedByUser) { | 1036 onselect(selectedByUser) { |
| 1181 super.onselect(selectedByUser); | 1037 super.onselect(selectedByUser); |
| 1182 if (!this._view) | 1038 if (!this._view) |
| 1183 this._view = new Resources.ClearStorageView(this._storagePanel); | 1039 this._view = new Resources.ClearStorageView(); |
| 1184 this.showView(this._view); | 1040 this.showView(this._view); |
| 1185 return false; | 1041 return false; |
| 1186 } | 1042 } |
| 1187 }; | 1043 }; |
| 1188 | 1044 |
| 1189 /** | 1045 /** |
| 1190 * @unrestricted | 1046 * @unrestricted |
| 1191 */ | 1047 */ |
| 1192 Resources.IndexedDBTreeElement = class extends Resources.StorageCategoryTreeElem
ent { | 1048 Resources.IndexedDBTreeElement = class extends Resources.StorageCategoryTreeElem
ent { |
| 1193 /** | 1049 /** |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1597 clear() { | 1453 clear() { |
| 1598 if (this._view) | 1454 if (this._view) |
| 1599 this._view.clear(); | 1455 this._view.clear(); |
| 1600 } | 1456 } |
| 1601 }; | 1457 }; |
| 1602 | 1458 |
| 1603 /** | 1459 /** |
| 1604 * @unrestricted | 1460 * @unrestricted |
| 1605 */ | 1461 */ |
| 1606 Resources.DOMStorageTreeElement = class extends Resources.BaseStorageTreeElement
{ | 1462 Resources.DOMStorageTreeElement = class extends Resources.BaseStorageTreeElement
{ |
| 1463 /** |
| 1464 * @param {!Resources.ResourcesPanel} storagePanel |
| 1465 * @param {!Resources.DOMStorage} domStorage |
| 1466 */ |
| 1607 constructor(storagePanel, domStorage) { | 1467 constructor(storagePanel, domStorage) { |
| 1608 super(storagePanel, domStorage.securityOrigin ? domStorage.securityOrigin :
Common.UIString('Local Files'), false); | 1468 super(storagePanel, domStorage.securityOrigin ? domStorage.securityOrigin :
Common.UIString('Local Files'), false); |
| 1609 this._domStorage = domStorage; | 1469 this._domStorage = domStorage; |
| 1610 var icon = UI.Icon.create('mediumicon-table', 'resource-tree-item'); | 1470 var icon = UI.Icon.create('mediumicon-table', 'resource-tree-item'); |
| 1611 this.setLeadingIcons([icon]); | 1471 this.setLeadingIcons([icon]); |
| 1612 } | 1472 } |
| 1613 | 1473 |
| 1614 get itemURL() { | 1474 get itemURL() { |
| 1615 return 'storage://' + this._domStorage.securityOrigin + '/' + | 1475 return 'storage://' + this._domStorage.securityOrigin + '/' + |
| 1616 (this._domStorage.isLocalStorage ? 'local' : 'session'); | 1476 (this._domStorage.isLocalStorage ? 'local' : 'session'); |
| 1617 } | 1477 } |
| 1618 | 1478 |
| 1619 /** | 1479 /** |
| 1620 * @override | 1480 * @override |
| 1621 * @return {boolean} | 1481 * @return {boolean} |
| 1622 */ | 1482 */ |
| 1623 onselect(selectedByUser) { | 1483 onselect(selectedByUser) { |
| 1624 super.onselect(selectedByUser); | 1484 super.onselect(selectedByUser); |
| 1625 this._storagePanel._showDOMStorage(this._domStorage); | 1485 this._storagePanel.showDOMStorage(this._domStorage); |
| 1626 return false; | 1486 return false; |
| 1627 } | 1487 } |
| 1628 | 1488 |
| 1629 /** | 1489 /** |
| 1630 * @override | 1490 * @override |
| 1631 */ | 1491 */ |
| 1632 onattach() { | 1492 onattach() { |
| 1633 super.onattach(); | 1493 super.onattach(); |
| 1634 this.listItemElement.addEventListener('contextmenu', this._handleContextMenu
Event.bind(this), true); | 1494 this.listItemElement.addEventListener('contextmenu', this._handleContextMenu
Event.bind(this), true); |
| 1635 } | 1495 } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1666 super.onattach(); | 1526 super.onattach(); |
| 1667 this.listItemElement.addEventListener('contextmenu', this._handleContextMenu
Event.bind(this), true); | 1527 this.listItemElement.addEventListener('contextmenu', this._handleContextMenu
Event.bind(this), true); |
| 1668 } | 1528 } |
| 1669 | 1529 |
| 1670 /** | 1530 /** |
| 1671 * @param {!Event} event | 1531 * @param {!Event} event |
| 1672 */ | 1532 */ |
| 1673 _handleContextMenuEvent(event) { | 1533 _handleContextMenuEvent(event) { |
| 1674 var contextMenu = new UI.ContextMenu(event); | 1534 var contextMenu = new UI.ContextMenu(event); |
| 1675 contextMenu.appendItem( | 1535 contextMenu.appendItem( |
| 1676 Common.UIString('Clear'), () => this._storagePanel._clearCookies(this._t
arget, this._cookieDomain)); | 1536 Common.UIString('Clear'), () => this._storagePanel.clearCookies(this._ta
rget, this._cookieDomain)); |
| 1677 contextMenu.show(); | 1537 contextMenu.show(); |
| 1678 } | 1538 } |
| 1679 | 1539 |
| 1680 /** | 1540 /** |
| 1681 * @override | 1541 * @override |
| 1682 * @return {boolean} | 1542 * @return {boolean} |
| 1683 */ | 1543 */ |
| 1684 onselect(selectedByUser) { | 1544 onselect(selectedByUser) { |
| 1685 super.onselect(selectedByUser); | 1545 super.onselect(selectedByUser); |
| 1686 this._storagePanel.showCookies(this, this._cookieDomain, this._target); | 1546 this._storagePanel.showCookies(this._target, this._cookieDomain); |
| 1687 return false; | 1547 return false; |
| 1688 } | 1548 } |
| 1689 }; | 1549 }; |
| 1690 | 1550 |
| 1691 /** | 1551 /** |
| 1692 * @unrestricted | 1552 * @unrestricted |
| 1693 */ | 1553 */ |
| 1694 Resources.ApplicationCacheManifestTreeElement = class extends Resources.BaseStor
ageTreeElement { | 1554 Resources.ApplicationCacheManifestTreeElement = class extends Resources.BaseStor
ageTreeElement { |
| 1695 constructor(storagePanel, manifestURL) { | 1555 constructor(storagePanel, manifestURL) { |
| 1696 var title = new Common.ParsedURL(manifestURL).displayName; | 1556 var title = new Common.ParsedURL(manifestURL).displayName; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1716 this._storagePanel.showCategoryView(this._manifestURL); | 1576 this._storagePanel.showCategoryView(this._manifestURL); |
| 1717 return false; | 1577 return false; |
| 1718 } | 1578 } |
| 1719 }; | 1579 }; |
| 1720 | 1580 |
| 1721 /** | 1581 /** |
| 1722 * @unrestricted | 1582 * @unrestricted |
| 1723 */ | 1583 */ |
| 1724 Resources.ApplicationCacheFrameTreeElement = class extends Resources.BaseStorage
TreeElement { | 1584 Resources.ApplicationCacheFrameTreeElement = class extends Resources.BaseStorage
TreeElement { |
| 1725 /** | 1585 /** |
| 1726 * @param {!Resources.ResourcesPanel} storagePanel | 1586 * @param {!Resources.ApplicationPanelSidebar} sidebar |
| 1727 * @param {!Protocol.Page.FrameId} frameId | 1587 * @param {!SDK.ResourceTreeFrame} frame |
| 1728 * @param {string} manifestURL | 1588 * @param {string} manifestURL |
| 1729 */ | 1589 */ |
| 1730 constructor(storagePanel, frameId, manifestURL) { | 1590 constructor(sidebar, frame, manifestURL) { |
| 1731 super(storagePanel, '', false); | 1591 super(sidebar._panel, '', false); |
| 1732 this._frameId = frameId; | 1592 this._sidebar = sidebar; |
| 1593 this._frameId = frame.id; |
| 1733 this._manifestURL = manifestURL; | 1594 this._manifestURL = manifestURL; |
| 1734 this._refreshTitles(); | 1595 this._refreshTitles(frame); |
| 1735 | 1596 |
| 1736 var icon = UI.Icon.create('largeicon-navigator-folder', 'navigator-tree-item
'); | 1597 var icon = UI.Icon.create('largeicon-navigator-folder', 'navigator-tree-item
'); |
| 1737 icon.classList.add('navigator-folder-tree-item'); | 1598 icon.classList.add('navigator-folder-tree-item'); |
| 1738 this.setLeadingIcons([icon]); | 1599 this.setLeadingIcons([icon]); |
| 1739 } | 1600 } |
| 1740 | 1601 |
| 1741 get itemURL() { | 1602 get itemURL() { |
| 1742 return 'appcache://' + this._manifestURL + '/' + encodeURI(this.titleAsText(
)); | 1603 return 'appcache://' + this._manifestURL + '/' + encodeURI(this.titleAsText(
)); |
| 1743 } | 1604 } |
| 1744 | 1605 |
| 1745 get frameId() { | 1606 get frameId() { |
| 1746 return this._frameId; | 1607 return this._frameId; |
| 1747 } | 1608 } |
| 1748 | 1609 |
| 1749 get manifestURL() { | 1610 get manifestURL() { |
| 1750 return this._manifestURL; | 1611 return this._manifestURL; |
| 1751 } | 1612 } |
| 1752 | 1613 |
| 1753 _refreshTitles() { | 1614 /** |
| 1754 var resourceTreeModel = SDK.ResourceTreeModel.fromTarget(this._storagePanel.
_target); | 1615 * @param {!SDK.ResourceTreeFrame} frame |
| 1755 var frame = resourceTreeModel.frameForId(this._frameId); | 1616 */ |
| 1617 _refreshTitles(frame) { |
| 1756 this.title = frame.displayName(); | 1618 this.title = frame.displayName(); |
| 1757 } | 1619 } |
| 1758 | 1620 |
| 1759 frameNavigated() { | 1621 /** |
| 1760 this._refreshTitles(); | 1622 * @param {!SDK.ResourceTreeFrame} frame |
| 1623 */ |
| 1624 frameNavigated(frame) { |
| 1625 this._refreshTitles(frame); |
| 1761 } | 1626 } |
| 1762 | 1627 |
| 1763 /** | 1628 /** |
| 1764 * @override | 1629 * @override |
| 1765 * @return {boolean} | 1630 * @return {boolean} |
| 1766 */ | 1631 */ |
| 1767 onselect(selectedByUser) { | 1632 onselect(selectedByUser) { |
| 1768 super.onselect(selectedByUser); | 1633 super.onselect(selectedByUser); |
| 1769 this._storagePanel.showApplicationCache(this._frameId); | 1634 this._sidebar._showApplicationCache(this._frameId); |
| 1770 return false; | 1635 return false; |
| 1771 } | 1636 } |
| 1772 }; | 1637 }; |
| 1773 | 1638 |
| 1774 /** | 1639 /** |
| 1775 * @unrestricted | 1640 * @unrestricted |
| 1776 */ | 1641 */ |
| 1777 Resources.StorageCategoryView = class extends UI.VBox { | 1642 Resources.StorageCategoryView = class extends UI.VBox { |
| 1778 constructor() { | 1643 constructor() { |
| 1779 super(); | 1644 super(); |
| 1780 | 1645 |
| 1781 this.element.classList.add('storage-view'); | 1646 this.element.classList.add('storage-view'); |
| 1782 this._emptyWidget = new UI.EmptyWidget(''); | 1647 this._emptyWidget = new UI.EmptyWidget(''); |
| 1783 this._emptyWidget.show(this.element); | 1648 this._emptyWidget.show(this.element); |
| 1784 } | 1649 } |
| 1785 | 1650 |
| 1786 setText(text) { | 1651 setText(text) { |
| 1787 this._emptyWidget.text = text; | 1652 this._emptyWidget.text = text; |
| 1788 } | 1653 } |
| 1789 }; | 1654 }; |
| OLD | NEW |