| 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 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 773 Resources.ServiceWorkerCacheTreeElement = class extends Resources.StorageCategor
yTreeElement { | 773 Resources.ServiceWorkerCacheTreeElement = class extends Resources.StorageCategor
yTreeElement { |
| 774 /** | 774 /** |
| 775 * @param {!Resources.ResourcesPanel} storagePanel | 775 * @param {!Resources.ResourcesPanel} storagePanel |
| 776 */ | 776 */ |
| 777 constructor(storagePanel) { | 777 constructor(storagePanel) { |
| 778 super(storagePanel, Common.UIString('Cache Storage'), 'CacheStorage'); | 778 super(storagePanel, Common.UIString('Cache Storage'), 'CacheStorage'); |
| 779 var icon = UI.Icon.create('mediumicon-database', 'resource-tree-item'); | 779 var icon = UI.Icon.create('mediumicon-database', 'resource-tree-item'); |
| 780 this.setLeadingIcons([icon]); | 780 this.setLeadingIcons([icon]); |
| 781 /** @type {?SDK.ServiceWorkerCacheModel} */ | 781 /** @type {?SDK.ServiceWorkerCacheModel} */ |
| 782 this._swCacheModel = null; | 782 this._swCacheModel = null; |
| 783 this._view = null; |
| 783 } | 784 } |
| 784 | 785 |
| 785 /** | 786 /** |
| 786 * @param {?SDK.ServiceWorkerCacheModel} model | 787 * @param {?SDK.ServiceWorkerCacheModel} model |
| 787 */ | 788 */ |
| 788 _initialize(model) { | 789 _initialize(model) { |
| 789 /** @type {!Array.<!Resources.SWCacheTreeElement>} */ | 790 /** @type {!Array.<!Resources.SWCacheTreeElement>} */ |
| 790 this._swCacheTreeElements = []; | 791 this._swCacheTreeElements = []; |
| 791 this._swCacheModel = model; | 792 this._swCacheModel = model; |
| 792 if (model) { | 793 if (model) { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 812 contextMenu.appendItem(Common.UIString('Refresh Caches'), this._refreshCache
s.bind(this)); | 813 contextMenu.appendItem(Common.UIString('Refresh Caches'), this._refreshCache
s.bind(this)); |
| 813 contextMenu.show(); | 814 contextMenu.show(); |
| 814 } | 815 } |
| 815 | 816 |
| 816 _refreshCaches() { | 817 _refreshCaches() { |
| 817 if (this._swCacheModel) | 818 if (this._swCacheModel) |
| 818 this._swCacheModel.refreshCacheNames(); | 819 this._swCacheModel.refreshCacheNames(); |
| 819 } | 820 } |
| 820 | 821 |
| 821 /** | 822 /** |
| 823 * @override |
| 824 * @return {boolean} |
| 825 */ |
| 826 onselect(selectedByUser) { |
| 827 super.onselect(selectedByUser); |
| 828 if (!this._view) |
| 829 this._view = new Resources.ServiceWorkerCategoryView(this._refreshCaches.b
ind(this)); |
| 830 |
| 831 this.showView(this._view); |
| 832 return false; |
| 833 } |
| 834 |
| 835 /** |
| 822 * @param {!Common.Event} event | 836 * @param {!Common.Event} event |
| 823 */ | 837 */ |
| 824 _cacheAdded(event) { | 838 _cacheAdded(event) { |
| 825 var cache = /** @type {!SDK.ServiceWorkerCacheModel.Cache} */ (event.data.ca
che); | 839 var cache = /** @type {!SDK.ServiceWorkerCacheModel.Cache} */ (event.data.ca
che); |
| 826 var model = /** @type {!SDK.ServiceWorkerCacheModel} */ (event.data.model); | 840 var model = /** @type {!SDK.ServiceWorkerCacheModel} */ (event.data.model); |
| 827 this._addCache(model, cache); | 841 this._addCache(model, cache); |
| 828 } | 842 } |
| 829 | 843 |
| 830 /** | 844 /** |
| 831 * @param {!SDK.ServiceWorkerCacheModel} model | 845 * @param {!SDK.ServiceWorkerCacheModel} model |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1044 * @unrestricted | 1058 * @unrestricted |
| 1045 */ | 1059 */ |
| 1046 Resources.IndexedDBTreeElement = class extends Resources.StorageCategoryTreeElem
ent { | 1060 Resources.IndexedDBTreeElement = class extends Resources.StorageCategoryTreeElem
ent { |
| 1047 /** | 1061 /** |
| 1048 * @param {!Resources.ResourcesPanel} storagePanel | 1062 * @param {!Resources.ResourcesPanel} storagePanel |
| 1049 */ | 1063 */ |
| 1050 constructor(storagePanel) { | 1064 constructor(storagePanel) { |
| 1051 super(storagePanel, Common.UIString('IndexedDB'), 'IndexedDB'); | 1065 super(storagePanel, Common.UIString('IndexedDB'), 'IndexedDB'); |
| 1052 var icon = UI.Icon.create('mediumicon-database', 'resource-tree-item'); | 1066 var icon = UI.Icon.create('mediumicon-database', 'resource-tree-item'); |
| 1053 this.setLeadingIcons([icon]); | 1067 this.setLeadingIcons([icon]); |
| 1068 this._view = null; |
| 1054 } | 1069 } |
| 1055 | 1070 |
| 1056 _initialize() { | 1071 _initialize() { |
| 1057 SDK.targetManager.addModelListener( | 1072 SDK.targetManager.addModelListener( |
| 1058 Resources.IndexedDBModel, Resources.IndexedDBModel.Events.DatabaseAdded,
this._indexedDBAdded, this); | 1073 Resources.IndexedDBModel, Resources.IndexedDBModel.Events.DatabaseAdded,
this._indexedDBAdded, this); |
| 1059 SDK.targetManager.addModelListener( | 1074 SDK.targetManager.addModelListener( |
| 1060 Resources.IndexedDBModel, Resources.IndexedDBModel.Events.DatabaseRemove
d, this._indexedDBRemoved, this); | 1075 Resources.IndexedDBModel, Resources.IndexedDBModel.Events.DatabaseRemove
d, this._indexedDBRemoved, this); |
| 1061 SDK.targetManager.addModelListener( | 1076 SDK.targetManager.addModelListener( |
| 1062 Resources.IndexedDBModel, Resources.IndexedDBModel.Events.DatabaseLoaded
, this._indexedDBLoaded, this); | 1077 Resources.IndexedDBModel, Resources.IndexedDBModel.Events.DatabaseLoaded
, this._indexedDBLoaded, this); |
| 1063 /** @type {!Array.<!Resources.IDBDatabaseTreeElement>} */ | 1078 /** @type {!Array.<!Resources.IDBDatabaseTreeElement>} */ |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1083 contextMenu.appendItem(Common.UIString('Refresh IndexedDB'), this.refreshInd
exedDB.bind(this)); | 1098 contextMenu.appendItem(Common.UIString('Refresh IndexedDB'), this.refreshInd
exedDB.bind(this)); |
| 1084 contextMenu.show(); | 1099 contextMenu.show(); |
| 1085 } | 1100 } |
| 1086 | 1101 |
| 1087 refreshIndexedDB() { | 1102 refreshIndexedDB() { |
| 1088 for (var indexedDBModel of SDK.targetManager.models(Resources.IndexedDBModel
)) | 1103 for (var indexedDBModel of SDK.targetManager.models(Resources.IndexedDBModel
)) |
| 1089 indexedDBModel.refreshDatabaseNames(); | 1104 indexedDBModel.refreshDatabaseNames(); |
| 1090 } | 1105 } |
| 1091 | 1106 |
| 1092 /** | 1107 /** |
| 1108 * @override |
| 1109 * @return {boolean} |
| 1110 */ |
| 1111 onselect(selectedByUser) { |
| 1112 super.onselect(selectedByUser); |
| 1113 if (!this._view) |
| 1114 this._view = new Resources.IDBCategoryView(this.refreshIndexedDB.bind(this
)); |
| 1115 |
| 1116 this.showView(this._view); |
| 1117 return false; |
| 1118 } |
| 1119 |
| 1120 /** |
| 1093 * @param {!Common.Event} event | 1121 * @param {!Common.Event} event |
| 1094 */ | 1122 */ |
| 1095 _indexedDBAdded(event) { | 1123 _indexedDBAdded(event) { |
| 1096 var databaseId = /** @type {!Resources.IndexedDBModel.DatabaseId} */ (event.
data.databaseId); | 1124 var databaseId = /** @type {!Resources.IndexedDBModel.DatabaseId} */ (event.
data.databaseId); |
| 1097 var model = /** @type {!Resources.IndexedDBModel} */ (event.data.model); | 1125 var model = /** @type {!Resources.IndexedDBModel} */ (event.data.model); |
| 1098 this._addIndexedDB(model, databaseId); | 1126 this._addIndexedDB(model, databaseId); |
| 1099 } | 1127 } |
| 1100 | 1128 |
| 1101 /** | 1129 /** |
| 1102 * @param {!Resources.IndexedDBModel} model | 1130 * @param {!Resources.IndexedDBModel} model |
| (...skipping 538 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 |