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

Side by Side 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, 10 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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 15 matching lines...) Expand all
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 /** 31 /**
32 * @unrestricted 32 * @unrestricted
33 */ 33 */
34 Resources.IDBDatabaseView = class extends UI.VBox { 34 Resources.IDBDatabaseView = class extends UI.VBox {
35 /** 35 /**
36 * @param {!Resources.IndexedDBModel} model
36 * @param {!Resources.IndexedDBModel.Database} database 37 * @param {!Resources.IndexedDBModel.Database} database
37 */ 38 */
38 constructor(database) { 39 constructor(model, database) {
39 super(); 40 super();
40 this.registerRequiredCSS('resources/indexedDBViews.css');
41 41
42 this.element.classList.add('indexed-db-database-view'); 42 this._model = model;
43 this.element.classList.add('storage-view');
44 43
45 this._securityOriginElement = this.element.createChild('div', 'header-row'); 44 this._reportView = new UI.ReportView(database.databaseId.name);
46 this._nameElement = this.element.createChild('div', 'header-row'); 45 this._reportView.show(this.contentElement);
47 this._versionElement = this.element.createChild('div', 'header-row'); 46
47 var bodySection = this._reportView.appendSection('');
48 this._securityOriginElement = bodySection.appendField(Common.UIString('Secur ity origin'));
49 this._versionElement = bodySection.appendField(Common.UIString('Version'));
50
51 var footer = this._reportView.appendSection('').appendRow();
52 this._clearButton = UI.createTextButton(
53 Common.UIString('Delete database'), () => this._deleteDatabase(), Common .UIString('Delete database'));
54 footer.appendChild(this._clearButton);
48 55
49 this.update(database); 56 this.update(database);
50 } 57 }
51 58
52 /**
53 * @param {!Element} element
54 * @param {string} name
55 * @param {string} value
56 */
57 _formatHeader(element, name, value) {
58 element.removeChildren();
59 element.createChild('div', 'attribute-name').textContent = name + ':';
60 element.createChild('div', 'attribute-value source-code').textContent = valu e;
61 }
62
63 _refreshDatabase() { 59 _refreshDatabase() {
64 this._formatHeader( 60 this._securityOriginElement.textContent = this._database.databaseId.security Origin;
65 this._securityOriginElement, Common.UIString('Security origin'), this._d atabase.databaseId.securityOrigin); 61 this._versionElement.textContent = this._database.version;
66 this._formatHeader(this._nameElement, Common.UIString('Name'), this._databas e.databaseId.name);
67 this._formatHeader(this._versionElement, Common.UIString('Version'), this._d atabase.version);
68 } 62 }
69 63
70 /** 64 /**
71 * @param {!Resources.IndexedDBModel.Database} database 65 * @param {!Resources.IndexedDBModel.Database} database
72 */ 66 */
73 update(database) { 67 update(database) {
74 this._database = database; 68 this._database = database;
75 this._refreshDatabase(); 69 this._refreshDatabase();
76 } 70 }
71
72 _deleteDatabase() {
73 UI.ConfirmDialog.show(
74 Common.UIString('Are you sure you want to delete "%s"?', this._database. databaseId.name),
75 () => this._model.deleteDatabase(this._database.databaseId));
76 }
77 }; 77 };
78 78
79 /** 79 /**
80 * @unrestricted 80 * @unrestricted
81 */ 81 */
82 Resources.IDBDataView = class extends UI.SimpleView { 82 Resources.IDBDataView = class extends UI.SimpleView {
83 /** 83 /**
84 * @param {!Resources.IndexedDBModel} model 84 * @param {!Resources.IndexedDBModel} model
85 * @param {!Resources.IndexedDBModel.DatabaseId} databaseId 85 * @param {!Resources.IndexedDBModel.DatabaseId} databaseId
86 * @param {!Resources.IndexedDBModel.ObjectStore} objectStore 86 * @param {!Resources.IndexedDBModel.ObjectStore} objectStore
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 cell.removeChildren(); 364 cell.removeChildren();
365 var objectElement = Components.ObjectPropertiesSection.defaultObjectPres entation(value, undefined, true); 365 var objectElement = Components.ObjectPropertiesSection.defaultObjectPres entation(value, undefined, true);
366 cell.appendChild(objectElement); 366 cell.appendChild(objectElement);
367 break; 367 break;
368 default: 368 default:
369 } 369 }
370 370
371 return cell; 371 return cell;
372 } 372 }
373 }; 373 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698