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 22 matching lines...) Expand all Loading... |
33 * @unrestricted | 33 * @unrestricted |
34 */ | 34 */ |
35 Network.NetworkPanel = class extends UI.Panel { | 35 Network.NetworkPanel = class extends UI.Panel { |
36 constructor() { | 36 constructor() { |
37 super('network'); | 37 super('network'); |
38 this.registerRequiredCSS('network/networkPanel.css'); | 38 this.registerRequiredCSS('network/networkPanel.css'); |
39 | 39 |
40 this._networkLogShowOverviewSetting = Common.settings.createSetting('network
LogShowOverview', true); | 40 this._networkLogShowOverviewSetting = Common.settings.createSetting('network
LogShowOverview', true); |
41 this._networkLogLargeRowsSetting = Common.settings.createSetting('networkLog
LargeRows', false); | 41 this._networkLogLargeRowsSetting = Common.settings.createSetting('networkLog
LargeRows', false); |
42 this._networkRecordFilmStripSetting = Common.settings.createSetting('network
RecordFilmStripSetting', false); | 42 this._networkRecordFilmStripSetting = Common.settings.createSetting('network
RecordFilmStripSetting', false); |
43 this._toggleRecordAction = | 43 this._toggleRecordAction = /** @type {!UI.Action }*/ (UI.actionRegistry.acti
on('network.toggle-recording')); |
44 /** @type {!UI.Action }*/ (UI.actionRegistry.action('network.toggle-reco
rding')); | |
45 | 44 |
46 /** @type {?PerfUI.FilmStripView} */ | 45 /** @type {?PerfUI.FilmStripView} */ |
47 this._filmStripView = null; | 46 this._filmStripView = null; |
48 /** @type {?Network.NetworkPanel.FilmStripRecorder} */ | 47 /** @type {?Network.NetworkPanel.FilmStripRecorder} */ |
49 this._filmStripRecorder = null; | 48 this._filmStripRecorder = null; |
50 | 49 |
51 this._panelToolbar = new UI.Toolbar('', this.element); | 50 this._panelToolbar = new UI.Toolbar('', this.element); |
52 this._filterBar = new UI.FilterBar('networkPanel', true); | 51 this._filterBar = new UI.FilterBar('networkPanel', true); |
53 this._filterBar.show(this.element); | 52 this._filterBar.show(this.element); |
54 | 53 |
(...skipping 27 matching lines...) Expand all Loading... |
82 this._detailsWidget.element.classList.add('network-details-view'); | 81 this._detailsWidget.element.classList.add('network-details-view'); |
83 this._splitWidget.setMainWidget(this._detailsWidget); | 82 this._splitWidget.setMainWidget(this._detailsWidget); |
84 | 83 |
85 this._closeButtonElement = createElement('div', 'dt-close-button'); | 84 this._closeButtonElement = createElement('div', 'dt-close-button'); |
86 this._closeButtonElement.addEventListener('click', this._showRequest.bind(th
is, null), false); | 85 this._closeButtonElement.addEventListener('click', this._showRequest.bind(th
is, null), false); |
87 | 86 |
88 this._networkLogShowOverviewSetting.addChangeListener(this._toggleShowOvervi
ew, this); | 87 this._networkLogShowOverviewSetting.addChangeListener(this._toggleShowOvervi
ew, this); |
89 this._networkLogLargeRowsSetting.addChangeListener(this._toggleLargerRequest
s, this); | 88 this._networkLogLargeRowsSetting.addChangeListener(this._toggleLargerRequest
s, this); |
90 this._networkRecordFilmStripSetting.addChangeListener(this._toggleRecordFilm
Strip, this); | 89 this._networkRecordFilmStripSetting.addChangeListener(this._toggleRecordFilm
Strip, this); |
91 | 90 |
92 /** @type {!Map<string, !Runtime.Extension>} */ | |
93 this._groupingExtensions = new Map(); | |
94 this._createToolbarButtons(); | 91 this._createToolbarButtons(); |
95 | 92 |
96 this._toggleRecord(true); | 93 this._toggleRecord(true); |
97 this._toggleShowOverview(); | 94 this._toggleShowOverview(); |
98 this._toggleLargerRequests(); | 95 this._toggleLargerRequests(); |
99 this._toggleRecordFilmStrip(); | 96 this._toggleRecordFilmStrip(); |
100 this._updateUI(); | 97 this._updateUI(); |
101 | 98 |
102 SDK.targetManager.addModelListener( | 99 SDK.targetManager.addModelListener( |
103 SDK.ResourceTreeModel, SDK.ResourceTreeModel.Events.WillReloadPage, this
._willReloadPage, this); | 100 SDK.ResourceTreeModel, SDK.ResourceTreeModel.Events.WillReloadPage, this
._willReloadPage, this); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 this._panelToolbar.appendSeparator(); | 178 this._panelToolbar.appendSeparator(); |
182 this._panelToolbar.appendToolbarItem(NetworkConditions.NetworkConditionsSele
ctor.createOfflineToolbarCheckbox()); | 179 this._panelToolbar.appendToolbarItem(NetworkConditions.NetworkConditionsSele
ctor.createOfflineToolbarCheckbox()); |
183 this._panelToolbar.appendToolbarItem(this._createNetworkConditionsSelect()); | 180 this._panelToolbar.appendToolbarItem(this._createNetworkConditionsSelect()); |
184 | 181 |
185 this._setupGroupingCombo(); | 182 this._setupGroupingCombo(); |
186 | 183 |
187 this._panelToolbar.appendToolbarItem(new UI.ToolbarItem(this._progressBarCon
tainer)); | 184 this._panelToolbar.appendToolbarItem(new UI.ToolbarItem(this._progressBarCon
tainer)); |
188 } | 185 } |
189 | 186 |
190 _setupGroupingCombo() { | 187 _setupGroupingCombo() { |
191 var extensions = self.runtime.extensions(Network.NetworkGroupLookupInterface
); | 188 if (!Runtime.experiments.isEnabled('networkGroupingRequests')) |
192 if (!extensions.length) | |
193 return; | 189 return; |
| 190 /** @type {!Array<!{value: string, label: string, title: string}>} */ |
| 191 var options = [{value: '', label: Common.UIString('No grouping'), title: Com
mon.UIString('No grouping')}]; |
| 192 for (var name of this._networkLogView.groupLookups().keys()) |
| 193 options.push({value: name, label: Common.UIString(name), title: Common.UIS
tring(name)}); |
194 | 194 |
195 var setting = Common.settings.createSetting('networkGrouping', ''); | 195 var setting = Common.settings.createSetting('networkGrouping', ''); |
196 /** @type {!Array<!{value: string, label: string, title: string}>} */ | |
197 var options = [{value: '', label: Common.UIString('No grouping'), title: Com
mon.UIString('No grouping')}]; | |
198 | |
199 extensions.forEach(extension => { | |
200 var identifier = extension.descriptor()['id']; | |
201 this._groupingExtensions.set(identifier, extension); | |
202 options.push({value: identifier, label: extension.title(), title: extensio
n.title()}); | |
203 }); | |
204 this._panelToolbar.appendToolbarItem(new UI.ToolbarSettingComboBox(options,
setting, Common.UIString('Group by'))); | 196 this._panelToolbar.appendToolbarItem(new UI.ToolbarSettingComboBox(options,
setting, Common.UIString('Group by'))); |
205 setting.addChangeListener(event => this._groupingChanged(/** @type {string}
*/ (event.data))); | 197 setting.addChangeListener(event => this._networkLogView.setGrouping(/** @typ
e {string} */ (event.data))); |
206 this._groupingChanged(setting.get()); | |
207 } | 198 } |
208 | 199 |
209 /** | 200 /** |
210 * @param {string} identifier | |
211 */ | |
212 _groupingChanged(identifier) { | |
213 var extension = this._groupingExtensions.get(identifier); | |
214 if (extension) { | |
215 extension.instance().then( | |
216 grouping => this._networkLogView.setGrouping(/** @type {?Network.Netwo
rkGroupLookupInterface} */ (grouping))); | |
217 } else { | |
218 this._networkLogView.setGrouping(null); | |
219 } | |
220 } | |
221 | |
222 /** | |
223 * @return {!UI.ToolbarComboBox} | 201 * @return {!UI.ToolbarComboBox} |
224 */ | 202 */ |
225 _createNetworkConditionsSelect() { | 203 _createNetworkConditionsSelect() { |
226 var toolbarItem = new UI.ToolbarComboBox(null); | 204 var toolbarItem = new UI.ToolbarComboBox(null); |
227 toolbarItem.setMaxWidth(140); | 205 toolbarItem.setMaxWidth(140); |
228 NetworkConditions.NetworkConditionsSelector.decorateSelect(toolbarItem.selec
tElement()); | 206 NetworkConditions.NetworkConditionsSelector.decorateSelect(toolbarItem.selec
tElement()); |
229 return toolbarItem; | 207 return toolbarItem; |
230 } | 208 } |
231 | 209 |
232 _toggleRecording() { | 210 _toggleRecording() { |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
747 * @param {string} actionId | 725 * @param {string} actionId |
748 * @return {boolean} | 726 * @return {boolean} |
749 */ | 727 */ |
750 handleAction(context, actionId) { | 728 handleAction(context, actionId) { |
751 var panel = UI.context.flavor(Network.NetworkPanel); | 729 var panel = UI.context.flavor(Network.NetworkPanel); |
752 console.assert(panel && panel instanceof Network.NetworkPanel); | 730 console.assert(panel && panel instanceof Network.NetworkPanel); |
753 panel._toggleRecording(); | 731 panel._toggleRecording(); |
754 return true; | 732 return true; |
755 } | 733 } |
756 }; | 734 }; |
OLD | NEW |