Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 16 matching lines...) Expand all Loading... | |
| 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} model |
| 37 * @param {!Resources.IndexedDBModel.Database} database | 37 * @param {?Resources.IndexedDBModel.Database} database |
| 38 */ | 38 */ |
| 39 constructor(model, database) { | 39 constructor(model, database) { |
| 40 super(); | 40 super(); |
| 41 | 41 |
| 42 this._model = model; | 42 this._model = model; |
| 43 | 43 |
| 44 this._reportView = new UI.ReportView(database.databaseId.name); | 44 var databaseName = Common.UIString('Loading\u2026'); // If database was not loaded yet when view was created |
|
dgozman
2017/06/06 21:32:26
- we usually avoid comments like this which repeat
kristipark
2017/06/06 22:45:47
Done.
| |
| 45 if (database) | |
| 46 databaseName = database.databaseId.name; | |
| 47 | |
| 48 this._reportView = new UI.ReportView(databaseName); | |
| 45 this._reportView.show(this.contentElement); | 49 this._reportView.show(this.contentElement); |
| 46 | 50 |
| 47 var bodySection = this._reportView.appendSection(''); | 51 var bodySection = this._reportView.appendSection(''); |
| 48 this._securityOriginElement = bodySection.appendField(Common.UIString('Secur ity origin')); | 52 this._securityOriginElement = bodySection.appendField(Common.UIString('Secur ity origin')); |
| 49 this._versionElement = bodySection.appendField(Common.UIString('Version')); | 53 this._versionElement = bodySection.appendField(Common.UIString('Version')); |
| 50 | 54 |
| 51 var footer = this._reportView.appendSection('').appendRow(); | 55 var footer = this._reportView.appendSection('').appendRow(); |
| 52 this._clearButton = UI.createTextButton( | 56 this._clearButton = UI.createTextButton( |
| 53 Common.UIString('Delete database'), () => this._deleteDatabase(), Common .UIString('Delete database')); | 57 Common.UIString('Delete database'), () => this._deleteDatabase(), Common .UIString('Delete database')); |
| 54 footer.appendChild(this._clearButton); | 58 footer.appendChild(this._clearButton); |
| 55 | 59 |
| 56 this._refreshButton = UI.createTextButton( | 60 this._refreshButton = UI.createTextButton( |
| 57 Common.UIString('Refresh database'), () => this._refreshDatabaseButtonCl icked(), | 61 Common.UIString('Refresh database'), () => this._refreshDatabaseButtonCl icked(), |
| 58 Common.UIString('Refresh database')); | 62 Common.UIString('Refresh database')); |
| 59 footer.appendChild(this._refreshButton); | 63 footer.appendChild(this._refreshButton); |
| 60 | 64 |
| 61 this.update(database); | 65 if (database) |
| 66 this.update(database); | |
| 62 } | 67 } |
| 63 | 68 |
| 64 _refreshDatabase() { | 69 _refreshDatabase() { |
| 65 this._securityOriginElement.textContent = this._database.databaseId.security Origin; | 70 this._securityOriginElement.textContent = this._database.databaseId.security Origin; |
| 66 this._versionElement.textContent = this._database.version; | 71 this._versionElement.textContent = this._database.version; |
| 67 } | 72 } |
| 68 | 73 |
| 69 _refreshDatabaseButtonClicked() { | 74 _refreshDatabaseButtonClicked() { |
| 70 this._model.refreshDatabase(this._database.databaseId); | 75 this._model.refreshDatabase(this._database.databaseId); |
| 71 } | 76 } |
| 72 | 77 |
| 73 /** | 78 /** |
| 74 * @param {!Resources.IndexedDBModel.Database} database | 79 * @param {!Resources.IndexedDBModel.Database} database |
| 75 */ | 80 */ |
| 76 update(database) { | 81 update(database) { |
| 77 this._database = database; | 82 this._database = database; |
| 83 this._reportView.setTitle(this._database.databaseId.name); | |
| 78 this._refreshDatabase(); | 84 this._refreshDatabase(); |
| 79 this._updatedForTests(); | 85 this._updatedForTests(); |
| 80 } | 86 } |
| 81 | 87 |
| 82 _updatedForTests() { | 88 _updatedForTests() { |
| 83 // Sniffed in tests. | 89 // Sniffed in tests. |
| 84 } | 90 } |
| 85 | 91 |
| 86 _deleteDatabase() { | 92 _deleteDatabase() { |
| 87 UI.ConfirmDialog.show( | 93 UI.ConfirmDialog.show( |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 384 cell.removeChildren(); | 390 cell.removeChildren(); |
| 385 var objectElement = ObjectUI.ObjectPropertiesSection.defaultObjectPresen tation(value, undefined, true); | 391 var objectElement = ObjectUI.ObjectPropertiesSection.defaultObjectPresen tation(value, undefined, true); |
| 386 cell.appendChild(objectElement); | 392 cell.appendChild(objectElement); |
| 387 break; | 393 break; |
| 388 default: | 394 default: |
| 389 } | 395 } |
| 390 | 396 |
| 391 return cell; | 397 return cell; |
| 392 } | 398 } |
| 393 }; | 399 }; |
| OLD | NEW |