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 var mainElement = this.splitView.mainElement; | 89 var mainElement = this.splitView.mainElement; |
86 this.storageViews = mainElement.createChild("div", "resources-main"); | 90 this.storageViews = mainElement.createChild("div", "resources-main"); |
87 var statusBarContainer = mainElement.createChild("div", "resources-status-ba
r"); | 91 var statusBarContainer = mainElement.createChild("div", "resources-status-ba
r"); |
88 this.storageViewStatusBarItemsContainer = statusBarContainer.createChild("di
v", "status-bar"); | 92 this.storageViewStatusBarItemsContainer = statusBarContainer.createChild("di
v", "status-bar"); |
89 this.storageViews.addStyleClass("diff-container"); | 93 this.storageViews.addStyleClass("diff-container"); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 this._databaseQueryViews.clear(); | 198 this._databaseQueryViews.clear(); |
195 this._databaseTreeElements.clear(); | 199 this._databaseTreeElements.clear(); |
196 this._domStorageViews.clear(); | 200 this._domStorageViews.clear(); |
197 this._domStorageTreeElements.clear(); | 201 this._domStorageTreeElements.clear(); |
198 this._cookieViews = {}; | 202 this._cookieViews = {}; |
199 | 203 |
200 this.databasesListTreeElement.removeChildren(); | 204 this.databasesListTreeElement.removeChildren(); |
201 this.localStorageListTreeElement.removeChildren(); | 205 this.localStorageListTreeElement.removeChildren(); |
202 this.sessionStorageListTreeElement.removeChildren(); | 206 this.sessionStorageListTreeElement.removeChildren(); |
203 this.cookieListTreeElement.removeChildren(); | 207 this.cookieListTreeElement.removeChildren(); |
| 208 this.quotaListTreeElement.removeChildren(); |
204 | 209 |
205 if (this.visibleView && !(this.visibleView instanceof WebInspector.Stora
geCategoryView)) | 210 if (this.visibleView && !(this.visibleView instanceof WebInspector.Stora
geCategoryView)) |
206 this.visibleView.detach(); | 211 this.visibleView.detach(); |
207 | 212 |
208 this.storageViewStatusBarItemsContainer.removeChildren(); | 213 this.storageViewStatusBarItemsContainer.removeChildren(); |
209 | 214 |
210 if (this.sidebarTree.selectedTreeElement) | 215 if (this.sidebarTree.selectedTreeElement) |
211 this.sidebarTree.selectedTreeElement.deselect(); | 216 this.sidebarTree.selectedTreeElement.deselect(); |
212 }, | 217 }, |
213 | 218 |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 }, | 546 }, |
542 | 547 |
543 showApplicationCache: function(frameId) | 548 showApplicationCache: function(frameId) |
544 { | 549 { |
545 if (!this._applicationCacheViews[frameId]) | 550 if (!this._applicationCacheViews[frameId]) |
546 this._applicationCacheViews[frameId] = new WebInspector.ApplicationC
acheItemsView(this._applicationCacheModel, frameId); | 551 this._applicationCacheViews[frameId] = new WebInspector.ApplicationC
acheItemsView(this._applicationCacheModel, frameId); |
547 | 552 |
548 this._innerShowView(this._applicationCacheViews[frameId]); | 553 this._innerShowView(this._applicationCacheViews[frameId]); |
549 }, | 554 }, |
550 | 555 |
| 556 showQuota: function(securityOrigin) |
| 557 { |
| 558 this._innerShowView(new WebInspector.QuotaView(securityOrigin)); |
| 559 }, |
| 560 |
551 /** | 561 /** |
552 * @param {WebInspector.View} view | 562 * @param {WebInspector.View} view |
553 */ | 563 */ |
554 showFileSystem: function(view) | 564 showFileSystem: function(view) |
555 { | 565 { |
556 this._innerShowView(view); | 566 this._innerShowView(view); |
557 }, | 567 }, |
558 | 568 |
559 showCategoryView: function(categoryName) | 569 showCategoryView: function(categoryName) |
560 { | 570 { |
(...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1450 } | 1460 } |
1451 | 1461 |
1452 this._fileSystemModel.refreshFileSystemList(); | 1462 this._fileSystemModel.refreshFileSystemList(); |
1453 }, | 1463 }, |
1454 | 1464 |
1455 __proto__: WebInspector.StorageCategoryTreeElement.prototype | 1465 __proto__: WebInspector.StorageCategoryTreeElement.prototype |
1456 } | 1466 } |
1457 | 1467 |
1458 /** | 1468 /** |
1459 * @constructor | 1469 * @constructor |
| 1470 * @extends {WebInspector.StorageCategoryTreeElement} |
| 1471 * @param {WebInspector.ResourcesPanel} storagePanel |
| 1472 */ |
| 1473 WebInspector.QuotaHostListTreeElement = function(storagePanel) |
| 1474 { |
| 1475 WebInspector.StorageCategoryTreeElement.call(this, storagePanel, WebInspecto
r.UIString("Quota"), "Quota", ["quota-tree-item"]) |
| 1476 } |
| 1477 |
| 1478 WebInspector.QuotaHostListTreeElement.prototype = { |
| 1479 onattach: function() |
| 1480 { |
| 1481 WebInspector.StorageCategoryTreeElement.prototype.onattach.call(this); |
| 1482 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTre
eModel.EventTypes.SecurityOriginAdded, this._securityOriginAdded, this); |
| 1483 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTre
eModel.EventTypes.SecurityOriginRemoved, this._securityOriginRemoved, this); |
| 1484 |
| 1485 var securityOrigins = WebInspector.resourceTreeModel.securityOrigins(); |
| 1486 for (var i = 0; i < securityOrigins.length; ++i) |
| 1487 this._addOrigin(securityOrigins[i]); |
| 1488 }, |
| 1489 |
| 1490 ondetach: function() |
| 1491 { |
| 1492 WebInspector.StorageCategoryTreeElement.prototype.ondetach.call(this); |
| 1493 WebInspector.resourceTreeModel.removeEventListener(WebInspector.Resource
TreeModel.EventTypes.SecurityOriginAdded, this._securityOriginAdded, this); |
| 1494 WebInspector.resourceTreeModel.removeEventListener(WebInspector.Resource
TreeModel.EventTypes.SecurityOriginRemoved, this._securityOriginRemoved, this); |
| 1495 this.removeChildren(); |
| 1496 }, |
| 1497 |
| 1498 /** |
| 1499 * @param {string} securityOrigin |
| 1500 */ |
| 1501 _addOrigin: function(securityOrigin) |
| 1502 { |
| 1503 var quotaTreeElement = new WebInspector.QuotaTreeElement(this._storagePa
nel, securityOrigin); |
| 1504 this.appendChild(quotaTreeElement); |
| 1505 }, |
| 1506 |
| 1507 /** |
| 1508 * @param {WebInspector.Event} event |
| 1509 */ |
| 1510 _securityOriginAdded: function(event) |
| 1511 { |
| 1512 var securityOrigin = /** @type {string} */ (event.data); |
| 1513 this._addOrigin(securityOrigin); |
| 1514 }, |
| 1515 |
| 1516 /** |
| 1517 * @param {WebInspector.Event} event |
| 1518 */ |
| 1519 _securityOriginRemoved: function(event) |
| 1520 { |
| 1521 var securityOrigin = /** @type {string} */ (event.data); |
| 1522 var quotaTreeElement = this._quotaTreeElementBySecurityOrigin(securityOr
igin); |
| 1523 if (!quotaTreeElement) |
| 1524 return; |
| 1525 this.removeChild(quotaTreeElement); |
| 1526 }, |
| 1527 |
| 1528 /** |
| 1529 * @param {string} securityOrigin |
| 1530 * @return {WebInspector.QuotaTreeElement} |
| 1531 */ |
| 1532 _quotaTreeElementBySecurityOrigin: function(securityOrigin) |
| 1533 { |
| 1534 for (var i = 0; i < this.children.length; ++i) { |
| 1535 var child = /** @type {WebInspector.QuotaTreeElement} */ (this.child
ren[i]); |
| 1536 if (child.securityOrigin === securityOrigin) |
| 1537 return child; |
| 1538 } |
| 1539 return null; |
| 1540 }, |
| 1541 |
| 1542 __proto__: WebInspector.StorageCategoryTreeElement.prototype |
| 1543 } |
| 1544 |
| 1545 /** |
| 1546 * @constructor |
1460 * @extends {WebInspector.BaseStorageTreeElement} | 1547 * @extends {WebInspector.BaseStorageTreeElement} |
1461 * @param {WebInspector.ResourcesPanel} storagePanel | 1548 * @param {WebInspector.ResourcesPanel} storagePanel |
1462 * @param {WebInspector.IndexedDBModel} model | 1549 * @param {WebInspector.IndexedDBModel} model |
1463 * @param {WebInspector.IndexedDBModel.DatabaseId} databaseId | 1550 * @param {WebInspector.IndexedDBModel.DatabaseId} databaseId |
1464 */ | 1551 */ |
1465 WebInspector.IDBDatabaseTreeElement = function(storagePanel, model, databaseId) | 1552 WebInspector.IDBDatabaseTreeElement = function(storagePanel, model, databaseId) |
1466 { | 1553 { |
1467 WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, databaseI
d.name + " - " + databaseId.securityOrigin, ["indexed-db-storage-tree-item"]); | 1554 WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, databaseI
d.name + " - " + databaseId.securityOrigin, ["indexed-db-storage-tree-item"]); |
1468 this._model = model; | 1555 this._model = model; |
1469 this._databaseId = databaseId; | 1556 this._databaseId = databaseId; |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1946 { | 2033 { |
1947 if (this.fileSystemView && this._storagePanel.visibleView === this.fileS
ystemView) | 2034 if (this.fileSystemView && this._storagePanel.visibleView === this.fileS
ystemView) |
1948 this._storagePanel.closeVisibleView(); | 2035 this._storagePanel.closeVisibleView(); |
1949 }, | 2036 }, |
1950 | 2037 |
1951 __proto__: WebInspector.BaseStorageTreeElement.prototype | 2038 __proto__: WebInspector.BaseStorageTreeElement.prototype |
1952 } | 2039 } |
1953 | 2040 |
1954 /** | 2041 /** |
1955 * @constructor | 2042 * @constructor |
| 2043 * @extends {WebInspector.BaseStorageTreeElement} |
| 2044 */ |
| 2045 WebInspector.QuotaTreeElement = function(storagePanel, securityOrigin) |
| 2046 { |
| 2047 var displayName = securityOrigin; |
| 2048 WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, displayNa
me, ["quota-tree-item"]); |
| 2049 this.securityOrigin = securityOrigin; |
| 2050 } |
| 2051 |
| 2052 WebInspector.QuotaTreeElement.prototype = { |
| 2053 onselect: function(selectedByUser) |
| 2054 { |
| 2055 WebInspector.BaseStorageTreeElement.prototype.onselect.call(this, select
edByUser); |
| 2056 this._storagePanel.showQuota(this.securityOrigin); |
| 2057 }, |
| 2058 |
| 2059 __proto__: WebInspector.BaseStorageTreeElement.prototype |
| 2060 } |
| 2061 |
| 2062 /** |
| 2063 * @constructor |
1956 * @extends {WebInspector.View} | 2064 * @extends {WebInspector.View} |
1957 */ | 2065 */ |
1958 WebInspector.StorageCategoryView = function() | 2066 WebInspector.StorageCategoryView = function() |
1959 { | 2067 { |
1960 WebInspector.View.call(this); | 2068 WebInspector.View.call(this); |
1961 | 2069 |
1962 this.element.addStyleClass("storage-view"); | 2070 this.element.addStyleClass("storage-view"); |
1963 this._emptyView = new WebInspector.EmptyView(""); | 2071 this._emptyView = new WebInspector.EmptyView(""); |
1964 this._emptyView.show(this.element); | 2072 this._emptyView.show(this.element); |
1965 } | 2073 } |
1966 | 2074 |
1967 WebInspector.StorageCategoryView.prototype = { | 2075 WebInspector.StorageCategoryView.prototype = { |
1968 setText: function(text) | 2076 setText: function(text) |
1969 { | 2077 { |
1970 this._emptyView.text = text; | 2078 this._emptyView.text = text; |
1971 }, | 2079 }, |
1972 | 2080 |
1973 __proto__: WebInspector.View.prototype | 2081 __proto__: WebInspector.View.prototype |
1974 } | 2082 } |
OLD | NEW |