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)); | |
61 this.localStorageListTreeElement = | 60 this.localStorageListTreeElement = |
62 new Resources.StorageCategoryTreeElement(panel, Common.UIString('Local S
torage'), 'LocalStorage'); | 61 new Resources.StorageCategoryTreeElement(panel, Common.UIString('Local S
torage'), 'LocalStorage'); |
63 var localStorageIcon = UI.Icon.create('mediumicon-table', 'resource-tree-ite
m'); | 62 var localStorageIcon = UI.Icon.create('mediumicon-table', 'resource-tree-ite
m'); |
64 this.localStorageListTreeElement.setLeadingIcons([localStorageIcon]); | 63 this.localStorageListTreeElement.setLeadingIcons([localStorageIcon]); |
65 | 64 |
66 storageTreeElement.appendChild(this.localStorageListTreeElement); | 65 storageTreeElement.appendChild(this.localStorageListTreeElement); |
67 this.sessionStorageListTreeElement = | 66 this.sessionStorageListTreeElement = |
68 new Resources.StorageCategoryTreeElement(panel, Common.UIString('Session
Storage'), 'SessionStorage'); | 67 new Resources.StorageCategoryTreeElement(panel, Common.UIString('Session
Storage'), 'SessionStorage'); |
69 var sessionStorageIcon = UI.Icon.create('mediumicon-table', 'resource-tree-i
tem'); | 68 var sessionStorageIcon = UI.Icon.create('mediumicon-table', 'resource-tree-i
tem'); |
70 this.sessionStorageListTreeElement.setLeadingIcons([sessionStorageIcon]); | 69 this.sessionStorageListTreeElement.setLeadingIcons([sessionStorageIcon]); |
71 | 70 |
72 storageTreeElement.appendChild(this.sessionStorageListTreeElement); | 71 storageTreeElement.appendChild(this.sessionStorageListTreeElement); |
73 this.indexedDBListTreeElement = new Resources.IndexedDBTreeElement(panel); | 72 this.indexedDBListTreeElement = new Resources.IndexedDBTreeElement(panel); |
74 storageTreeElement.appendChild(this.indexedDBListTreeElement); | 73 storageTreeElement.appendChild(this.indexedDBListTreeElement); |
75 this.databasesListTreeElement = | 74 this.databasesListTreeElement = |
76 new Resources.StorageCategoryTreeElement(panel, Common.UIString('Web SQL
'), 'Databases'); | 75 new Resources.StorageCategoryTreeElement(panel, Common.UIString('Web SQL
'), 'Databases'); |
77 var databaseIcon = UI.Icon.create('mediumicon-database', 'resource-tree-item
'); | 76 var databaseIcon = UI.Icon.create('mediumicon-database', 'resource-tree-item
'); |
78 this.databasesListTreeElement.setLeadingIcons([databaseIcon]); | 77 this.databasesListTreeElement.setLeadingIcons([databaseIcon]); |
79 | 78 |
80 storageTreeElement.appendChild(this.databasesListTreeElement); | 79 storageTreeElement.appendChild(this.databasesListTreeElement); |
81 this.cookieListTreeElement = new Resources.StorageCategoryTreeElement(panel,
Common.UIString('Cookies'), 'Cookies'); | 80 this.cookieListTreeElement = new Resources.StorageCategoryTreeElement(panel,
Common.UIString('Cookies'), 'Cookies'); |
82 var cookieIcon = UI.Icon.create('mediumicon-cookie', 'resource-tree-item'); | 81 var cookieIcon = UI.Icon.create('mediumicon-cookie', 'resource-tree-item'); |
83 this.cookieListTreeElement.setLeadingIcons([cookieIcon]); | 82 this.cookieListTreeElement.setLeadingIcons([cookieIcon]); |
84 storageTreeElement.appendChild(this.cookieListTreeElement); | 83 storageTreeElement.appendChild(this.cookieListTreeElement); |
85 | 84 |
86 var cacheTreeElement = this._addSidebarSection(Common.UIString('Cache')); | 85 var cacheTreeElement = this._addSidebarSection(Common.UIString('Cache')); |
87 this._addRefreshSectionButton(cacheTreeElement, this._refreshCacheSection.bi
nd(this)); | |
88 this.cacheStorageListTreeElement = new Resources.ServiceWorkerCacheTreeEleme
nt(panel); | 86 this.cacheStorageListTreeElement = new Resources.ServiceWorkerCacheTreeEleme
nt(panel); |
89 cacheTreeElement.appendChild(this.cacheStorageListTreeElement); | 87 cacheTreeElement.appendChild(this.cacheStorageListTreeElement); |
90 this.applicationCacheListTreeElement = | 88 this.applicationCacheListTreeElement = |
91 new Resources.StorageCategoryTreeElement(panel, Common.UIString('Applica
tion Cache'), 'ApplicationCache'); | 89 new Resources.StorageCategoryTreeElement(panel, Common.UIString('Applica
tion Cache'), 'ApplicationCache'); |
92 var applicationCacheIcon = UI.Icon.create('mediumicon-table', 'resource-tree
-item'); | 90 var applicationCacheIcon = UI.Icon.create('mediumicon-table', 'resource-tree
-item'); |
93 this.applicationCacheListTreeElement.setLeadingIcons([applicationCacheIcon])
; | 91 this.applicationCacheListTreeElement.setLeadingIcons([applicationCacheIcon])
; |
94 | 92 |
95 cacheTreeElement.appendChild(this.applicationCacheListTreeElement); | 93 cacheTreeElement.appendChild(this.applicationCacheListTreeElement); |
96 | 94 |
97 this._resourcesSection = new Resources.ResourcesSection(panel, this._addSide
barSection(Common.UIString('Frames'))); | 95 this._resourcesSection = new Resources.ResourcesSection(panel, this._addSide
barSection(Common.UIString('Frames'))); |
(...skipping 28 matching lines...) Expand all Loading... |
126 _addSidebarSection(title) { | 124 _addSidebarSection(title) { |
127 var treeElement = new UI.TreeElement(title, true); | 125 var treeElement = new UI.TreeElement(title, true); |
128 treeElement.listItemElement.classList.add('storage-group-list-item'); | 126 treeElement.listItemElement.classList.add('storage-group-list-item'); |
129 treeElement.setCollapsible(false); | 127 treeElement.setCollapsible(false); |
130 treeElement.selectable = false; | 128 treeElement.selectable = false; |
131 this._sidebarTree.appendChild(treeElement); | 129 this._sidebarTree.appendChild(treeElement); |
132 return treeElement; | 130 return treeElement; |
133 } | 131 } |
134 | 132 |
135 /** | 133 /** |
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 /** | |
162 * @override | 134 * @override |
163 * @param {!SDK.Target} target | 135 * @param {!SDK.Target} target |
164 */ | 136 */ |
165 targetAdded(target) { | 137 targetAdded(target) { |
166 if (this._target) | 138 if (this._target) |
167 return; | 139 return; |
168 this._target = target; | 140 this._target = target; |
169 this._databaseModel = target.model(Resources.DatabaseModel); | 141 this._databaseModel = target.model(Resources.DatabaseModel); |
170 this._databaseModel.addEventListener(Resources.DatabaseModel.Events.Database
Added, this._databaseAdded, this); | 142 this._databaseModel.addEventListener(Resources.DatabaseModel.Events.Database
Added, this._databaseAdded, this); |
171 this._databaseModel.addEventListener(Resources.DatabaseModel.Events.Database
sRemoved, this._resetWebSQL, this); | 143 this._databaseModel.addEventListener(Resources.DatabaseModel.Events.Database
sRemoved, this._resetWebSQL, this); |
(...skipping 1497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1669 | 1641 |
1670 this.element.classList.add('storage-view'); | 1642 this.element.classList.add('storage-view'); |
1671 this._emptyWidget = new UI.EmptyWidget(''); | 1643 this._emptyWidget = new UI.EmptyWidget(''); |
1672 this._emptyWidget.show(this.element); | 1644 this._emptyWidget.show(this.element); |
1673 } | 1645 } |
1674 | 1646 |
1675 setText(text) { | 1647 setText(text) { |
1676 this._emptyWidget.text = text; | 1648 this._emptyWidget.text = text; |
1677 } | 1649 } |
1678 }; | 1650 }; |
OLD | NEW |