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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 this.contentElement.appendChild(this._sidebarTree.element); | 50 this.contentElement.appendChild(this._sidebarTree.element); |
51 this._applicationTreeElement = this._addSidebarSection(Common.UIString('Appl
ication')); | 51 this._applicationTreeElement = this._addSidebarSection(Common.UIString('Appl
ication')); |
52 this._manifestTreeElement = new Resources.AppManifestTreeElement(panel); | 52 this._manifestTreeElement = new Resources.AppManifestTreeElement(panel); |
53 this._applicationTreeElement.appendChild(this._manifestTreeElement); | 53 this._applicationTreeElement.appendChild(this._manifestTreeElement); |
54 this.serviceWorkersTreeElement = new Resources.ServiceWorkersTreeElement(pan
el); | 54 this.serviceWorkersTreeElement = new Resources.ServiceWorkersTreeElement(pan
el); |
55 this._applicationTreeElement.appendChild(this.serviceWorkersTreeElement); | 55 this._applicationTreeElement.appendChild(this.serviceWorkersTreeElement); |
56 var clearStorageTreeElement = new Resources.ClearStorageTreeElement(panel); | 56 var clearStorageTreeElement = new Resources.ClearStorageTreeElement(panel); |
57 this._applicationTreeElement.appendChild(clearStorageTreeElement); | 57 this._applicationTreeElement.appendChild(clearStorageTreeElement); |
58 | 58 |
59 var storageTreeElement = this._addSidebarSection(Common.UIString('Storage'))
; | 59 var storageTreeElement = this._addSidebarSection(Common.UIString('Storage'))
; |
| 60 this._addRefreshSectionButton(storageTreeElement, this._refreshStorageSectio
n.bind(this)); |
60 this.localStorageListTreeElement = | 61 this.localStorageListTreeElement = |
61 new Resources.StorageCategoryTreeElement(panel, Common.UIString('Local S
torage'), 'LocalStorage'); | 62 new Resources.StorageCategoryTreeElement(panel, Common.UIString('Local S
torage'), 'LocalStorage'); |
62 var localStorageIcon = UI.Icon.create('mediumicon-table', 'resource-tree-ite
m'); | 63 var localStorageIcon = UI.Icon.create('mediumicon-table', 'resource-tree-ite
m'); |
63 this.localStorageListTreeElement.setLeadingIcons([localStorageIcon]); | 64 this.localStorageListTreeElement.setLeadingIcons([localStorageIcon]); |
64 | 65 |
65 storageTreeElement.appendChild(this.localStorageListTreeElement); | 66 storageTreeElement.appendChild(this.localStorageListTreeElement); |
66 this.sessionStorageListTreeElement = | 67 this.sessionStorageListTreeElement = |
67 new Resources.StorageCategoryTreeElement(panel, Common.UIString('Session
Storage'), 'SessionStorage'); | 68 new Resources.StorageCategoryTreeElement(panel, Common.UIString('Session
Storage'), 'SessionStorage'); |
68 var sessionStorageIcon = UI.Icon.create('mediumicon-table', 'resource-tree-i
tem'); | 69 var sessionStorageIcon = UI.Icon.create('mediumicon-table', 'resource-tree-i
tem'); |
69 this.sessionStorageListTreeElement.setLeadingIcons([sessionStorageIcon]); | 70 this.sessionStorageListTreeElement.setLeadingIcons([sessionStorageIcon]); |
70 | 71 |
71 storageTreeElement.appendChild(this.sessionStorageListTreeElement); | 72 storageTreeElement.appendChild(this.sessionStorageListTreeElement); |
72 this.indexedDBListTreeElement = new Resources.IndexedDBTreeElement(panel); | 73 this.indexedDBListTreeElement = new Resources.IndexedDBTreeElement(panel); |
73 storageTreeElement.appendChild(this.indexedDBListTreeElement); | 74 storageTreeElement.appendChild(this.indexedDBListTreeElement); |
74 this.databasesListTreeElement = | 75 this.databasesListTreeElement = |
75 new Resources.StorageCategoryTreeElement(panel, Common.UIString('Web SQL
'), 'Databases'); | 76 new Resources.StorageCategoryTreeElement(panel, Common.UIString('Web SQL
'), 'Databases'); |
76 var databaseIcon = UI.Icon.create('mediumicon-database', 'resource-tree-item
'); | 77 var databaseIcon = UI.Icon.create('mediumicon-database', 'resource-tree-item
'); |
77 this.databasesListTreeElement.setLeadingIcons([databaseIcon]); | 78 this.databasesListTreeElement.setLeadingIcons([databaseIcon]); |
78 | 79 |
79 storageTreeElement.appendChild(this.databasesListTreeElement); | 80 storageTreeElement.appendChild(this.databasesListTreeElement); |
80 this.cookieListTreeElement = new Resources.StorageCategoryTreeElement(panel,
Common.UIString('Cookies'), 'Cookies'); | 81 this.cookieListTreeElement = new Resources.StorageCategoryTreeElement(panel,
Common.UIString('Cookies'), 'Cookies'); |
81 var cookieIcon = UI.Icon.create('mediumicon-cookie', 'resource-tree-item'); | 82 var cookieIcon = UI.Icon.create('mediumicon-cookie', 'resource-tree-item'); |
82 this.cookieListTreeElement.setLeadingIcons([cookieIcon]); | 83 this.cookieListTreeElement.setLeadingIcons([cookieIcon]); |
83 storageTreeElement.appendChild(this.cookieListTreeElement); | 84 storageTreeElement.appendChild(this.cookieListTreeElement); |
84 | 85 |
85 var cacheTreeElement = this._addSidebarSection(Common.UIString('Cache')); | 86 var cacheTreeElement = this._addSidebarSection(Common.UIString('Cache')); |
| 87 this._addRefreshSectionButton(cacheTreeElement, this._refreshCacheSection.bi
nd(this)); |
86 this.cacheStorageListTreeElement = new Resources.ServiceWorkerCacheTreeEleme
nt(panel); | 88 this.cacheStorageListTreeElement = new Resources.ServiceWorkerCacheTreeEleme
nt(panel); |
87 cacheTreeElement.appendChild(this.cacheStorageListTreeElement); | 89 cacheTreeElement.appendChild(this.cacheStorageListTreeElement); |
88 this.applicationCacheListTreeElement = | 90 this.applicationCacheListTreeElement = |
89 new Resources.StorageCategoryTreeElement(panel, Common.UIString('Applica
tion Cache'), 'ApplicationCache'); | 91 new Resources.StorageCategoryTreeElement(panel, Common.UIString('Applica
tion Cache'), 'ApplicationCache'); |
90 var applicationCacheIcon = UI.Icon.create('mediumicon-table', 'resource-tree
-item'); | 92 var applicationCacheIcon = UI.Icon.create('mediumicon-table', 'resource-tree
-item'); |
91 this.applicationCacheListTreeElement.setLeadingIcons([applicationCacheIcon])
; | 93 this.applicationCacheListTreeElement.setLeadingIcons([applicationCacheIcon])
; |
92 | 94 |
93 cacheTreeElement.appendChild(this.applicationCacheListTreeElement); | 95 cacheTreeElement.appendChild(this.applicationCacheListTreeElement); |
94 | 96 |
95 this._resourcesSection = new Resources.ResourcesSection(panel, this._addSide
barSection(Common.UIString('Frames'))); | 97 this._resourcesSection = new Resources.ResourcesSection(panel, this._addSide
barSection(Common.UIString('Frames'))); |
(...skipping 28 matching lines...) Expand all Loading... |
124 _addSidebarSection(title) { | 126 _addSidebarSection(title) { |
125 var treeElement = new UI.TreeElement(title, true); | 127 var treeElement = new UI.TreeElement(title, true); |
126 treeElement.listItemElement.classList.add('storage-group-list-item'); | 128 treeElement.listItemElement.classList.add('storage-group-list-item'); |
127 treeElement.setCollapsible(false); | 129 treeElement.setCollapsible(false); |
128 treeElement.selectable = false; | 130 treeElement.selectable = false; |
129 this._sidebarTree.appendChild(treeElement); | 131 this._sidebarTree.appendChild(treeElement); |
130 return treeElement; | 132 return treeElement; |
131 } | 133 } |
132 | 134 |
133 /** | 135 /** |
| 136 * @param {!UI.TreeElement} treeElement |
| 137 * @param {function()} refresh |
| 138 */ |
| 139 _addRefreshSectionButton(treeElement, refresh) { |
| 140 var refreshIcon = UI.Icon.create('largeicon-refresh', 'sidebar-section-butto
n'); |
| 141 refreshIcon.addEventListener('click', refresh, false); |
| 142 treeElement.setTrailingIcons([refreshIcon]); |
| 143 } |
| 144 |
| 145 _refreshStorageSection() { |
| 146 var visibleView = this._panel.visibleView; |
| 147 if (visibleView instanceof Resources.DOMStorageItemsView || visibleView inst
anceof Resources.CookieItemsView) { |
| 148 // Local Storage, Session Storage || Cookies |
| 149 visibleView.refreshItems(); |
| 150 } else if (visibleView instanceof Resources.DatabaseTableView) { |
| 151 // Web SQL |
| 152 visibleView.update(); |
| 153 } |
| 154 this.indexedDBListTreeElement.refreshIndexedDB(); |
| 155 } |
| 156 |
| 157 _refreshCacheSection() { |
| 158 this.cacheStorageListTreeElement._refreshCaches(); |
| 159 } |
| 160 |
| 161 /** |
134 * @override | 162 * @override |
135 * @param {!SDK.Target} target | 163 * @param {!SDK.Target} target |
136 */ | 164 */ |
137 targetAdded(target) { | 165 targetAdded(target) { |
138 if (this._target) | 166 if (this._target) |
139 return; | 167 return; |
140 this._target = target; | 168 this._target = target; |
141 this._databaseModel = target.model(Resources.DatabaseModel); | 169 this._databaseModel = target.model(Resources.DatabaseModel); |
142 this._databaseModel.addEventListener(Resources.DatabaseModel.Events.Database
Added, this._databaseAdded, this); | 170 this._databaseModel.addEventListener(Resources.DatabaseModel.Events.Database
Added, this._databaseAdded, this); |
143 this._databaseModel.addEventListener(Resources.DatabaseModel.Events.Database
sRemoved, this._resetWebSQL, this); | 171 this._databaseModel.addEventListener(Resources.DatabaseModel.Events.Database
sRemoved, this._resetWebSQL, this); |
(...skipping 1497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1641 | 1669 |
1642 this.element.classList.add('storage-view'); | 1670 this.element.classList.add('storage-view'); |
1643 this._emptyWidget = new UI.EmptyWidget(''); | 1671 this._emptyWidget = new UI.EmptyWidget(''); |
1644 this._emptyWidget.show(this.element); | 1672 this._emptyWidget.show(this.element); |
1645 } | 1673 } |
1646 | 1674 |
1647 setText(text) { | 1675 setText(text) { |
1648 this._emptyWidget.text = text; | 1676 this._emptyWidget.text = text; |
1649 } | 1677 } |
1650 }; | 1678 }; |
OLD | NEW |