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

Unified Diff: third_party/WebKit/Source/devtools/front_end/resources/IndexedDBViews.js

Issue 2654483004: [DevTools] Provide a way to delete Indexed DBs (Closed)
Patch Set: Moved the confirm dialog Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/resources/IndexedDBViews.js
diff --git a/third_party/WebKit/Source/devtools/front_end/resources/IndexedDBViews.js b/third_party/WebKit/Source/devtools/front_end/resources/IndexedDBViews.js
index 9c4c429f65a249c7ec3d7c57f848702110fcbb43..79978b4355831decdfd2a7d6595e628545b510df 100644
--- a/third_party/WebKit/Source/devtools/front_end/resources/IndexedDBViews.js
+++ b/third_party/WebKit/Source/devtools/front_end/resources/IndexedDBViews.js
@@ -33,38 +33,32 @@
*/
Resources.IDBDatabaseView = class extends UI.VBox {
/**
+ * @param {!Resources.IndexedDBModel} model
* @param {!Resources.IndexedDBModel.Database} database
*/
- constructor(database) {
+ constructor(model, database) {
super();
- this.registerRequiredCSS('resources/indexedDBViews.css');
- this.element.classList.add('indexed-db-database-view');
- this.element.classList.add('storage-view');
+ this._model = model;
- this._securityOriginElement = this.element.createChild('div', 'header-row');
- this._nameElement = this.element.createChild('div', 'header-row');
- this._versionElement = this.element.createChild('div', 'header-row');
+ this._reportView = new UI.ReportView(database.databaseId.name);
+ this._reportView.show(this.contentElement);
- this.update(database);
- }
+ var bodySection = this._reportView.appendSection('');
+ this._securityOriginElement = bodySection.appendField(Common.UIString('Security origin'));
+ this._versionElement = bodySection.appendField(Common.UIString('Version'));
- /**
- * @param {!Element} element
- * @param {string} name
- * @param {string} value
- */
- _formatHeader(element, name, value) {
- element.removeChildren();
- element.createChild('div', 'attribute-name').textContent = name + ':';
- element.createChild('div', 'attribute-value source-code').textContent = value;
+ var footer = this._reportView.appendSection('').appendRow();
+ this._clearButton = UI.createTextButton(
+ Common.UIString('Delete database'), () => this._deleteDatabase(), Common.UIString('Delete database'));
+ footer.appendChild(this._clearButton);
+
+ this.update(database);
}
_refreshDatabase() {
- this._formatHeader(
- this._securityOriginElement, Common.UIString('Security origin'), this._database.databaseId.securityOrigin);
- this._formatHeader(this._nameElement, Common.UIString('Name'), this._database.databaseId.name);
- this._formatHeader(this._versionElement, Common.UIString('Version'), this._database.version);
+ this._securityOriginElement.textContent = this._database.databaseId.securityOrigin;
+ this._versionElement.textContent = this._database.version;
}
/**
@@ -74,6 +68,12 @@ Resources.IDBDatabaseView = class extends UI.VBox {
this._database = database;
this._refreshDatabase();
}
+
+ _deleteDatabase() {
+ UI.ConfirmDialog.show(
+ Common.UIString('Are you sure you want to delete "%s"?', this._database.databaseId.name),
+ () => this._model.deleteDatabase(this._database.databaseId));
+ }
};
/**

Powered by Google App Engine
This is Rietveld 408576698