Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/resources/ApplicationPanelSidebar.js

Issue 2914293002: [IndexedDB] [DevTools] Right-click 'Refresh' on database now updates object store view, also fixed … (Closed)
Patch Set: Changed to event listener Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after
1079 } 1079 }
1080 1080
1081 _handleContextMenuEvent(event) { 1081 _handleContextMenuEvent(event) {
1082 var contextMenu = new UI.ContextMenu(event); 1082 var contextMenu = new UI.ContextMenu(event);
1083 contextMenu.appendItem(Common.UIString('Refresh IndexedDB'), this.refreshInd exedDB.bind(this)); 1083 contextMenu.appendItem(Common.UIString('Refresh IndexedDB'), this.refreshInd exedDB.bind(this));
1084 contextMenu.show(); 1084 contextMenu.show();
1085 } 1085 }
1086 1086
1087 refreshIndexedDB() { 1087 refreshIndexedDB() {
1088 for (var indexedDBModel of SDK.targetManager.models(Resources.IndexedDBModel )) 1088 for (var indexedDBModel of SDK.targetManager.models(Resources.IndexedDBModel ))
1089 indexedDBModel.refreshDatabaseNames(); 1089 indexedDBModel.refreshDatabaseNames(); // Adds IDBDatabaseTreeElements.
dgozman 2017/06/07 21:22:05 Remove the comment.
kristipark 2017/06/08 01:04:09 Done.
1090 } 1090 }
1091 1091
1092 /** 1092 /**
1093 * @param {!Common.Event} event 1093 * @param {!Common.Event} event
1094 */ 1094 */
1095 _indexedDBAdded(event) { 1095 _indexedDBAdded(event) {
1096 var databaseId = /** @type {!Resources.IndexedDBModel.DatabaseId} */ (event. data.databaseId); 1096 var databaseId = /** @type {!Resources.IndexedDBModel.DatabaseId} */ (event. data.databaseId);
1097 var model = /** @type {!Resources.IndexedDBModel} */ (event.data.model); 1097 var model = /** @type {!Resources.IndexedDBModel} */ (event.data.model);
1098 this._addIndexedDB(model, databaseId); 1098 this._addIndexedDB(model, databaseId);
1099 } 1099 }
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1169 * @param {!Resources.IndexedDBModel} model 1169 * @param {!Resources.IndexedDBModel} model
1170 * @param {!Resources.IndexedDBModel.DatabaseId} databaseId 1170 * @param {!Resources.IndexedDBModel.DatabaseId} databaseId
1171 */ 1171 */
1172 constructor(storagePanel, model, databaseId) { 1172 constructor(storagePanel, model, databaseId) {
1173 super(storagePanel, databaseId.name + ' - ' + databaseId.securityOrigin, fal se); 1173 super(storagePanel, databaseId.name + ' - ' + databaseId.securityOrigin, fal se);
1174 this._model = model; 1174 this._model = model;
1175 this._databaseId = databaseId; 1175 this._databaseId = databaseId;
1176 this._idbObjectStoreTreeElements = {}; 1176 this._idbObjectStoreTreeElements = {};
1177 var icon = UI.Icon.create('mediumicon-database', 'resource-tree-item'); 1177 var icon = UI.Icon.create('mediumicon-database', 'resource-tree-item');
1178 this.setLeadingIcons([icon]); 1178 this.setLeadingIcons([icon]);
1179 SDK.targetManager.addModelListener(
dgozman 2017/06/07 21:22:05 model.addEventListener(...)
kristipark 2017/06/08 01:04:09 Done.
1180 Resources.IndexedDBModel, Resources.IndexedDBModel.Events.DatabaseNamesR efreshed, this._refreshIndexedDB, this);
1179 } 1181 }
1180 1182
1181 get itemURL() { 1183 get itemURL() {
1182 return 'indexedDB://' + this._databaseId.securityOrigin + '/' + this._databa seId.name; 1184 return 'indexedDB://' + this._databaseId.securityOrigin + '/' + this._databa seId.name;
1183 } 1185 }
1184 1186
1185 /** 1187 /**
1186 * @override 1188 * @override
1187 */ 1189 */
1188 onattach() { 1190 onattach() {
1189 super.onattach(); 1191 super.onattach();
1190 this.listItemElement.addEventListener('contextmenu', this._handleContextMenu Event.bind(this), true); 1192 this.listItemElement.addEventListener('contextmenu', this._handleContextMenu Event.bind(this), true);
1191 } 1193 }
1192 1194
1193 _handleContextMenuEvent(event) { 1195 _handleContextMenuEvent(event) {
1194 var contextMenu = new UI.ContextMenu(event); 1196 var contextMenu = new UI.ContextMenu(event);
1195 contextMenu.appendItem(Common.UIString('Refresh IndexedDB'), this._refreshIn dexedDB.bind(this)); 1197 contextMenu.appendItem(Common.UIString('Refresh IndexedDB'), this._refreshIn dexedDB.bind(this));
1196 contextMenu.show(); 1198 contextMenu.show();
1197 } 1199 }
1198 1200
1199 _refreshIndexedDB() { 1201 _refreshIndexedDB() {
1200 this._model.refreshDatabaseNames(); 1202 this._model.refreshDatabase(this._databaseId);
1201 } 1203 }
1202 1204
1203 /** 1205 /**
1204 * @param {!Resources.IndexedDBModel.Database} database 1206 * @param {!Resources.IndexedDBModel.Database} database
1205 */ 1207 */
1206 update(database) { 1208 update(database) {
1207 this._database = database; 1209 this._database = database;
1208 var objectStoreNames = {}; 1210 var objectStoreNames = {};
1209 for (var objectStoreName in this._database.objectStores) { 1211 for (var objectStoreName in this._database.objectStores) {
1210 var objectStore = this._database.objectStores[objectStoreName]; 1212 var objectStore = this._database.objectStores[objectStoreName];
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
1641 1643
1642 this.element.classList.add('storage-view'); 1644 this.element.classList.add('storage-view');
1643 this._emptyWidget = new UI.EmptyWidget(''); 1645 this._emptyWidget = new UI.EmptyWidget('');
1644 this._emptyWidget.show(this.element); 1646 this._emptyWidget.show(this.element);
1645 } 1647 }
1646 1648
1647 setText(text) { 1649 setText(text) {
1648 this._emptyWidget.text = text; 1650 this._emptyWidget.text = text;
1649 } 1651 }
1650 }; 1652 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698