| 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 /** | 5 /** |
| 6 * @constructor | 6 * @constructor |
| 7 * @extends {WebInspector.VBox} | 7 * @extends {WebInspector.VBox} |
| 8 * @param {!WebInspector.ServiceWorkerCacheModel} model | 8 * @param {!WebInspector.ServiceWorkerCacheModel} model |
| 9 * @param {!WebInspector.ServiceWorkerCacheModel.Cache} cache | 9 * @param {!WebInspector.ServiceWorkerCacheModel.Cache} cache |
| 10 */ | 10 */ |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 _updateDataCallback(skipCount, entries, hasMore) | 105 _updateDataCallback(skipCount, entries, hasMore) |
| 106 { | 106 { |
| 107 this._refreshButton.setEnabled(true); | 107 this._refreshButton.setEnabled(true); |
| 108 this.clear(); | 108 this.clear(); |
| 109 this._entries = entries; | 109 this._entries = entries; |
| 110 for (var i = 0; i < entries.length; ++i) { | 110 for (var i = 0; i < entries.length; ++i) { |
| 111 var data = {}; | 111 var data = {}; |
| 112 data["number"] = i + skipCount; | 112 data["number"] = i + skipCount; |
| 113 data["request"] = entries[i].request; | 113 data["request"] = entries[i].request; |
| 114 data["response"] = entries[i].response; | 114 data["response"] = entries[i].response; |
| 115 var node = new WebInspector.SWCacheDataGridNode(data); | 115 var node = new WebInspector.DataGridNode(data); |
| 116 node.selectable = true; |
| 116 this._dataGrid.rootNode().appendChild(node); | 117 this._dataGrid.rootNode().appendChild(node); |
| 117 } | 118 } |
| 118 this._pageBackButton.setEnabled(!!skipCount); | 119 this._pageBackButton.setEnabled(!!skipCount); |
| 119 this._pageForwardButton.setEnabled(hasMore); | 120 this._pageForwardButton.setEnabled(hasMore); |
| 120 }, | 121 }, |
| 121 | 122 |
| 122 /** | 123 /** |
| 123 * @param {boolean} force | 124 * @param {boolean} force |
| 124 */ | 125 */ |
| 125 _updateData: function(force) | 126 _updateData: function(force) |
| (...skipping 28 matching lines...) Expand all Loading... |
| 154 }, | 155 }, |
| 155 | 156 |
| 156 clear: function() | 157 clear: function() |
| 157 { | 158 { |
| 158 this._dataGrid.rootNode().removeChildren(); | 159 this._dataGrid.rootNode().removeChildren(); |
| 159 this._entries = []; | 160 this._entries = []; |
| 160 }, | 161 }, |
| 161 | 162 |
| 162 __proto__: WebInspector.VBox.prototype | 163 __proto__: WebInspector.VBox.prototype |
| 163 } | 164 } |
| 164 | |
| 165 /** | |
| 166 * @constructor | |
| 167 * @extends {WebInspector.DataGridNode} | |
| 168 * @param {!Object.<string, *>} data | |
| 169 */ | |
| 170 WebInspector.SWCacheDataGridNode = function(data) | |
| 171 { | |
| 172 WebInspector.DataGridNode.call(this, data, false); | |
| 173 this.selectable = true; | |
| 174 } | |
| 175 | |
| 176 WebInspector.SWCacheDataGridNode.prototype = { | |
| 177 /** | |
| 178 * @override | |
| 179 * @return {!Element} | |
| 180 */ | |
| 181 createCell: function(columnIdentifier) | |
| 182 { | |
| 183 var cell = WebInspector.DataGridNode.prototype.createCell.call(this, col
umnIdentifier); | |
| 184 var value = this.data[columnIdentifier]; | |
| 185 | |
| 186 switch (columnIdentifier) { | |
| 187 case "request": | |
| 188 case "response": | |
| 189 cell.removeChildren(); | |
| 190 var objectElement = WebInspector.ObjectPropertiesSection.defaultObje
ctPresentation(value, true); | |
| 191 cell.appendChild(objectElement); | |
| 192 break; | |
| 193 default: | |
| 194 } | |
| 195 | |
| 196 return cell; | |
| 197 }, | |
| 198 | |
| 199 __proto__: WebInspector.DataGridNode.prototype | |
| 200 } | |
| OLD | NEW |