| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 /** | 4 /** |
| 5 * @unrestricted | 5 * @unrestricted |
| 6 */ | 6 */ |
| 7 Resources.ServiceWorkerCacheView = class extends UI.SimpleView { | 7 Resources.ServiceWorkerCacheView = class extends UI.SimpleView { |
| 8 /** | 8 /** |
| 9 * @param {!SDK.ServiceWorkerCacheModel} model | 9 * @param {!SDK.ServiceWorkerCacheModel} model |
| 10 * @param {!SDK.ServiceWorkerCacheModel.Cache} cache | 10 * @param {!SDK.ServiceWorkerCacheModel.Cache} cache |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 this.update(cache); | 29 this.update(cache); |
| 30 this._entries = []; | 30 this._entries = []; |
| 31 } | 31 } |
| 32 | 32 |
| 33 /** | 33 /** |
| 34 * @return {!DataGrid.DataGrid} | 34 * @return {!DataGrid.DataGrid} |
| 35 */ | 35 */ |
| 36 _createDataGrid() { | 36 _createDataGrid() { |
| 37 var columns = /** @type {!Array<!DataGrid.DataGrid.ColumnDescriptor>} */ ([ | 37 var columns = /** @type {!Array<!DataGrid.DataGrid.ColumnDescriptor>} */ ([ |
| 38 {id: 'number', title: Common.UIString('#'), width: '50px'}, {id: 'request'
, title: Common.UIString('Request')}, | 38 {id: 'number', title: Common.UIString('#'), width: '50px'}, {id: 'request'
, title: Common.UIString('Request')}, |
| 39 {id: 'response', title: Common.UIString('Response')} | 39 {id: 'response', title: Common.UIString('Response')}, |
| 40 {id: 'responseTime', title: Common.UIString('Time Cached')} |
| 40 ]); | 41 ]); |
| 41 var dataGrid = new DataGrid.DataGrid( | 42 var dataGrid = new DataGrid.DataGrid( |
| 42 columns, undefined, this._deleteButtonClicked.bind(this), this._updateDa
ta.bind(this, true)); | 43 columns, undefined, this._deleteButtonClicked.bind(this), this._updateDa
ta.bind(this, true)); |
| 43 dataGrid.setStriped(true); | 44 dataGrid.setStriped(true); |
| 44 return dataGrid; | 45 return dataGrid; |
| 45 } | 46 } |
| 46 | 47 |
| 47 _createEditorToolbar() { | 48 _createEditorToolbar() { |
| 48 var editorToolbar = new UI.Toolbar('data-view-toolbar', this.element); | 49 var editorToolbar = new UI.Toolbar('data-view-toolbar', this.element); |
| 49 | 50 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 */ | 104 */ |
| 104 _updateDataCallback(skipCount, entries, hasMore) { | 105 _updateDataCallback(skipCount, entries, hasMore) { |
| 105 this._refreshButton.setEnabled(true); | 106 this._refreshButton.setEnabled(true); |
| 106 this.clear(); | 107 this.clear(); |
| 107 this._entries = entries; | 108 this._entries = entries; |
| 108 for (var i = 0; i < entries.length; ++i) { | 109 for (var i = 0; i < entries.length; ++i) { |
| 109 var data = {}; | 110 var data = {}; |
| 110 data['number'] = i + skipCount; | 111 data['number'] = i + skipCount; |
| 111 data['request'] = entries[i].request; | 112 data['request'] = entries[i].request; |
| 112 data['response'] = entries[i].response; | 113 data['response'] = entries[i].response; |
| 114 data['responseTime'] = entries[i].responseTime; |
| 113 var node = new DataGrid.DataGridNode(data); | 115 var node = new DataGrid.DataGridNode(data); |
| 114 node.selectable = true; | 116 node.selectable = true; |
| 115 this._dataGrid.rootNode().appendChild(node); | 117 this._dataGrid.rootNode().appendChild(node); |
| 116 } | 118 } |
| 117 this._pageBackButton.setEnabled(!!skipCount); | 119 this._pageBackButton.setEnabled(!!skipCount); |
| 118 this._pageForwardButton.setEnabled(hasMore); | 120 this._pageForwardButton.setEnabled(hasMore); |
| 119 } | 121 } |
| 120 | 122 |
| 121 /** | 123 /** |
| 122 * @param {boolean} force | 124 * @param {boolean} force |
| (...skipping 28 matching lines...) Expand all Loading... |
| 151 */ | 153 */ |
| 152 syncToolbarItems() { | 154 syncToolbarItems() { |
| 153 return [this._refreshButton]; | 155 return [this._refreshButton]; |
| 154 } | 156 } |
| 155 | 157 |
| 156 clear() { | 158 clear() { |
| 157 this._dataGrid.rootNode().removeChildren(); | 159 this._dataGrid.rootNode().removeChildren(); |
| 158 this._entries = []; | 160 this._entries = []; |
| 159 } | 161 } |
| 160 }; | 162 }; |
| OLD | NEW |