Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org> | 3 * Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org> |
| 4 * Copyright (C) 2011 Google Inc. All rights reserved. | 4 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * | 9 * |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 101 this._updateUI(); | 101 this._updateUI(); |
| 102 | 102 |
| 103 SDK.targetManager.addModelListener( | 103 SDK.targetManager.addModelListener( |
| 104 SDK.ResourceTreeModel, SDK.ResourceTreeModel.Events.WillReloadPage, this ._willReloadPage, this); | 104 SDK.ResourceTreeModel, SDK.ResourceTreeModel.Events.WillReloadPage, this ._willReloadPage, this); |
| 105 SDK.targetManager.addModelListener(SDK.ResourceTreeModel, SDK.ResourceTreeMo del.Events.Load, this._load, this); | 105 SDK.targetManager.addModelListener(SDK.ResourceTreeModel, SDK.ResourceTreeMo del.Events.Load, this._load, this); |
| 106 this._networkLogView.addEventListener(Network.NetworkLogView.Events.RequestS elected, this._onRequestSelected, this); | 106 this._networkLogView.addEventListener(Network.NetworkLogView.Events.RequestS elected, this._onRequestSelected, this); |
| 107 this._networkLogView.addEventListener( | 107 this._networkLogView.addEventListener( |
| 108 Network.NetworkLogView.Events.SearchCountUpdated, this._onSearchCountUpd ated, this); | 108 Network.NetworkLogView.Events.SearchCountUpdated, this._onSearchCountUpd ated, this); |
| 109 this._networkLogView.addEventListener( | 109 this._networkLogView.addEventListener( |
| 110 Network.NetworkLogView.Events.SearchIndexUpdated, this._onSearchIndexUpd ated, this); | 110 Network.NetworkLogView.Events.SearchIndexUpdated, this._onSearchIndexUpd ated, this); |
| 111 this._networkLogView.addEventListener(Network.NetworkLogView.Events.UpdateRe quest, this._onUpdateRequest, this); | 111 NetworkLog.networkLog.addEventListener(NetworkLog.NetworkLog.Events.RequestU pdated, this._onUpdateRequest, this); |
| 112 NetworkLog.networkLog.addEventListener(NetworkLog.NetworkLog.Events.Reset, t his._onNetworkLogReset, this); | |
| 113 | |
| 112 | 114 |
| 113 Components.DataSaverInfobar.maybeShowInPanel(this); | 115 Components.DataSaverInfobar.maybeShowInPanel(this); |
| 114 } | 116 } |
| 115 | 117 |
| 116 /** | 118 /** |
| 117 * @param {!Array<{filterType: !Network.NetworkLogView.FilterType, filterValue : string}>} filters | 119 * @param {!Array<{filterType: !Network.NetworkLogView.FilterType, filterValue : string}>} filters |
| 118 */ | 120 */ |
| 119 static revealAndFilter(filters) { | 121 static revealAndFilter(filters) { |
| 120 var panel = Network.NetworkPanel._instance(); | 122 var panel = Network.NetworkPanel._instance(); |
| 121 var filterString = ''; | 123 var filterString = ''; |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 138 _onWindowChanged(event) { | 140 _onWindowChanged(event) { |
| 139 var startTime = Math.max(this._calculator.minimumBoundary(), event.data.star tTime / 1000); | 141 var startTime = Math.max(this._calculator.minimumBoundary(), event.data.star tTime / 1000); |
| 140 var endTime = Math.min(this._calculator.maximumBoundary(), event.data.endTim e / 1000); | 142 var endTime = Math.min(this._calculator.maximumBoundary(), event.data.endTim e / 1000); |
| 141 this._networkLogView.setWindow(startTime, endTime); | 143 this._networkLogView.setWindow(startTime, endTime); |
| 142 } | 144 } |
| 143 | 145 |
| 144 _createToolbarButtons() { | 146 _createToolbarButtons() { |
| 145 this._panelToolbar.appendToolbarItem(UI.Toolbar.createActionButton(this._tog gleRecordAction)); | 147 this._panelToolbar.appendToolbarItem(UI.Toolbar.createActionButton(this._tog gleRecordAction)); |
| 146 | 148 |
| 147 this._clearButton = new UI.ToolbarButton(Common.UIString('Clear'), 'largeico n-clear'); | 149 this._clearButton = new UI.ToolbarButton(Common.UIString('Clear'), 'largeico n-clear'); |
| 148 this._clearButton.addEventListener(UI.ToolbarButton.Events.Click, this._onCl earButtonClicked, this); | 150 this._clearButton.addEventListener(UI.ToolbarButton.Events.Click, () => Netw orkLog.networkLog.reset()); |
| 149 this._panelToolbar.appendToolbarItem(this._clearButton); | 151 this._panelToolbar.appendToolbarItem(this._clearButton); |
| 150 this._panelToolbar.appendSeparator(); | 152 this._panelToolbar.appendSeparator(); |
| 151 var recordFilmStripButton = new UI.ToolbarSettingToggle( | 153 var recordFilmStripButton = new UI.ToolbarSettingToggle( |
| 152 this._networkRecordFilmStripSetting, 'largeicon-camera', Common.UIString ('Capture screenshots')); | 154 this._networkRecordFilmStripSetting, 'largeicon-camera', Common.UIString ('Capture screenshots')); |
| 153 this._panelToolbar.appendToolbarItem(recordFilmStripButton); | 155 this._panelToolbar.appendToolbarItem(recordFilmStripButton); |
| 154 | 156 |
| 155 this._panelToolbar.appendToolbarItem(this._filterBar.filterButton()); | 157 this._panelToolbar.appendToolbarItem(this._filterBar.filterButton()); |
| 156 this._panelToolbar.appendSeparator(); | 158 this._panelToolbar.appendSeparator(); |
| 157 | 159 |
| 158 this._panelToolbar.appendText(Common.UIString('View:')); | 160 this._panelToolbar.appendText(Common.UIString('View:')); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 195 */ | 197 */ |
| 196 _createNetworkConditionsSelect() { | 198 _createNetworkConditionsSelect() { |
| 197 var toolbarItem = new UI.ToolbarComboBox(null); | 199 var toolbarItem = new UI.ToolbarComboBox(null); |
| 198 toolbarItem.setMaxWidth(140); | 200 toolbarItem.setMaxWidth(140); |
| 199 NetworkConditions.NetworkConditionsSelector.decorateSelect(toolbarItem.selec tElement()); | 201 NetworkConditions.NetworkConditionsSelector.decorateSelect(toolbarItem.selec tElement()); |
| 200 return toolbarItem; | 202 return toolbarItem; |
| 201 } | 203 } |
| 202 | 204 |
| 203 _toggleRecording() { | 205 _toggleRecording() { |
| 204 if (!this._preserveLogSetting.get() && !this._toggleRecordAction.toggled()) | 206 if (!this._preserveLogSetting.get() && !this._toggleRecordAction.toggled()) |
| 205 this._reset(); | 207 NetworkLog.networkLog.reset(); |
| 206 this._toggleRecord(!this._toggleRecordAction.toggled()); | 208 this._toggleRecord(!this._toggleRecordAction.toggled()); |
| 207 } | 209 } |
| 208 | 210 |
| 209 /** | 211 /** |
| 210 * @param {boolean} toggled | 212 * @param {boolean} toggled |
| 211 */ | 213 */ |
| 212 _toggleRecord(toggled) { | 214 _toggleRecord(toggled) { |
| 213 this._toggleRecordAction.setToggled(toggled); | 215 this._toggleRecordAction.setToggled(toggled); |
| 214 this._networkLogView.setRecording(toggled); | 216 this._networkLogView.setRecording(toggled); |
| 215 if (!toggled && this._filmStripRecorder) | 217 if (!toggled && this._filmStripRecorder) |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 231 * @param {!SDK.FilmStripModel.Frame} frame | 233 * @param {!SDK.FilmStripModel.Frame} frame |
| 232 * @return {number} | 234 * @return {number} |
| 233 */ | 235 */ |
| 234 function mapTimestamp(frame) { | 236 function mapTimestamp(frame) { |
| 235 return frame.timestamp / 1000; | 237 return frame.timestamp / 1000; |
| 236 } | 238 } |
| 237 | 239 |
| 238 this._networkLogView.addFilmStripFrames(timestamps); | 240 this._networkLogView.addFilmStripFrames(timestamps); |
| 239 } | 241 } |
| 240 | 242 |
| 241 /** | 243 _onNetworkLogReset() { |
| 242 * @param {!Common.Event} event | |
| 243 */ | |
| 244 _onClearButtonClicked(event) { | |
| 245 this._reset(); | |
| 246 } | |
| 247 | |
| 248 _reset() { | |
| 249 this._calculator.reset(); | 244 this._calculator.reset(); |
| 250 this._overviewPane.reset(); | 245 this._overviewPane.reset(); |
| 251 this._networkLogView.reset(); | |
| 252 Network.BlockedURLsPane.reset(); | 246 Network.BlockedURLsPane.reset(); |
| 253 if (this._filmStripView) | 247 if (this._filmStripView) |
| 254 this._resetFilmStripView(); | 248 this._resetFilmStripView(); |
| 255 } | 249 } |
| 256 | 250 |
| 257 /** | 251 /** |
| 258 * @param {!Common.Event} event | 252 * @param {!Common.Event} event |
| 259 */ | 253 */ |
| 260 _willReloadPage(event) { | 254 _willReloadPage(event) { |
| 261 if (!this._preserveLogSetting.get()) | |
| 262 this._reset(); | |
|
dgozman
2017/06/01 20:56:28
Where did this go?
allada
2017/06/02 01:02:43
It's in NetworkLog now and _onNetworkLogReset gets
| |
| 263 this._toggleRecord(true); | 255 this._toggleRecord(true); |
| 264 if (this._pendingStopTimer) { | 256 if (this._pendingStopTimer) { |
| 265 clearTimeout(this._pendingStopTimer); | 257 clearTimeout(this._pendingStopTimer); |
| 266 delete this._pendingStopTimer; | 258 delete this._pendingStopTimer; |
| 267 } | 259 } |
| 268 if (this.isShowing() && this._filmStripRecorder) | 260 if (this.isShowing() && this._filmStripRecorder) |
| 269 this._filmStripRecorder.startRecording(); | 261 this._filmStripRecorder.startRecording(); |
| 270 } | 262 } |
| 271 | 263 |
| 272 /** | 264 /** |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 711 * @param {string} actionId | 703 * @param {string} actionId |
| 712 * @return {boolean} | 704 * @return {boolean} |
| 713 */ | 705 */ |
| 714 handleAction(context, actionId) { | 706 handleAction(context, actionId) { |
| 715 var panel = UI.context.flavor(Network.NetworkPanel); | 707 var panel = UI.context.flavor(Network.NetworkPanel); |
| 716 console.assert(panel && panel instanceof Network.NetworkPanel); | 708 console.assert(panel && panel instanceof Network.NetworkPanel); |
| 717 panel._toggleRecording(); | 709 panel._toggleRecording(); |
| 718 return true; | 710 return true; |
| 719 } | 711 } |
| 720 }; | 712 }; |
| OLD | NEW |