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

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: 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.registerRequiredCSS('resources/indexedDBViews.css');
pfeldman 2017/01/24 23:14:21 You should not be mixing alien styles into report
eostroukhov 2017/01/25 19:56:35 Turns out, there's no need for custom styling - re
47 this._versionElement = this.element.createChild('div', 'header-row'); 46 this._reportView.show(this.contentElement);
47
48 var bodySection = this._reportView.appendSection('');
49
50 this._securityOriginElement = bodySection.appendRow();
51 this._versionElement = bodySection.appendRow();
52
53 var footer = this._reportView.appendSection('').appendRow();
54 this._clearButton = UI.createTextButton(
pfeldman 2017/01/24 23:14:21 This looks more like a UI.List control to me, but
eostroukhov 2017/01/25 19:56:35 Acknowledged.
55 Common.UIString('Delete database'), () => this._deleteDatabase(), Common .UIString('Delete database'));
56 footer.appendChild(this._clearButton);
48 57
49 this.update(database); 58 this.update(database);
50 } 59 }
51 60
52 /** 61 /**
53 * @param {!Element} element 62 * @param {!Element} element
54 * @param {string} name 63 * @param {string} name
55 * @param {string} value 64 * @param {string} value
56 */ 65 */
57 _formatHeader(element, name, value) { 66 _formatHeader(element, name, value) {
58 element.removeChildren(); 67 element.removeChildren();
59 element.createChild('div', 'attribute-name').textContent = name + ':'; 68 element.createChild('div', 'attribute-name').textContent = name + ':';
60 element.createChild('div', 'attribute-value source-code').textContent = valu e; 69 element.createChild('div', 'attribute-value source-code').textContent = valu e;
61 } 70 }
62 71
63 _refreshDatabase() { 72 _refreshDatabase() {
64 this._formatHeader( 73 this._formatHeader(
65 this._securityOriginElement, Common.UIString('Security origin'), this._d atabase.databaseId.securityOrigin); 74 this._securityOriginElement, Common.UIString('Security origin'), this._d atabase.databaseId.securityOrigin);
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); 75 this._formatHeader(this._versionElement, Common.UIString('Version'), this._d atabase.version);
68 } 76 }
69 77
70 /** 78 /**
71 * @param {!Resources.IndexedDBModel.Database} database 79 * @param {!Resources.IndexedDBModel.Database} database
72 */ 80 */
73 update(database) { 81 update(database) {
74 this._database = database; 82 this._database = database;
75 this._refreshDatabase(); 83 this._refreshDatabase();
76 } 84 }
85
86 _deleteDatabase() {
87 if (confirm(Common.UIString(
pfeldman 2017/01/24 23:14:21 Don't use native confirm, use software dialog inst
eostroukhov 2017/01/25 19:56:35 Done.
88 'Are you sure you want to delete IndexedDB database "%s"?', this._da tabase.databaseId.name)))
89 this._model.deleteDatabase(this._database.databaseId);
90 }
77 }; 91 };
78 92
79 /** 93 /**
80 * @unrestricted 94 * @unrestricted
81 */ 95 */
82 Resources.IDBDataView = class extends UI.SimpleView { 96 Resources.IDBDataView = class extends UI.SimpleView {
83 /** 97 /**
84 * @param {!Resources.IndexedDBModel} model 98 * @param {!Resources.IndexedDBModel} model
85 * @param {!Resources.IndexedDBModel.DatabaseId} databaseId 99 * @param {!Resources.IndexedDBModel.DatabaseId} databaseId
86 * @param {!Resources.IndexedDBModel.ObjectStore} objectStore 100 * @param {!Resources.IndexedDBModel.ObjectStore} objectStore
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 cell.removeChildren(); 378 cell.removeChildren();
365 var objectElement = Components.ObjectPropertiesSection.defaultObjectPres entation(value, undefined, true); 379 var objectElement = Components.ObjectPropertiesSection.defaultObjectPres entation(value, undefined, true);
366 cell.appendChild(objectElement); 380 cell.appendChild(objectElement);
367 break; 381 break;
368 default: 382 default:
369 } 383 }
370 384
371 return cell; 385 return cell;
372 } 386 }
373 }; 387 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698