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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 var itemURL = WebInspector.settings.resourcesLastSelectedItem.get(); | 191 var itemURL = WebInspector.settings.resourcesLastSelectedItem.get(); |
192 if (itemURL) { | 192 if (itemURL) { |
193 for (var treeElement = this.sidebarTree.children[0]; treeElement; tr
eeElement = treeElement.traverseNextTreeElement(false, this.sidebarTree, true))
{ | 193 for (var treeElement = this.sidebarTree.children[0]; treeElement; tr
eeElement = treeElement.traverseNextTreeElement(false, this.sidebarTree, true))
{ |
194 if (treeElement.itemURL === itemURL) { | 194 if (treeElement.itemURL === itemURL) { |
195 treeElement.revealAndSelect(true); | 195 treeElement.revealAndSelect(true); |
196 return; | 196 return; |
197 } | 197 } |
198 } | 198 } |
199 } | 199 } |
200 | 200 |
201 var mainResource = WebInspector.resourceTreeModel.inspectedPageURL() &&
this.resourcesListTreeElement && this.resourcesListTreeElement.expanded | 201 var mainResource = this._target.resourceTreeModel.inspectedPageURL() &&
this.resourcesListTreeElement && this.resourcesListTreeElement.expanded |
202 ? WebInspector.resourceTreeModel.resourceForURL(WebInspector.res
ourceTreeModel.inspectedPageURL()) | 202 ? this._target.resourceTreeModel.resourceForURL(this._target.res
ourceTreeModel.inspectedPageURL()) |
203 : null; | 203 : null; |
204 if (mainResource) | 204 if (mainResource) |
205 this.showResource(mainResource); | 205 this.showResource(mainResource); |
206 }, | 206 }, |
207 | 207 |
208 _resetWithFrames: function() | 208 _resetWithFrames: function() |
209 { | 209 { |
210 this.resourcesListTreeElement.removeChildren(); | 210 this.resourcesListTreeElement.removeChildren(); |
211 this._treeElementForFrameId = {}; | 211 this._treeElementForFrameId = {}; |
212 this._reset(); | 212 this._reset(); |
(...skipping 24 matching lines...) Expand all Loading... |
237 | 237 |
238 this._storageViewStatusBar.removeStatusBarItems(); | 238 this._storageViewStatusBar.removeStatusBarItems(); |
239 | 239 |
240 if (this.sidebarTree.selectedTreeElement) | 240 if (this.sidebarTree.selectedTreeElement) |
241 this.sidebarTree.selectedTreeElement.deselect(); | 241 this.sidebarTree.selectedTreeElement.deselect(); |
242 }, | 242 }, |
243 | 243 |
244 _populateResourceTree: function() | 244 _populateResourceTree: function() |
245 { | 245 { |
246 this._treeElementForFrameId = {}; | 246 this._treeElementForFrameId = {}; |
247 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTre
eModel.EventTypes.FrameAdded, this._frameAdded, this); | 247 this._target.resourceTreeModel.addEventListener(WebInspector.ResourceTre
eModel.EventTypes.FrameAdded, this._frameAdded, this); |
248 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTre
eModel.EventTypes.FrameNavigated, this._frameNavigated, this); | 248 this._target.resourceTreeModel.addEventListener(WebInspector.ResourceTre
eModel.EventTypes.FrameNavigated, this._frameNavigated, this); |
249 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTre
eModel.EventTypes.FrameDetached, this._frameDetached, this); | 249 this._target.resourceTreeModel.addEventListener(WebInspector.ResourceTre
eModel.EventTypes.FrameDetached, this._frameDetached, this); |
250 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTre
eModel.EventTypes.ResourceAdded, this._resourceAdded, this); | 250 this._target.resourceTreeModel.addEventListener(WebInspector.ResourceTre
eModel.EventTypes.ResourceAdded, this._resourceAdded, this); |
251 | 251 |
252 /** | 252 /** |
253 * @param {!WebInspector.ResourceTreeFrame} frame | 253 * @param {!WebInspector.ResourceTreeFrame} frame |
254 * @this {WebInspector.ResourcesPanel} | 254 * @this {WebInspector.ResourcesPanel} |
255 */ | 255 */ |
256 function populateFrame(frame) | 256 function populateFrame(frame) |
257 { | 257 { |
258 this._frameAdded({data:frame}); | 258 this._frameAdded({data:frame}); |
259 for (var i = 0; i < frame.childFrames.length; ++i) | 259 for (var i = 0; i < frame.childFrames.length; ++i) |
260 populateFrame.call(this, frame.childFrames[i]); | 260 populateFrame.call(this, frame.childFrames[i]); |
261 | 261 |
262 var resources = frame.resources(); | 262 var resources = frame.resources(); |
263 for (var i = 0; i < resources.length; ++i) | 263 for (var i = 0; i < resources.length; ++i) |
264 this._resourceAdded({data:resources[i]}); | 264 this._resourceAdded({data:resources[i]}); |
265 } | 265 } |
266 populateFrame.call(this, WebInspector.resourceTreeModel.mainFrame); | 266 populateFrame.call(this, this._target.resourceTreeModel.mainFrame); |
267 }, | 267 }, |
268 | 268 |
269 _frameAdded: function(event) | 269 _frameAdded: function(event) |
270 { | 270 { |
271 var frame = event.data; | 271 var frame = event.data; |
272 var parentFrame = frame.parentFrame; | 272 var parentFrame = frame.parentFrame; |
273 | 273 |
274 var parentTreeElement = parentFrame ? this._treeElementForFrameId[parent
Frame.id] : this.resourcesListTreeElement; | 274 var parentTreeElement = parentFrame ? this._treeElementForFrameId[parent
Frame.id] : this.resourcesListTreeElement; |
275 if (!parentTreeElement) { | 275 if (!parentTreeElement) { |
276 console.warn("No frame to route " + frame.url + " to."); | 276 console.warn("No frame to route " + frame.url + " to."); |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 self.closeVisibleView(); | 670 self.closeVisibleView(); |
671 delete tableViews[tableName]; | 671 delete tableViews[tableName]; |
672 } | 672 } |
673 } | 673 } |
674 } | 674 } |
675 database.getTableNames(tableNamesCallback); | 675 database.getTableNames(tableNamesCallback); |
676 }, | 676 }, |
677 | 677 |
678 _populateDOMStorageTree: function() | 678 _populateDOMStorageTree: function() |
679 { | 679 { |
680 WebInspector.domStorageModel.storages().forEach(this._addDOMStorage.bind
(this)); | 680 this._target.domStorageModel.storages().forEach(this._addDOMStorage.bind
(this)); |
681 WebInspector.domStorageModel.addEventListener(WebInspector.DOMStorageMod
el.Events.DOMStorageAdded, this._domStorageAdded, this); | 681 this._target.domStorageModel.addEventListener(WebInspector.DOMStorageMod
el.Events.DOMStorageAdded, this._domStorageAdded, this); |
682 WebInspector.domStorageModel.addEventListener(WebInspector.DOMStorageMod
el.Events.DOMStorageRemoved, this._domStorageRemoved, this); | 682 this._target.domStorageModel.addEventListener(WebInspector.DOMStorageMod
el.Events.DOMStorageRemoved, this._domStorageRemoved, this); |
683 }, | 683 }, |
684 | 684 |
685 _populateApplicationCacheTree: function() | 685 _populateApplicationCacheTree: function() |
686 { | 686 { |
687 this._applicationCacheModel = new WebInspector.ApplicationCacheModel(thi
s._target); | 687 this._applicationCacheModel = new WebInspector.ApplicationCacheModel(thi
s._target); |
688 | 688 |
689 this._applicationCacheViews = {}; | 689 this._applicationCacheViews = {}; |
690 this._applicationCacheFrameElements = {}; | 690 this._applicationCacheFrameElements = {}; |
691 this._applicationCacheManifestElements = {}; | 691 this._applicationCacheManifestElements = {}; |
692 | 692 |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
959 * @param {string} settingsKey | 959 * @param {string} settingsKey |
960 * @param {?Array.<string>=} iconClasses | 960 * @param {?Array.<string>=} iconClasses |
961 * @param {boolean=} noIcon | 961 * @param {boolean=} noIcon |
962 */ | 962 */ |
963 WebInspector.StorageCategoryTreeElement = function(storagePanel, categoryName, s
ettingsKey, iconClasses, noIcon) | 963 WebInspector.StorageCategoryTreeElement = function(storagePanel, categoryName, s
ettingsKey, iconClasses, noIcon) |
964 { | 964 { |
965 WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, categoryN
ame, iconClasses, false, noIcon); | 965 WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, categoryN
ame, iconClasses, false, noIcon); |
966 this._expandedSettingKey = "resources" + settingsKey + "Expanded"; | 966 this._expandedSettingKey = "resources" + settingsKey + "Expanded"; |
967 WebInspector.settings[this._expandedSettingKey] = WebInspector.settings.crea
teSetting(this._expandedSettingKey, settingsKey === "Frames"); | 967 WebInspector.settings[this._expandedSettingKey] = WebInspector.settings.crea
teSetting(this._expandedSettingKey, settingsKey === "Frames"); |
968 this._categoryName = categoryName; | 968 this._categoryName = categoryName; |
969 this._target = /** @type {!WebInspector.Target} */ (WebInspector.targetManag
er.mainTarget()); | |
970 } | 969 } |
971 | 970 |
972 WebInspector.StorageCategoryTreeElement.prototype = { | 971 WebInspector.StorageCategoryTreeElement.prototype = { |
973 /** | 972 /** |
974 * @return {!WebInspector.Target} | 973 * @return {!WebInspector.Target} |
975 */ | 974 */ |
976 target: function() | 975 target: function() |
977 { | 976 { |
978 return this._target; | 977 return this._storagePanel._target; |
979 }, | 978 }, |
980 | 979 |
981 get itemURL() | 980 get itemURL() |
982 { | 981 { |
983 return "category://" + this._categoryName; | 982 return "category://" + this._categoryName; |
984 }, | 983 }, |
985 | 984 |
986 /** | 985 /** |
987 * @override | 986 * @override |
988 * @return {boolean} | 987 * @return {boolean} |
(...skipping 1242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2231 this._storagePanel.showCategoryView(this._manifestURL); | 2230 this._storagePanel.showCategoryView(this._manifestURL); |
2232 return false; | 2231 return false; |
2233 }, | 2232 }, |
2234 | 2233 |
2235 __proto__: WebInspector.BaseStorageTreeElement.prototype | 2234 __proto__: WebInspector.BaseStorageTreeElement.prototype |
2236 } | 2235 } |
2237 | 2236 |
2238 /** | 2237 /** |
2239 * @constructor | 2238 * @constructor |
2240 * @extends {WebInspector.BaseStorageTreeElement} | 2239 * @extends {WebInspector.BaseStorageTreeElement} |
| 2240 * @param {!WebInspector.ResourcesPanel} storagePanel |
| 2241 * @param {!PageAgent.FrameId} frameId |
| 2242 * @param {string} manifestURL |
2241 */ | 2243 */ |
2242 WebInspector.ApplicationCacheFrameTreeElement = function(storagePanel, frameId,
manifestURL) | 2244 WebInspector.ApplicationCacheFrameTreeElement = function(storagePanel, frameId,
manifestURL) |
2243 { | 2245 { |
2244 WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, "", ["fra
me-storage-tree-item"]); | 2246 WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, "", ["fra
me-storage-tree-item"]); |
2245 this._frameId = frameId; | 2247 this._frameId = frameId; |
2246 this._manifestURL = manifestURL; | 2248 this._manifestURL = manifestURL; |
2247 this._refreshTitles(); | 2249 this._refreshTitles(); |
2248 } | 2250 } |
2249 | 2251 |
2250 WebInspector.ApplicationCacheFrameTreeElement.prototype = { | 2252 WebInspector.ApplicationCacheFrameTreeElement.prototype = { |
2251 get itemURL() | 2253 get itemURL() |
2252 { | 2254 { |
2253 return "appcache://" + this._manifestURL + "/" + encodeURI(this.displayN
ame); | 2255 return "appcache://" + this._manifestURL + "/" + encodeURI(this.displayN
ame); |
2254 }, | 2256 }, |
2255 | 2257 |
2256 get frameId() | 2258 get frameId() |
2257 { | 2259 { |
2258 return this._frameId; | 2260 return this._frameId; |
2259 }, | 2261 }, |
2260 | 2262 |
2261 get manifestURL() | 2263 get manifestURL() |
2262 { | 2264 { |
2263 return this._manifestURL; | 2265 return this._manifestURL; |
2264 }, | 2266 }, |
2265 | 2267 |
2266 _refreshTitles: function() | 2268 _refreshTitles: function() |
2267 { | 2269 { |
2268 var frame = WebInspector.resourceTreeModel.frameForId(this._frameId); | 2270 var frame = this._storagePanel._target.resourceTreeModel.frameForId(this
._frameId); |
2269 if (!frame) { | 2271 if (!frame) { |
2270 this.subtitleText = WebInspector.UIString("new frame"); | 2272 this.subtitleText = WebInspector.UIString("new frame"); |
2271 return; | 2273 return; |
2272 } | 2274 } |
2273 this.titleText = frame.name; | 2275 this.titleText = frame.name; |
2274 this.subtitleText = new WebInspector.ParsedURL(frame.url).displayName; | 2276 this.subtitleText = new WebInspector.ParsedURL(frame.url).displayName; |
2275 }, | 2277 }, |
2276 | 2278 |
2277 frameNavigated: function() | 2279 frameNavigated: function() |
2278 { | 2280 { |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2394 WebInspector.ResourcesPanelFactory.prototype = { | 2396 WebInspector.ResourcesPanelFactory.prototype = { |
2395 /** | 2397 /** |
2396 * @override | 2398 * @override |
2397 * @return {!WebInspector.Panel} | 2399 * @return {!WebInspector.Panel} |
2398 */ | 2400 */ |
2399 createPanel: function() | 2401 createPanel: function() |
2400 { | 2402 { |
2401 return WebInspector.ResourcesPanel._instance(); | 2403 return WebInspector.ResourcesPanel._instance(); |
2402 } | 2404 } |
2403 } | 2405 } |
OLD | NEW |