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

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

Issue 2747123008: [DevTools] Separate old Application tab code (Closed)
Patch Set: [DevTools] Separate old Application tab code Created 3 years, 9 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
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 13 matching lines...) Expand all
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
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
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
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
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
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
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
737 */
738 Resources.BaseStorageTreeElement = class extends UI.TreeElement {
739 /**
740 * @param {!Resources.ResourcesPanel} storagePanel
741 * @param {string} title
742 * @param {boolean} expandable
743 */
744 constructor(storagePanel, title, expandable) {
745 super(title, expandable);
746 this._storagePanel = storagePanel;
747 }
748
749 /**
750 * @override
751 * @return {boolean}
752 */
753 onselect(selectedByUser) {
754 if (!selectedByUser)
755 return false;
756 var itemURL = this.itemURL;
757 if (itemURL)
758 this._storagePanel._resourcesLastSelectedItemSetting.set(itemURL);
759 return false;
760 }
761
762 /**
763 * @protected
764 * @param {?UI.Widget} view
765 */
766 showView(view) {
767 if (!view) {
768 this._storagePanel.visibleView.detach();
769 return;
770 }
771 this._storagePanel._innerShowView(view);
772 }
773 };
774
775 /**
776 * @unrestricted
777 */
778 Resources.StorageCategoryTreeElement = class extends Resources.BaseStorageTreeEl ement {
779 /**
780 * @param {!Resources.ResourcesPanel} storagePanel
781 * @param {string} categoryName
782 * @param {string} settingsKey
783 */
784 constructor(storagePanel, categoryName, settingsKey) {
785 super(storagePanel, categoryName, false);
786 this._expandedSetting =
787 Common.settings.createSetting('resources' + settingsKey + 'Expanded', se ttingsKey === 'Frames');
788 this._categoryName = categoryName;
789 }
790
791 /**
792 * @return {!SDK.Target}
793 */
794 target() {
795 return this._storagePanel._target;
796 }
797
798 get itemURL() {
799 return 'category://' + this._categoryName;
800 }
801
802 /**
803 * @override
804 * @return {boolean}
805 */
806 onselect(selectedByUser) {
807 super.onselect(selectedByUser);
808 this._storagePanel.showCategoryView(this._categoryName);
809 return false;
810 }
811
812 /**
813 * @override
814 */
815 onattach() {
816 super.onattach();
817 if (this._expandedSetting.get())
818 this.expand();
819 }
820
821 /**
822 * @override
823 */
824 onexpand() {
825 this._expandedSetting.set(true);
826 }
827
828 /**
829 * @override
830 */
831 oncollapse() {
832 this._expandedSetting.set(false);
833 }
834 };
835
836 /**
837 * @unrestricted 604 * @unrestricted
838 */ 605 */
839 Resources.DatabaseTreeElement = class extends Resources.BaseStorageTreeElement { 606 Resources.DatabaseTreeElement = class extends Resources.BaseStorageTreeElement {
840 /** 607 /**
841 * @param {!Resources.ResourcesPanel} storagePanel 608 * @param {!Resources.ApplicationPanelSidebar} storagePanel
842 * @param {!Resources.Database} database 609 * @param {!Resources.Database} database
843 */ 610 */
844 constructor(storagePanel, database) { 611 constructor(storagePanel, database) {
845 super(storagePanel, database.name, true); 612 super(storagePanel._panel, database.name, true);
613 this._storagePanel = storagePanel;
846 this._database = database; 614 this._database = database;
847 615
848 var icon = UI.Icon.create('mediumicon-database', 'resource-tree-item'); 616 var icon = UI.Icon.create('mediumicon-database', 'resource-tree-item');
849 this.setLeadingIcons([icon]); 617 this.setLeadingIcons([icon]);
850 } 618 }
851 619
852 get itemURL() { 620 get itemURL() {
853 return 'database://' + encodeURI(this._database.name); 621 return 'database://' + encodeURI(this._database.name);
854 } 622 }
855 623
(...skipping 17 matching lines...) Expand all
873 _updateChildren() { 641 _updateChildren() {
874 this.removeChildren(); 642 this.removeChildren();
875 643
876 /** 644 /**
877 * @param {!Array.<string>} tableNames 645 * @param {!Array.<string>} tableNames
878 * @this {Resources.DatabaseTreeElement} 646 * @this {Resources.DatabaseTreeElement}
879 */ 647 */
880 function tableNamesCallback(tableNames) { 648 function tableNamesCallback(tableNames) {
881 var tableNamesLength = tableNames.length; 649 var tableNamesLength = tableNames.length;
882 for (var i = 0; i < tableNamesLength; ++i) 650 for (var i = 0; i < tableNamesLength; ++i)
883 this.appendChild(new Resources.DatabaseTableTreeElement(this._storagePan el, this._database, tableNames[i])); 651 this.appendChild(new Resources.DatabaseTableTreeElement(this.appPanel, t his._database, tableNames[i]));
884 } 652 }
885 this._database.getTableNames(tableNamesCallback.bind(this)); 653 this._database.getTableNames(tableNamesCallback.bind(this));
886 } 654 }
887 }; 655 };
888 656
889 /** 657 /**
890 * @unrestricted 658 * @unrestricted
891 */ 659 */
892 Resources.DatabaseTableTreeElement = class extends Resources.BaseStorageTreeElem ent { 660 Resources.DatabaseTableTreeElement = class extends Resources.BaseStorageTreeElem ent {
893 constructor(storagePanel, database, tableName) { 661 constructor(storagePanel, database, tableName) {
894 super(storagePanel, tableName, false); 662 super(storagePanel._panel, tableName, false);
663 this._storagePanel = storagePanel;
895 this._database = database; 664 this._database = database;
896 this._tableName = tableName; 665 this._tableName = tableName;
897 var icon = UI.Icon.create('mediumicon-table', 'resource-tree-item'); 666 var icon = UI.Icon.create('mediumicon-table', 'resource-tree-item');
898 this.setLeadingIcons([icon]); 667 this.setLeadingIcons([icon]);
899 } 668 }
900 669
901 get itemURL() { 670 get itemURL() {
902 return 'database://' + encodeURI(this._database.name) + '/' + encodeURI(this ._tableName); 671 return 'database://' + encodeURI(this._database.name) + '/' + encodeURI(this ._tableName);
903 } 672 }
904 673
(...skipping 12 matching lines...) Expand all
917 * @unrestricted 686 * @unrestricted
918 */ 687 */
919 Resources.ServiceWorkerCacheTreeElement = class extends Resources.StorageCategor yTreeElement { 688 Resources.ServiceWorkerCacheTreeElement = class extends Resources.StorageCategor yTreeElement {
920 /** 689 /**
921 * @param {!Resources.ResourcesPanel} storagePanel 690 * @param {!Resources.ResourcesPanel} storagePanel
922 */ 691 */
923 constructor(storagePanel) { 692 constructor(storagePanel) {
924 super(storagePanel, Common.UIString('Cache Storage'), 'CacheStorage'); 693 super(storagePanel, Common.UIString('Cache Storage'), 'CacheStorage');
925 var icon = UI.Icon.create('mediumicon-database', 'resource-tree-item'); 694 var icon = UI.Icon.create('mediumicon-database', 'resource-tree-item');
926 this.setLeadingIcons([icon]); 695 this.setLeadingIcons([icon]);
696 /** @type {?SDK.ServiceWorkerCacheModel} */
697 this._swCacheModel = null;
927 } 698 }
928 699
929 _initialize() { 700 /**
701 * @param {?SDK.ServiceWorkerCacheModel} model
702 */
703 _initialize(model) {
930 /** @type {!Array.<!Resources.SWCacheTreeElement>} */ 704 /** @type {!Array.<!Resources.SWCacheTreeElement>} */
931 this._swCacheTreeElements = []; 705 this._swCacheTreeElements = [];
932 var target = this._storagePanel._target; 706 this._swCacheModel = model;
933 var model = target && SDK.ServiceWorkerCacheModel.fromTarget(target);
934 if (model) { 707 if (model) {
935 for (var cache of model.caches()) 708 for (var cache of model.caches())
936 this._addCache(model, cache); 709 this._addCache(model, cache);
937 } 710 }
938 SDK.targetManager.addModelListener( 711 SDK.targetManager.addModelListener(
939 SDK.ServiceWorkerCacheModel, SDK.ServiceWorkerCacheModel.Events.CacheAdd ed, this._cacheAdded, this); 712 SDK.ServiceWorkerCacheModel, SDK.ServiceWorkerCacheModel.Events.CacheAdd ed, this._cacheAdded, this);
940 SDK.targetManager.addModelListener( 713 SDK.targetManager.addModelListener(
941 SDK.ServiceWorkerCacheModel, SDK.ServiceWorkerCacheModel.Events.CacheRem oved, this._cacheRemoved, this); 714 SDK.ServiceWorkerCacheModel, SDK.ServiceWorkerCacheModel.Events.CacheRem oved, this._cacheRemoved, this);
942 } 715 }
943 716
944 /** 717 /**
945 * @override 718 * @override
946 */ 719 */
947 onattach() { 720 onattach() {
948 super.onattach(); 721 super.onattach();
949 this.listItemElement.addEventListener('contextmenu', this._handleContextMenu Event.bind(this), true); 722 this.listItemElement.addEventListener('contextmenu', this._handleContextMenu Event.bind(this), true);
950 } 723 }
951 724
952 _handleContextMenuEvent(event) { 725 _handleContextMenuEvent(event) {
953 var contextMenu = new UI.ContextMenu(event); 726 var contextMenu = new UI.ContextMenu(event);
954 contextMenu.appendItem(Common.UIString('Refresh Caches'), this._refreshCache s.bind(this)); 727 contextMenu.appendItem(Common.UIString('Refresh Caches'), this._refreshCache s.bind(this));
955 contextMenu.show(); 728 contextMenu.show();
956 } 729 }
957 730
958 _refreshCaches() { 731 _refreshCaches() {
959 var target = this._storagePanel._target; 732 if (this._swCacheModel)
960 if (target) { 733 this._swCacheModel.refreshCacheNames();
961 var model = SDK.ServiceWorkerCacheModel.fromTarget(target);
962 if (!model)
963 return;
964 model.refreshCacheNames();
965 }
966 } 734 }
967 735
968 /** 736 /**
969 * @param {!Common.Event} event 737 * @param {!Common.Event} event
970 */ 738 */
971 _cacheAdded(event) { 739 _cacheAdded(event) {
972 var cache = /** @type {!SDK.ServiceWorkerCacheModel.Cache} */ (event.data.ca che); 740 var cache = /** @type {!SDK.ServiceWorkerCacheModel.Cache} */ (event.data.ca che);
973 var model = /** @type {!SDK.ServiceWorkerCacheModel} */ (event.data.model); 741 var model = /** @type {!SDK.ServiceWorkerCacheModel} */ (event.data.model);
974 this._addCache(model, cache); 742 this._addCache(model, cache);
975 } 743 }
976 744
977 /** 745 /**
978 * @param {!SDK.ServiceWorkerCacheModel} model 746 * @param {!SDK.ServiceWorkerCacheModel} model
979 * @param {!SDK.ServiceWorkerCacheModel.Cache} cache 747 * @param {!SDK.ServiceWorkerCacheModel.Cache} cache
980 */ 748 */
981 _addCache(model, cache) { 749 _addCache(model, cache) {
982 var swCacheTreeElement = new Resources.SWCacheTreeElement(this._storagePanel , model, cache); 750 var swCacheTreeElement = new Resources.SWCacheTreeElement(this.appPanel, mod el, cache);
983 this._swCacheTreeElements.push(swCacheTreeElement); 751 this._swCacheTreeElements.push(swCacheTreeElement);
984 this.appendChild(swCacheTreeElement); 752 this.appendChild(swCacheTreeElement);
985 } 753 }
986 754
987 /** 755 /**
988 * @param {!Common.Event} event 756 * @param {!Common.Event} event
989 */ 757 */
990 _cacheRemoved(event) { 758 _cacheRemoved(event) {
991 var cache = /** @type {!SDK.ServiceWorkerCacheModel.Cache} */ (event.data.ca che); 759 var cache = /** @type {!SDK.ServiceWorkerCacheModel.Cache} */ (event.data.ca che);
992 var model = /** @type {!SDK.ServiceWorkerCacheModel} */ (event.data.model); 760 var model = /** @type {!SDK.ServiceWorkerCacheModel} */ (event.data.model);
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
1173 return 'clear-storage://'; 941 return 'clear-storage://';
1174 } 942 }
1175 943
1176 /** 944 /**
1177 * @override 945 * @override
1178 * @return {boolean} 946 * @return {boolean}
1179 */ 947 */
1180 onselect(selectedByUser) { 948 onselect(selectedByUser) {
1181 super.onselect(selectedByUser); 949 super.onselect(selectedByUser);
1182 if (!this._view) 950 if (!this._view)
1183 this._view = new Resources.ClearStorageView(this._storagePanel); 951 this._view = new Resources.ClearStorageView();
1184 this.showView(this._view); 952 this.showView(this._view);
1185 return false; 953 return false;
1186 } 954 }
1187 }; 955 };
1188 956
1189 /** 957 /**
1190 * @unrestricted 958 * @unrestricted
1191 */ 959 */
1192 Resources.IndexedDBTreeElement = class extends Resources.StorageCategoryTreeElem ent { 960 Resources.IndexedDBTreeElement = class extends Resources.StorageCategoryTreeElem ent {
1193 /** 961 /**
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1245 var databaseId = /** @type {!Resources.IndexedDBModel.DatabaseId} */ (event. data.databaseId); 1013 var databaseId = /** @type {!Resources.IndexedDBModel.DatabaseId} */ (event. data.databaseId);
1246 var model = /** @type {!Resources.IndexedDBModel} */ (event.data.model); 1014 var model = /** @type {!Resources.IndexedDBModel} */ (event.data.model);
1247 this._addIndexedDB(model, databaseId); 1015 this._addIndexedDB(model, databaseId);
1248 } 1016 }
1249 1017
1250 /** 1018 /**
1251 * @param {!Resources.IndexedDBModel} model 1019 * @param {!Resources.IndexedDBModel} model
1252 * @param {!Resources.IndexedDBModel.DatabaseId} databaseId 1020 * @param {!Resources.IndexedDBModel.DatabaseId} databaseId
1253 */ 1021 */
1254 _addIndexedDB(model, databaseId) { 1022 _addIndexedDB(model, databaseId) {
1255 var idbDatabaseTreeElement = new Resources.IDBDatabaseTreeElement(this._stor agePanel, model, databaseId); 1023 var idbDatabaseTreeElement = new Resources.IDBDatabaseTreeElement(this.appPa nel, model, databaseId);
1256 this._idbDatabaseTreeElements.push(idbDatabaseTreeElement); 1024 this._idbDatabaseTreeElements.push(idbDatabaseTreeElement);
1257 this.appendChild(idbDatabaseTreeElement); 1025 this.appendChild(idbDatabaseTreeElement);
1258 model.refreshDatabase(databaseId); 1026 model.refreshDatabase(databaseId);
1259 } 1027 }
1260 1028
1261 /** 1029 /**
1262 * @param {!Common.Event} event 1030 * @param {!Common.Event} event
1263 */ 1031 */
1264 _indexedDBRemoved(event) { 1032 _indexedDBRemoved(event) {
1265 var databaseId = /** @type {!Resources.IndexedDBModel.DatabaseId} */ (event. data.databaseId); 1033 var databaseId = /** @type {!Resources.IndexedDBModel.DatabaseId} */ (event. data.databaseId);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1352 * @param {!Resources.IndexedDBModel.Database} database 1120 * @param {!Resources.IndexedDBModel.Database} database
1353 */ 1121 */
1354 update(database) { 1122 update(database) {
1355 this._database = database; 1123 this._database = database;
1356 var objectStoreNames = {}; 1124 var objectStoreNames = {};
1357 for (var objectStoreName in this._database.objectStores) { 1125 for (var objectStoreName in this._database.objectStores) {
1358 var objectStore = this._database.objectStores[objectStoreName]; 1126 var objectStore = this._database.objectStores[objectStoreName];
1359 objectStoreNames[objectStore.name] = true; 1127 objectStoreNames[objectStore.name] = true;
1360 if (!this._idbObjectStoreTreeElements[objectStore.name]) { 1128 if (!this._idbObjectStoreTreeElements[objectStore.name]) {
1361 var idbObjectStoreTreeElement = 1129 var idbObjectStoreTreeElement =
1362 new Resources.IDBObjectStoreTreeElement(this._storagePanel, this._mo del, this._databaseId, objectStore); 1130 new Resources.IDBObjectStoreTreeElement(this.appPanel, this._model, this._databaseId, objectStore);
1363 this._idbObjectStoreTreeElements[objectStore.name] = idbObjectStoreTreeE lement; 1131 this._idbObjectStoreTreeElements[objectStore.name] = idbObjectStoreTreeE lement;
1364 this.appendChild(idbObjectStoreTreeElement); 1132 this.appendChild(idbObjectStoreTreeElement);
1365 } 1133 }
1366 this._idbObjectStoreTreeElements[objectStore.name].update(objectStore); 1134 this._idbObjectStoreTreeElements[objectStore.name].update(objectStore);
1367 } 1135 }
1368 for (var objectStoreName in this._idbObjectStoreTreeElements) { 1136 for (var objectStoreName in this._idbObjectStoreTreeElements) {
1369 if (!objectStoreNames[objectStoreName]) 1137 if (!objectStoreNames[objectStoreName])
1370 this._objectStoreRemoved(objectStoreName); 1138 this._objectStoreRemoved(objectStoreName);
1371 } 1139 }
1372 1140
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
1461 * @param {!Resources.IndexedDBModel.ObjectStore} objectStore 1229 * @param {!Resources.IndexedDBModel.ObjectStore} objectStore
1462 */ 1230 */
1463 update(objectStore) { 1231 update(objectStore) {
1464 this._objectStore = objectStore; 1232 this._objectStore = objectStore;
1465 1233
1466 var indexNames = {}; 1234 var indexNames = {};
1467 for (var indexName in this._objectStore.indexes) { 1235 for (var indexName in this._objectStore.indexes) {
1468 var index = this._objectStore.indexes[indexName]; 1236 var index = this._objectStore.indexes[indexName];
1469 indexNames[index.name] = true; 1237 indexNames[index.name] = true;
1470 if (!this._idbIndexTreeElements[index.name]) { 1238 if (!this._idbIndexTreeElements[index.name]) {
1471 var idbIndexTreeElement = new Resources.IDBIndexTreeElement( 1239 var idbIndexTreeElement =
1472 this._storagePanel, this._model, this._databaseId, this._objectStore , index); 1240 new Resources.IDBIndexTreeElement(this.appPanel, this._model, this._ databaseId, this._objectStore, index);
1473 this._idbIndexTreeElements[index.name] = idbIndexTreeElement; 1241 this._idbIndexTreeElements[index.name] = idbIndexTreeElement;
1474 this.appendChild(idbIndexTreeElement); 1242 this.appendChild(idbIndexTreeElement);
1475 } 1243 }
1476 this._idbIndexTreeElements[index.name].update(index); 1244 this._idbIndexTreeElements[index.name].update(index);
1477 } 1245 }
1478 for (var indexName in this._idbIndexTreeElements) { 1246 for (var indexName in this._idbIndexTreeElements) {
1479 if (!indexNames[indexName]) 1247 if (!indexNames[indexName])
1480 this._indexRemoved(indexName); 1248 this._indexRemoved(indexName);
1481 } 1249 }
1482 for (var indexName in this._idbIndexTreeElements) { 1250 for (var indexName in this._idbIndexTreeElements) {
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
1597 clear() { 1365 clear() {
1598 if (this._view) 1366 if (this._view)
1599 this._view.clear(); 1367 this._view.clear();
1600 } 1368 }
1601 }; 1369 };
1602 1370
1603 /** 1371 /**
1604 * @unrestricted 1372 * @unrestricted
1605 */ 1373 */
1606 Resources.DOMStorageTreeElement = class extends Resources.BaseStorageTreeElement { 1374 Resources.DOMStorageTreeElement = class extends Resources.BaseStorageTreeElement {
1375 /**
1376 * @param {!Resources.ResourcesPanel} storagePanel
1377 * @param {!Resources.DOMStorage} domStorage
1378 */
1607 constructor(storagePanel, domStorage) { 1379 constructor(storagePanel, domStorage) {
1608 super(storagePanel, domStorage.securityOrigin ? domStorage.securityOrigin : Common.UIString('Local Files'), false); 1380 super(storagePanel, domStorage.securityOrigin ? domStorage.securityOrigin : Common.UIString('Local Files'), false);
1609 this._domStorage = domStorage; 1381 this._domStorage = domStorage;
1610 var icon = UI.Icon.create('mediumicon-table', 'resource-tree-item'); 1382 var icon = UI.Icon.create('mediumicon-table', 'resource-tree-item');
1611 this.setLeadingIcons([icon]); 1383 this.setLeadingIcons([icon]);
1612 } 1384 }
1613 1385
1614 get itemURL() { 1386 get itemURL() {
1615 return 'storage://' + this._domStorage.securityOrigin + '/' + 1387 return 'storage://' + this._domStorage.securityOrigin + '/' +
1616 (this._domStorage.isLocalStorage ? 'local' : 'session'); 1388 (this._domStorage.isLocalStorage ? 'local' : 'session');
1617 } 1389 }
1618 1390
1619 /** 1391 /**
1620 * @override 1392 * @override
1621 * @return {boolean} 1393 * @return {boolean}
1622 */ 1394 */
1623 onselect(selectedByUser) { 1395 onselect(selectedByUser) {
1624 super.onselect(selectedByUser); 1396 super.onselect(selectedByUser);
1625 this._storagePanel._showDOMStorage(this._domStorage); 1397 this.appPanel.showDOMStorage(this._domStorage);
1626 return false; 1398 return false;
1627 } 1399 }
1628 1400
1629 /** 1401 /**
1630 * @override 1402 * @override
1631 */ 1403 */
1632 onattach() { 1404 onattach() {
1633 super.onattach(); 1405 super.onattach();
1634 this.listItemElement.addEventListener('contextmenu', this._handleContextMenu Event.bind(this), true); 1406 this.listItemElement.addEventListener('contextmenu', this._handleContextMenu Event.bind(this), true);
1635 } 1407 }
(...skipping 30 matching lines...) Expand all
1666 super.onattach(); 1438 super.onattach();
1667 this.listItemElement.addEventListener('contextmenu', this._handleContextMenu Event.bind(this), true); 1439 this.listItemElement.addEventListener('contextmenu', this._handleContextMenu Event.bind(this), true);
1668 } 1440 }
1669 1441
1670 /** 1442 /**
1671 * @param {!Event} event 1443 * @param {!Event} event
1672 */ 1444 */
1673 _handleContextMenuEvent(event) { 1445 _handleContextMenuEvent(event) {
1674 var contextMenu = new UI.ContextMenu(event); 1446 var contextMenu = new UI.ContextMenu(event);
1675 contextMenu.appendItem( 1447 contextMenu.appendItem(
1676 Common.UIString('Clear'), () => this._storagePanel._clearCookies(this._t arget, this._cookieDomain)); 1448 Common.UIString('Clear'), () => this.appPanel.clearCookies(this._target, this._cookieDomain));
1677 contextMenu.show(); 1449 contextMenu.show();
1678 } 1450 }
1679 1451
1680 /** 1452 /**
1681 * @override 1453 * @override
1682 * @return {boolean} 1454 * @return {boolean}
1683 */ 1455 */
1684 onselect(selectedByUser) { 1456 onselect(selectedByUser) {
1685 super.onselect(selectedByUser); 1457 super.onselect(selectedByUser);
1686 this._storagePanel.showCookies(this, this._cookieDomain, this._target); 1458 this.appPanel.showCookies(this._target, this._cookieDomain);
1687 return false; 1459 return false;
1688 } 1460 }
1689 }; 1461 };
1690 1462
1691 /** 1463 /**
1692 * @unrestricted 1464 * @unrestricted
1693 */ 1465 */
1694 Resources.ApplicationCacheManifestTreeElement = class extends Resources.BaseStor ageTreeElement { 1466 Resources.ApplicationCacheManifestTreeElement = class extends Resources.BaseStor ageTreeElement {
1695 constructor(storagePanel, manifestURL) { 1467 constructor(storagePanel, manifestURL) {
1696 var title = new Common.ParsedURL(manifestURL).displayName; 1468 var title = new Common.ParsedURL(manifestURL).displayName;
1697 super(storagePanel, title, false); 1469 super(storagePanel, title, false);
1698 this.tooltip = manifestURL; 1470 this.tooltip = manifestURL;
1699 this._manifestURL = manifestURL; 1471 this._manifestURL = manifestURL;
1700 } 1472 }
1701 1473
1702 get itemURL() { 1474 get itemURL() {
1703 return 'appcache://' + this._manifestURL; 1475 return 'appcache://' + this._manifestURL;
1704 } 1476 }
1705 1477
1706 get manifestURL() { 1478 get manifestURL() {
1707 return this._manifestURL; 1479 return this._manifestURL;
1708 } 1480 }
1709 1481
1710 /** 1482 /**
1711 * @override 1483 * @override
1712 * @return {boolean} 1484 * @return {boolean}
1713 */ 1485 */
1714 onselect(selectedByUser) { 1486 onselect(selectedByUser) {
1715 super.onselect(selectedByUser); 1487 super.onselect(selectedByUser);
1716 this._storagePanel.showCategoryView(this._manifestURL); 1488 this.appPanel.showCategoryView(this._manifestURL);
1717 return false; 1489 return false;
1718 } 1490 }
1719 }; 1491 };
1720 1492
1721 /** 1493 /**
1722 * @unrestricted 1494 * @unrestricted
1723 */ 1495 */
1724 Resources.ApplicationCacheFrameTreeElement = class extends Resources.BaseStorage TreeElement { 1496 Resources.ApplicationCacheFrameTreeElement = class extends Resources.BaseStorage TreeElement {
1725 /** 1497 /**
1726 * @param {!Resources.ResourcesPanel} storagePanel 1498 * @param {!Resources.ApplicationPanelSidebar} storagePanel
1727 * @param {!Protocol.Page.FrameId} frameId 1499 * @param {!SDK.ResourceTreeFrame} frame
1728 * @param {string} manifestURL 1500 * @param {string} manifestURL
1729 */ 1501 */
1730 constructor(storagePanel, frameId, manifestURL) { 1502 constructor(storagePanel, frame, manifestURL) {
1731 super(storagePanel, '', false); 1503 super(storagePanel._panel, '', false);
1732 this._frameId = frameId; 1504 this._storagePanel = storagePanel;
1505 this._frameId = frame.id;
1733 this._manifestURL = manifestURL; 1506 this._manifestURL = manifestURL;
1734 this._refreshTitles(); 1507 this._refreshTitles(frame);
1735 1508
1736 var icon = UI.Icon.create('largeicon-navigator-folder', 'navigator-tree-item '); 1509 var icon = UI.Icon.create('largeicon-navigator-folder', 'navigator-tree-item ');
1737 icon.classList.add('navigator-folder-tree-item'); 1510 icon.classList.add('navigator-folder-tree-item');
1738 this.setLeadingIcons([icon]); 1511 this.setLeadingIcons([icon]);
1739 } 1512 }
1740 1513
1741 get itemURL() { 1514 get itemURL() {
1742 return 'appcache://' + this._manifestURL + '/' + encodeURI(this.titleAsText( )); 1515 return 'appcache://' + this._manifestURL + '/' + encodeURI(this.titleAsText( ));
1743 } 1516 }
1744 1517
1745 get frameId() { 1518 get frameId() {
1746 return this._frameId; 1519 return this._frameId;
1747 } 1520 }
1748 1521
1749 get manifestURL() { 1522 get manifestURL() {
1750 return this._manifestURL; 1523 return this._manifestURL;
1751 } 1524 }
1752 1525
1753 _refreshTitles() { 1526 /**
1754 var resourceTreeModel = SDK.ResourceTreeModel.fromTarget(this._storagePanel. _target); 1527 * @param {!SDK.ResourceTreeFrame} frame
1755 var frame = resourceTreeModel.frameForId(this._frameId); 1528 */
1529 _refreshTitles(frame) {
1756 this.title = frame.displayName(); 1530 this.title = frame.displayName();
1757 } 1531 }
1758 1532
1759 frameNavigated() { 1533 /**
1760 this._refreshTitles(); 1534 * @param {!SDK.ResourceTreeFrame} frame
1535 */
1536 frameNavigated(frame) {
1537 this._refreshTitles(frame);
1761 } 1538 }
1762 1539
1763 /** 1540 /**
1764 * @override 1541 * @override
1765 * @return {boolean} 1542 * @return {boolean}
1766 */ 1543 */
1767 onselect(selectedByUser) { 1544 onselect(selectedByUser) {
1768 super.onselect(selectedByUser); 1545 super.onselect(selectedByUser);
1769 this._storagePanel.showApplicationCache(this._frameId); 1546 this._storagePanel._showApplicationCache(this._frameId);
1770 return false; 1547 return false;
1771 } 1548 }
1772 }; 1549 };
1773 1550
1774 /** 1551 /**
1775 * @unrestricted 1552 * @unrestricted
1776 */ 1553 */
1777 Resources.StorageCategoryView = class extends UI.VBox { 1554 Resources.StorageCategoryView = class extends UI.VBox {
1778 constructor() { 1555 constructor() {
1779 super(); 1556 super();
1780 1557
1781 this.element.classList.add('storage-view'); 1558 this.element.classList.add('storage-view');
1782 this._emptyWidget = new UI.EmptyWidget(''); 1559 this._emptyWidget = new UI.EmptyWidget('');
1783 this._emptyWidget.show(this.element); 1560 this._emptyWidget.show(this.element);
1784 } 1561 }
1785 1562
1786 setText(text) { 1563 setText(text) {
1787 this._emptyWidget.text = text; 1564 this._emptyWidget.text = text;
1788 } 1565 }
1789 }; 1566 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698