| Index: Source/devtools/front_end/ResourcesPanel.js
|
| diff --git a/Source/devtools/front_end/ResourcesPanel.js b/Source/devtools/front_end/ResourcesPanel.js
|
| index bdb45fcfcf99e5f3a86187cb2ada5d4fe7adac6b..c649efb1e34504f57ea2aaca10f41fc32ed3c99e 100644
|
| --- a/Source/devtools/front_end/ResourcesPanel.js
|
| +++ b/Source/devtools/front_end/ResourcesPanel.js
|
| @@ -36,6 +36,7 @@ importScript("DirectoryContentView.js");
|
| importScript("IndexedDBViews.js");
|
| importScript("FileContentView.js");
|
| importScript("FileSystemView.js");
|
| +importScript("QuotaView.js");
|
|
|
| /**
|
| * @constructor
|
| @@ -77,6 +78,9 @@ WebInspector.ResourcesPanel = function(database)
|
| this.applicationCacheListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString("Application Cache"), "ApplicationCache", ["application-cache-storage-tree-item"]);
|
| this.sidebarTree.appendChild(this.applicationCacheListTreeElement);
|
|
|
| + this.quotaListTreeElement = new WebInspector.QuotaHostListTreeElement(this);
|
| + this.sidebarTree.appendChild(this.quotaListTreeElement);
|
| +
|
| if (WebInspector.experimentsSettings.fileSystemInspection.isEnabled()) {
|
| this.fileSystemListTreeElement = new WebInspector.FileSystemListTreeElement(this);
|
| this.sidebarTree.appendChild(this.fileSystemListTreeElement);
|
| @@ -201,6 +205,7 @@ WebInspector.ResourcesPanel.prototype = {
|
| this.localStorageListTreeElement.removeChildren();
|
| this.sessionStorageListTreeElement.removeChildren();
|
| this.cookieListTreeElement.removeChildren();
|
| + this.quotaListTreeElement.removeChildren();
|
|
|
| if (this.visibleView && !(this.visibleView instanceof WebInspector.StorageCategoryView))
|
| this.visibleView.detach();
|
| @@ -548,6 +553,11 @@ WebInspector.ResourcesPanel.prototype = {
|
| this._innerShowView(this._applicationCacheViews[frameId]);
|
| },
|
|
|
| + showQuota: function(securityOrigin)
|
| + {
|
| + this._innerShowView(new WebInspector.QuotaView(securityOrigin));
|
| + },
|
| +
|
| /**
|
| * @param {WebInspector.View} view
|
| */
|
| @@ -1457,6 +1467,83 @@ WebInspector.FileSystemListTreeElement.prototype = {
|
|
|
| /**
|
| * @constructor
|
| + * @extends {WebInspector.StorageCategoryTreeElement}
|
| + * @param {WebInspector.ResourcesPanel} storagePanel
|
| + */
|
| +WebInspector.QuotaHostListTreeElement = function(storagePanel)
|
| +{
|
| + WebInspector.StorageCategoryTreeElement.call(this, storagePanel, WebInspector.UIString("Quota"), "Quota", ["quota-tree-item"])
|
| +}
|
| +
|
| +WebInspector.QuotaHostListTreeElement.prototype = {
|
| + onattach: function()
|
| + {
|
| + WebInspector.StorageCategoryTreeElement.prototype.onattach.call(this);
|
| + WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.SecurityOriginAdded, this._securityOriginAdded, this);
|
| + WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.SecurityOriginRemoved, this._securityOriginRemoved, this);
|
| +
|
| + var securityOrigins = WebInspector.resourceTreeModel.securityOrigins();
|
| + for (var i = 0; i < securityOrigins.length; ++i)
|
| + this._addOrigin(securityOrigins[i]);
|
| + },
|
| +
|
| + ondetach: function()
|
| + {
|
| + WebInspector.StorageCategoryTreeElement.prototype.ondetach.call(this);
|
| + WebInspector.resourceTreeModel.removeEventListener(WebInspector.ResourceTreeModel.EventTypes.SecurityOriginAdded, this._securityOriginAdded, this);
|
| + WebInspector.resourceTreeModel.removeEventListener(WebInspector.ResourceTreeModel.EventTypes.SecurityOriginRemoved, this._securityOriginRemoved, this);
|
| + this.removeChildren();
|
| + },
|
| +
|
| + /**
|
| + * @param {string} securityOrigin
|
| + */
|
| + _addOrigin: function(securityOrigin)
|
| + {
|
| + var quotaTreeElement = new WebInspector.QuotaTreeElement(this._storagePanel, securityOrigin);
|
| + this.appendChild(quotaTreeElement);
|
| + },
|
| +
|
| + /**
|
| + * @param {WebInspector.Event} event
|
| + */
|
| + _securityOriginAdded: function(event)
|
| + {
|
| + var securityOrigin = /** @type {string} */ (event.data);
|
| + this._addOrigin(securityOrigin);
|
| + },
|
| +
|
| + /**
|
| + * @param {WebInspector.Event} event
|
| + */
|
| + _securityOriginRemoved: function(event)
|
| + {
|
| + var securityOrigin = /** @type {string} */ (event.data);
|
| + var quotaTreeElement = this._quotaTreeElementBySecurityOrigin(securityOrigin);
|
| + if (!quotaTreeElement)
|
| + return;
|
| + this.removeChild(quotaTreeElement);
|
| + },
|
| +
|
| + /**
|
| + * @param {string} securityOrigin
|
| + * @return {WebInspector.QuotaTreeElement}
|
| + */
|
| + _quotaTreeElementBySecurityOrigin: function(securityOrigin)
|
| + {
|
| + for (var i = 0; i < this.children.length; ++i) {
|
| + var child = /** @type {WebInspector.QuotaTreeElement} */ (this.children[i]);
|
| + if (child.securityOrigin === securityOrigin)
|
| + return child;
|
| + }
|
| + return null;
|
| + },
|
| +
|
| + __proto__: WebInspector.StorageCategoryTreeElement.prototype
|
| +}
|
| +
|
| +/**
|
| + * @constructor
|
| * @extends {WebInspector.BaseStorageTreeElement}
|
| * @param {WebInspector.ResourcesPanel} storagePanel
|
| * @param {WebInspector.IndexedDBModel} model
|
| @@ -1953,6 +2040,27 @@ WebInspector.FileSystemTreeElement.prototype = {
|
|
|
| /**
|
| * @constructor
|
| + * @extends {WebInspector.BaseStorageTreeElement}
|
| + */
|
| +WebInspector.QuotaTreeElement = function(storagePanel, securityOrigin)
|
| +{
|
| + var displayName = securityOrigin;
|
| + WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, displayName, ["quota-tree-item"]);
|
| + this.securityOrigin = securityOrigin;
|
| +}
|
| +
|
| +WebInspector.QuotaTreeElement.prototype = {
|
| + onselect: function(selectedByUser)
|
| + {
|
| + WebInspector.BaseStorageTreeElement.prototype.onselect.call(this, selectedByUser);
|
| + this._storagePanel.showQuota(this.securityOrigin);
|
| + },
|
| +
|
| + __proto__: WebInspector.BaseStorageTreeElement.prototype
|
| +}
|
| +
|
| +/**
|
| + * @constructor
|
| * @extends {WebInspector.View}
|
| */
|
| WebInspector.StorageCategoryView = function()
|
|
|