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

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

Issue 2168323002: [DevTools] Explicitly require ResourceTreeModel (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: [DevTools] Explicitly require ResourceTreeModel Created 4 years, 4 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 { 166 {
167 this._databaseModel.enable(); 167 this._databaseModel.enable();
168 168
169 var indexedDBModel = WebInspector.IndexedDBModel.fromTarget(this._target ); 169 var indexedDBModel = WebInspector.IndexedDBModel.fromTarget(this._target );
170 if (indexedDBModel) 170 if (indexedDBModel)
171 indexedDBModel.enable(); 171 indexedDBModel.enable();
172 172
173 var cacheStorageModel = WebInspector.ServiceWorkerCacheModel.fromTarget( this._target); 173 var cacheStorageModel = WebInspector.ServiceWorkerCacheModel.fromTarget( this._target);
174 if (cacheStorageModel) 174 if (cacheStorageModel)
175 cacheStorageModel.enable(); 175 cacheStorageModel.enable();
176 176 var resourceTreeModel = WebInspector.ResourceTreeModel.fromTarget(this._ target);
177 if (this._target.hasBrowserCapability()) 177 if (resourceTreeModel) {
178 this._populateResourceTree(); 178 this._populateResourceTree(resourceTreeModel);
179 179 this._populateApplicationCacheTree(resourceTreeModel);
180 }
180 var domStorageModel = WebInspector.DOMStorageModel.fromTarget(this._targ et); 181 var domStorageModel = WebInspector.DOMStorageModel.fromTarget(this._targ et);
181 if (domStorageModel) 182 if (domStorageModel)
182 this._populateDOMStorageTree(domStorageModel); 183 this._populateDOMStorageTree(domStorageModel);
183 this._populateApplicationCacheTree();
184 this.indexedDBListTreeElement._initialize(); 184 this.indexedDBListTreeElement._initialize();
185 this.cacheStorageListTreeElement._initialize(); 185 this.cacheStorageListTreeElement._initialize();
186 this._initDefaultSelection(); 186 this._initDefaultSelection();
187 }, 187 },
188 188
189 _initDefaultSelection: function() 189 _initDefaultSelection: function()
190 { 190 {
191 var itemURL = this._resourcesLastSelectedItemSetting.get(); 191 var itemURL = this._resourcesLastSelectedItemSetting.get();
192 if (itemURL) { 192 if (itemURL) {
193 var rootElement = this._sidebarTree.rootElement(); 193 var rootElement = this._sidebarTree.rootElement();
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 this.visibleView.detach(); 280 this.visibleView.detach();
281 delete this.visibleView; 281 delete this.visibleView;
282 } 282 }
283 283
284 this._storageViewToolbar.removeToolbarItems(); 284 this._storageViewToolbar.removeToolbarItems();
285 285
286 if (this._sidebarTree.selectedTreeElement) 286 if (this._sidebarTree.selectedTreeElement)
287 this._sidebarTree.selectedTreeElement.deselect(); 287 this._sidebarTree.selectedTreeElement.deselect();
288 }, 288 },
289 289
290 _populateResourceTree: function() 290 /**
291 * @param {!WebInspector.ResourceTreeModel} resourceTreeModel
292 */
293 _populateResourceTree: function(resourceTreeModel)
291 { 294 {
292 this._treeElementForFrameId = {}; 295 this._treeElementForFrameId = {};
293
294 var resourceTreeModel = WebInspector.ResourceTreeModel.fromTarget(this._ target);
295
296 if (!resourceTreeModel)
297 return;
298
299 resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventT ypes.FrameAdded, this._frameAdded, this); 296 resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventT ypes.FrameAdded, this._frameAdded, this);
300 resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventT ypes.FrameNavigated, this._frameNavigated, this); 297 resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventT ypes.FrameNavigated, this._frameNavigated, this);
301 resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventT ypes.FrameDetached, this._frameDetached, this); 298 resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventT ypes.FrameDetached, this._frameDetached, this);
302 resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventT ypes.ResourceAdded, this._resourceAdded, this); 299 resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventT ypes.ResourceAdded, this._resourceAdded, this);
303 300
304 /** 301 /**
305 * @param {!WebInspector.ResourceTreeFrame} frame 302 * @param {!WebInspector.ResourceTreeFrame} frame
306 * @this {WebInspector.ResourcesPanel} 303 * @this {WebInspector.ResourcesPanel}
307 */ 304 */
308 function populateFrame(frame) 305 function populateFrame(frame)
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 * @param {!WebInspector.DOMStorageModel} domStorageModel 712 * @param {!WebInspector.DOMStorageModel} domStorageModel
716 */ 713 */
717 _populateDOMStorageTree: function(domStorageModel) 714 _populateDOMStorageTree: function(domStorageModel)
718 { 715 {
719 domStorageModel.enable(); 716 domStorageModel.enable();
720 domStorageModel.storages().forEach(this._addDOMStorage.bind(this)); 717 domStorageModel.storages().forEach(this._addDOMStorage.bind(this));
721 domStorageModel.addEventListener(WebInspector.DOMStorageModel.Events.DOM StorageAdded, this._domStorageAdded, this); 718 domStorageModel.addEventListener(WebInspector.DOMStorageModel.Events.DOM StorageAdded, this._domStorageAdded, this);
722 domStorageModel.addEventListener(WebInspector.DOMStorageModel.Events.DOM StorageRemoved, this._domStorageRemoved, this); 719 domStorageModel.addEventListener(WebInspector.DOMStorageModel.Events.DOM StorageRemoved, this._domStorageRemoved, this);
723 }, 720 },
724 721
725 _populateApplicationCacheTree: function() 722 /**
723 * @param {!WebInspector.ResourceTreeModel} resourceTreeModel
724 */
725 _populateApplicationCacheTree: function(resourceTreeModel)
726 { 726 {
727 this._applicationCacheModel = new WebInspector.ApplicationCacheModel(thi s._target); 727 this._applicationCacheModel = new WebInspector.ApplicationCacheModel(thi s._target, resourceTreeModel);
728 728
729 this._applicationCacheViews = {}; 729 this._applicationCacheViews = {};
730 this._applicationCacheFrameElements = {}; 730 this._applicationCacheFrameElements = {};
731 this._applicationCacheManifestElements = {}; 731 this._applicationCacheManifestElements = {};
732 732
733 this._applicationCacheModel.addEventListener(WebInspector.ApplicationCac heModel.EventTypes.FrameManifestAdded, this._applicationCacheFrameManifestAdded, this); 733 this._applicationCacheModel.addEventListener(WebInspector.ApplicationCac heModel.EventTypes.FrameManifestAdded, this._applicationCacheFrameManifestAdded, this);
734 this._applicationCacheModel.addEventListener(WebInspector.ApplicationCac heModel.EventTypes.FrameManifestRemoved, this._applicationCacheFrameManifestRemo ved, this); 734 this._applicationCacheModel.addEventListener(WebInspector.ApplicationCac heModel.EventTypes.FrameManifestRemoved, this._applicationCacheFrameManifestRemo ved, this);
735 this._applicationCacheModel.addEventListener(WebInspector.ApplicationCac heModel.EventTypes.FrameManifestsReset, this._resetAppCache, this); 735 this._applicationCacheModel.addEventListener(WebInspector.ApplicationCac heModel.EventTypes.FrameManifestsReset, this._resetAppCache, this);
736 736
737 this._applicationCacheModel.addEventListener(WebInspector.ApplicationCac heModel.EventTypes.FrameManifestStatusUpdated, this._applicationCacheFrameManife stStatusChanged, this); 737 this._applicationCacheModel.addEventListener(WebInspector.ApplicationCac heModel.EventTypes.FrameManifestStatusUpdated, this._applicationCacheFrameManife stStatusChanged, this);
(...skipping 1469 matching lines...) Expand 10 before | Expand all | Expand 10 after
2207 WebInspector.inspectorView.setCurrentPanel(WebInspector.ResourcesPanel._inst ance()); 2207 WebInspector.inspectorView.setCurrentPanel(WebInspector.ResourcesPanel._inst ance());
2208 } 2208 }
2209 2209
2210 /** 2210 /**
2211 * @return {!WebInspector.ResourcesPanel} 2211 * @return {!WebInspector.ResourcesPanel}
2212 */ 2212 */
2213 WebInspector.ResourcesPanel._instance = function() 2213 WebInspector.ResourcesPanel._instance = function()
2214 { 2214 {
2215 return /** @type {!WebInspector.ResourcesPanel} */ (self.runtime.sharedInsta nce(WebInspector.ResourcesPanel)); 2215 return /** @type {!WebInspector.ResourcesPanel} */ (self.runtime.sharedInsta nce(WebInspector.ResourcesPanel));
2216 } 2216 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698