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 23 matching lines...) Expand all Loading... | |
| 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 = 'Loading...'; // If database was not loaded yet when vie w was created |
|
dgozman
2017/06/02 21:48:41
We wrap any user-readable strings with Common.UISt
kristipark
2017/06/03 01:42:44
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); |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 67 } | 71 } |
| 68 | 72 |
| 69 _refreshDatabaseButtonClicked() { | 73 _refreshDatabaseButtonClicked() { |
| 70 this._model.refreshDatabase(this._database.databaseId); | 74 this._model.refreshDatabase(this._database.databaseId); |
| 71 } | 75 } |
| 72 | 76 |
| 73 /** | 77 /** |
| 74 * @param {!Resources.IndexedDBModel.Database} database | 78 * @param {!Resources.IndexedDBModel.Database} database |
| 75 */ | 79 */ |
| 76 update(database) { | 80 update(database) { |
| 77 this._database = database; | 81 if (database) { |
|
dgozman
2017/06/02 21:48:41
The database is marked as non-null in line 78. How
kristipark
2017/06/03 01:42:44
The constructor calls update with a null database
| |
| 78 this._refreshDatabase(); | 82 this._database = database; |
| 83 this._reportView.setTitle(this._database.databaseId.name); | |
| 84 this._refreshDatabase(); | |
| 85 } | |
| 79 this._updatedForTests(); | 86 this._updatedForTests(); |
| 80 } | 87 } |
| 81 | 88 |
| 82 _updatedForTests() { | 89 _updatedForTests() { |
| 83 // Sniffed in tests. | 90 // Sniffed in tests. |
| 84 } | 91 } |
| 85 | 92 |
| 86 _deleteDatabase() { | 93 _deleteDatabase() { |
| 87 UI.ConfirmDialog.show( | 94 UI.ConfirmDialog.show( |
| 88 this.element, Common.UIString('Are you sure you want to delete "%s"?', t his._database.databaseId.name), | 95 this.element, Common.UIString('Are you sure you want to delete "%s"?', t his._database.databaseId.name), |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 384 cell.removeChildren(); | 391 cell.removeChildren(); |
| 385 var objectElement = ObjectUI.ObjectPropertiesSection.defaultObjectPresen tation(value, undefined, true); | 392 var objectElement = ObjectUI.ObjectPropertiesSection.defaultObjectPresen tation(value, undefined, true); |
| 386 cell.appendChild(objectElement); | 393 cell.appendChild(objectElement); |
| 387 break; | 394 break; |
| 388 default: | 395 default: |
| 389 } | 396 } |
| 390 | 397 |
| 391 return cell; | 398 return cell; |
| 392 } | 399 } |
| 393 }; | 400 }; |
| OLD | NEW |