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 18 matching lines...) Expand all Loading... |
29 */ | 29 */ |
30 | 30 |
31 importScript("ApplicationCacheItemsView.js"); | 31 importScript("ApplicationCacheItemsView.js"); |
32 importScript("DOMStorageItemsView.js"); | 32 importScript("DOMStorageItemsView.js"); |
33 importScript("DatabaseQueryView.js"); | 33 importScript("DatabaseQueryView.js"); |
34 importScript("DatabaseTableView.js"); | 34 importScript("DatabaseTableView.js"); |
35 importScript("DirectoryContentView.js"); | 35 importScript("DirectoryContentView.js"); |
36 importScript("IndexedDBViews.js"); | 36 importScript("IndexedDBViews.js"); |
37 importScript("FileContentView.js"); | 37 importScript("FileContentView.js"); |
38 importScript("FileSystemView.js"); | 38 importScript("FileSystemView.js"); |
| 39 importScript("QuotaView.js"); |
39 | 40 |
40 /** | 41 /** |
41 * @constructor | 42 * @constructor |
42 * @extends {WebInspector.Panel} | 43 * @extends {WebInspector.Panel} |
43 */ | 44 */ |
44 WebInspector.ResourcesPanel = function(database) | 45 WebInspector.ResourcesPanel = function(database) |
45 { | 46 { |
46 WebInspector.Panel.call(this, "resources"); | 47 WebInspector.Panel.call(this, "resources"); |
47 this.registerRequiredCSS("resourcesPanel.css"); | 48 this.registerRequiredCSS("resourcesPanel.css"); |
48 | 49 |
(...skipping 21 matching lines...) Expand all Loading... |
70 | 71 |
71 this.sessionStorageListTreeElement = new WebInspector.StorageCategoryTreeEle
ment(this, WebInspector.UIString("Session Storage"), "SessionStorage", ["domstor
age-storage-tree-item", "session-storage"]); | 72 this.sessionStorageListTreeElement = new WebInspector.StorageCategoryTreeEle
ment(this, WebInspector.UIString("Session Storage"), "SessionStorage", ["domstor
age-storage-tree-item", "session-storage"]); |
72 this.sidebarTree.appendChild(this.sessionStorageListTreeElement); | 73 this.sidebarTree.appendChild(this.sessionStorageListTreeElement); |
73 | 74 |
74 this.cookieListTreeElement = new WebInspector.StorageCategoryTreeElement(thi
s, WebInspector.UIString("Cookies"), "Cookies", ["cookie-storage-tree-item"]); | 75 this.cookieListTreeElement = new WebInspector.StorageCategoryTreeElement(thi
s, WebInspector.UIString("Cookies"), "Cookies", ["cookie-storage-tree-item"]); |
75 this.sidebarTree.appendChild(this.cookieListTreeElement); | 76 this.sidebarTree.appendChild(this.cookieListTreeElement); |
76 | 77 |
77 this.applicationCacheListTreeElement = new WebInspector.StorageCategoryTreeE
lement(this, WebInspector.UIString("Application Cache"), "ApplicationCache", ["a
pplication-cache-storage-tree-item"]); | 78 this.applicationCacheListTreeElement = new WebInspector.StorageCategoryTreeE
lement(this, WebInspector.UIString("Application Cache"), "ApplicationCache", ["a
pplication-cache-storage-tree-item"]); |
78 this.sidebarTree.appendChild(this.applicationCacheListTreeElement); | 79 this.sidebarTree.appendChild(this.applicationCacheListTreeElement); |
79 | 80 |
| 81 this.quotaListTreeElement = new WebInspector.QuotaHostListTreeElement(this); |
| 82 this.sidebarTree.appendChild(this.quotaListTreeElement); |
| 83 |
80 if (WebInspector.experimentsSettings.fileSystemInspection.isEnabled()) { | 84 if (WebInspector.experimentsSettings.fileSystemInspection.isEnabled()) { |
81 this.fileSystemListTreeElement = new WebInspector.FileSystemListTreeElem
ent(this); | 85 this.fileSystemListTreeElement = new WebInspector.FileSystemListTreeElem
ent(this); |
82 this.sidebarTree.appendChild(this.fileSystemListTreeElement); | 86 this.sidebarTree.appendChild(this.fileSystemListTreeElement); |
83 } | 87 } |
84 | 88 |
85 this.storageViews = this.splitView.mainElement; | 89 this.storageViews = this.splitView.mainElement; |
86 this.storageViews.addStyleClass("diff-container"); | 90 this.storageViews.addStyleClass("diff-container"); |
87 | 91 |
88 this.storageViewStatusBarItemsContainer = document.createElement("div"); | 92 this.storageViewStatusBarItemsContainer = document.createElement("div"); |
89 this.storageViewStatusBarItemsContainer.className = "status-bar-items"; | 93 this.storageViewStatusBarItemsContainer.className = "status-bar-items"; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 this._databaseQueryViews.clear(); | 195 this._databaseQueryViews.clear(); |
192 this._databaseTreeElements.clear(); | 196 this._databaseTreeElements.clear(); |
193 this._domStorageViews.clear(); | 197 this._domStorageViews.clear(); |
194 this._domStorageTreeElements.clear(); | 198 this._domStorageTreeElements.clear(); |
195 this._cookieViews = {}; | 199 this._cookieViews = {}; |
196 | 200 |
197 this.databasesListTreeElement.removeChildren(); | 201 this.databasesListTreeElement.removeChildren(); |
198 this.localStorageListTreeElement.removeChildren(); | 202 this.localStorageListTreeElement.removeChildren(); |
199 this.sessionStorageListTreeElement.removeChildren(); | 203 this.sessionStorageListTreeElement.removeChildren(); |
200 this.cookieListTreeElement.removeChildren(); | 204 this.cookieListTreeElement.removeChildren(); |
| 205 this.quotaListTreeElement.removeChildren(); |
201 | 206 |
202 if (this.visibleView && !(this.visibleView instanceof WebInspector.Stora
geCategoryView)) | 207 if (this.visibleView && !(this.visibleView instanceof WebInspector.Stora
geCategoryView)) |
203 this.visibleView.detach(); | 208 this.visibleView.detach(); |
204 | 209 |
205 this.storageViewStatusBarItemsContainer.removeChildren(); | 210 this.storageViewStatusBarItemsContainer.removeChildren(); |
206 | 211 |
207 if (this.sidebarTree.selectedTreeElement) | 212 if (this.sidebarTree.selectedTreeElement) |
208 this.sidebarTree.selectedTreeElement.deselect(); | 213 this.sidebarTree.selectedTreeElement.deselect(); |
209 }, | 214 }, |
210 | 215 |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 }, | 545 }, |
541 | 546 |
542 showApplicationCache: function(frameId) | 547 showApplicationCache: function(frameId) |
543 { | 548 { |
544 if (!this._applicationCacheViews[frameId]) | 549 if (!this._applicationCacheViews[frameId]) |
545 this._applicationCacheViews[frameId] = new WebInspector.ApplicationC
acheItemsView(this._applicationCacheModel, frameId); | 550 this._applicationCacheViews[frameId] = new WebInspector.ApplicationC
acheItemsView(this._applicationCacheModel, frameId); |
546 | 551 |
547 this._innerShowView(this._applicationCacheViews[frameId]); | 552 this._innerShowView(this._applicationCacheViews[frameId]); |
548 }, | 553 }, |
549 | 554 |
| 555 showQuota: function(securityOrigin) |
| 556 { |
| 557 this._innerShowView(new WebInspector.QuotaView(securityOrigin)); |
| 558 }, |
| 559 |
550 /** | 560 /** |
551 * @param {WebInspector.View} view | 561 * @param {WebInspector.View} view |
552 */ | 562 */ |
553 showFileSystem: function(view) | 563 showFileSystem: function(view) |
554 { | 564 { |
555 this._innerShowView(view); | 565 this._innerShowView(view); |
556 }, | 566 }, |
557 | 567 |
558 showCategoryView: function(categoryName) | 568 showCategoryView: function(categoryName) |
559 { | 569 { |
(...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1653 } | 1663 } |
1654 | 1664 |
1655 this._fileSystemModel.refreshFileSystemList(); | 1665 this._fileSystemModel.refreshFileSystemList(); |
1656 }, | 1666 }, |
1657 | 1667 |
1658 __proto__: WebInspector.StorageCategoryTreeElement.prototype | 1668 __proto__: WebInspector.StorageCategoryTreeElement.prototype |
1659 } | 1669 } |
1660 | 1670 |
1661 /** | 1671 /** |
1662 * @constructor | 1672 * @constructor |
| 1673 * @extends {WebInspector.StorageCategoryTreeElement} |
| 1674 * @param {WebInspector.ResourcesPanel} storagePanel |
| 1675 */ |
| 1676 WebInspector.QuotaHostListTreeElement = function(storagePanel) |
| 1677 { |
| 1678 WebInspector.StorageCategoryTreeElement.call(this, storagePanel, WebInspecto
r.UIString("Quota"), "Quota", ["quota-tree-item"]) |
| 1679 } |
| 1680 |
| 1681 WebInspector.QuotaHostListTreeElement.prototype = { |
| 1682 onattach: function() |
| 1683 { |
| 1684 WebInspector.StorageCategoryTreeElement.prototype.onattach.call(this); |
| 1685 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTre
eModel.EventTypes.SecurityOriginAdded, this._securityOriginAdded, this); |
| 1686 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTre
eModel.EventTypes.SecurityOriginRemoved, this._securityOriginRemoved, this); |
| 1687 |
| 1688 var securityOrigins = WebInspector.resourceTreeModel.securityOrigins(); |
| 1689 for (var i = 0; i < securityOrigins.length; ++i) |
| 1690 this._addOrigin(securityOrigins[i]); |
| 1691 }, |
| 1692 |
| 1693 ondetach: function() |
| 1694 { |
| 1695 WebInspector.StorageCategoryTreeElement.prototype.ondetach.call(this); |
| 1696 WebInspector.resourceTreeModel.removeEventListener(WebInspector.Resource
TreeModel.EventTypes.SecurityOriginAdded, this._securityOriginAdded, this); |
| 1697 WebInspector.resourceTreeModel.removeEventListener(WebInspector.Resource
TreeModel.EventTypes.SecurityOriginRemoved, this._securityOriginRemoved, this); |
| 1698 this.removeChildren(); |
| 1699 }, |
| 1700 |
| 1701 /** |
| 1702 * @param {string} securityOrigin |
| 1703 */ |
| 1704 _addOrigin: function(securityOrigin) |
| 1705 { |
| 1706 var quotaTreeElement = new WebInspector.QuotaTreeElement(this._storagePa
nel, securityOrigin); |
| 1707 this.appendChild(quotaTreeElement); |
| 1708 }, |
| 1709 |
| 1710 /** |
| 1711 * @param {WebInspector.Event} event |
| 1712 */ |
| 1713 _securityOriginAdded: function(event) |
| 1714 { |
| 1715 var securityOrigin = /** @type {string} */ (event.data); |
| 1716 this._addOrigin(securityOrigin); |
| 1717 }, |
| 1718 |
| 1719 /** |
| 1720 * @param {WebInspector.Event} event |
| 1721 */ |
| 1722 _securityOriginRemoved: function(event) |
| 1723 { |
| 1724 var securityOrigin = /** @type {string} */ (event.data); |
| 1725 var quotaTreeElement = this._quotaTreeElementBySecurityOrigin(securityOr
igin); |
| 1726 if (!quotaTreeElement) |
| 1727 return; |
| 1728 this.removeChild(quotaTreeElement); |
| 1729 }, |
| 1730 |
| 1731 /** |
| 1732 * @param {string} securityOrigin |
| 1733 * @return {WebInspector.QuotaTreeElement} |
| 1734 */ |
| 1735 _quotaTreeElementBySecurityOrigin: function(securityOrigin) |
| 1736 { |
| 1737 for (var i = 0; i < this.children.length; ++i) { |
| 1738 var child = /** @type {WebInspector.QuotaTreeElement} */ (this.child
ren[i]); |
| 1739 if (child.securityOrigin === securityOrigin) |
| 1740 return child; |
| 1741 } |
| 1742 return null; |
| 1743 }, |
| 1744 |
| 1745 __proto__: WebInspector.StorageCategoryTreeElement.prototype |
| 1746 } |
| 1747 |
| 1748 /** |
| 1749 * @constructor |
1663 * @extends {WebInspector.BaseStorageTreeElement} | 1750 * @extends {WebInspector.BaseStorageTreeElement} |
1664 * @param {WebInspector.ResourcesPanel} storagePanel | 1751 * @param {WebInspector.ResourcesPanel} storagePanel |
1665 * @param {WebInspector.IndexedDBModel} model | 1752 * @param {WebInspector.IndexedDBModel} model |
1666 * @param {WebInspector.IndexedDBModel.DatabaseId} databaseId | 1753 * @param {WebInspector.IndexedDBModel.DatabaseId} databaseId |
1667 */ | 1754 */ |
1668 WebInspector.IDBDatabaseTreeElement = function(storagePanel, model, databaseId) | 1755 WebInspector.IDBDatabaseTreeElement = function(storagePanel, model, databaseId) |
1669 { | 1756 { |
1670 WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, databaseI
d.name + " - " + databaseId.securityOrigin, ["indexed-db-storage-tree-item"]); | 1757 WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, databaseI
d.name + " - " + databaseId.securityOrigin, ["indexed-db-storage-tree-item"]); |
1671 this._model = model; | 1758 this._model = model; |
1672 this._databaseId = databaseId; | 1759 this._databaseId = databaseId; |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2149 { | 2236 { |
2150 if (this.fileSystemView && this._storagePanel.visibleView === this.fileS
ystemView) | 2237 if (this.fileSystemView && this._storagePanel.visibleView === this.fileS
ystemView) |
2151 this._storagePanel.closeVisibleView(); | 2238 this._storagePanel.closeVisibleView(); |
2152 }, | 2239 }, |
2153 | 2240 |
2154 __proto__: WebInspector.BaseStorageTreeElement.prototype | 2241 __proto__: WebInspector.BaseStorageTreeElement.prototype |
2155 } | 2242 } |
2156 | 2243 |
2157 /** | 2244 /** |
2158 * @constructor | 2245 * @constructor |
| 2246 * @extends {WebInspector.BaseStorageTreeElement} |
| 2247 */ |
| 2248 WebInspector.QuotaTreeElement = function(storagePanel, securityOrigin) |
| 2249 { |
| 2250 var displayName = securityOrigin; |
| 2251 WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, displayNa
me, ["quota-tree-item"]); |
| 2252 this.securityOrigin = securityOrigin; |
| 2253 } |
| 2254 |
| 2255 WebInspector.QuotaTreeElement.prototype = { |
| 2256 onselect: function(selectedByUser) |
| 2257 { |
| 2258 WebInspector.BaseStorageTreeElement.prototype.onselect.call(this, select
edByUser); |
| 2259 this._storagePanel.showQuota(this.securityOrigin); |
| 2260 }, |
| 2261 |
| 2262 __proto__: WebInspector.BaseStorageTreeElement.prototype |
| 2263 } |
| 2264 |
| 2265 /** |
| 2266 * @constructor |
2159 * @extends {WebInspector.View} | 2267 * @extends {WebInspector.View} |
2160 */ | 2268 */ |
2161 WebInspector.StorageCategoryView = function() | 2269 WebInspector.StorageCategoryView = function() |
2162 { | 2270 { |
2163 WebInspector.View.call(this); | 2271 WebInspector.View.call(this); |
2164 | 2272 |
2165 this.element.addStyleClass("storage-view"); | 2273 this.element.addStyleClass("storage-view"); |
2166 this._emptyView = new WebInspector.EmptyView(""); | 2274 this._emptyView = new WebInspector.EmptyView(""); |
2167 this._emptyView.show(this.element); | 2275 this._emptyView.show(this.element); |
2168 } | 2276 } |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2354 */ | 2462 */ |
2355 _lastTreeElement: function() | 2463 _lastTreeElement: function() |
2356 { | 2464 { |
2357 var treeElement = this._root; | 2465 var treeElement = this._root; |
2358 var nextTreeElement; | 2466 var nextTreeElement; |
2359 while (nextTreeElement = this._traverseNext(treeElement)) | 2467 while (nextTreeElement = this._traverseNext(treeElement)) |
2360 treeElement = nextTreeElement; | 2468 treeElement = nextTreeElement; |
2361 return treeElement; | 2469 return treeElement; |
2362 } | 2470 } |
2363 } | 2471 } |
OLD | NEW |