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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
60 this._networkOverview = new Network.NetworkOverview(); | 60 this._networkOverview = new Network.NetworkOverview(); |
61 this._overviewPane.setOverviewControls([this._networkOverview]); | 61 this._overviewPane.setOverviewControls([this._networkOverview]); |
62 this._calculator = new Network.NetworkTransferTimeCalculator(); | 62 this._calculator = new Network.NetworkTransferTimeCalculator(); |
63 | 63 |
64 this._splitWidget = new UI.SplitWidget(true, false, 'networkPanelSplitViewSt ate'); | 64 this._splitWidget = new UI.SplitWidget(true, false, 'networkPanelSplitViewSt ate'); |
65 this._splitWidget.hideMain(); | 65 this._splitWidget.hideMain(); |
66 | 66 |
67 this._splitWidget.show(this.element); | 67 this._splitWidget.show(this.element); |
68 | 68 |
69 this._progressBarContainer = createElement('div'); | 69 this._progressBarContainer = createElement('div'); |
70 this._createToolbarButtons(); | |
71 | 70 |
72 this._searchableView = new UI.SearchableView(this); | 71 this._searchableView = new UI.SearchableView(this); |
73 this._searchableView.setPlaceholder(Common.UIString('Find by filename or pat h')); | 72 this._searchableView.setPlaceholder(Common.UIString('Find by filename or pat h')); |
74 | 73 |
75 /** @type {!Network.NetworkLogView} */ | 74 /** @type {!Network.NetworkLogView} */ |
76 this._networkLogView = | 75 this._networkLogView = |
77 new Network.NetworkLogView(this._filterBar, this._progressBarContainer, this._networkLogLargeRowsSetting); | 76 new Network.NetworkLogView(this._filterBar, this._progressBarContainer, this._networkLogLargeRowsSetting); |
78 this._networkLogView.show(this._searchableView.element); | 77 this._networkLogView.show(this._searchableView.element); |
79 | 78 |
80 this._splitWidget.setSidebarWidget(this._searchableView); | 79 this._splitWidget.setSidebarWidget(this._searchableView); |
81 | 80 |
82 this._detailsWidget = new UI.VBox(); | 81 this._detailsWidget = new UI.VBox(); |
83 this._detailsWidget.element.classList.add('network-details-view'); | 82 this._detailsWidget.element.classList.add('network-details-view'); |
84 this._splitWidget.setMainWidget(this._detailsWidget); | 83 this._splitWidget.setMainWidget(this._detailsWidget); |
85 | 84 |
86 this._closeButtonElement = createElement('div', 'dt-close-button'); | 85 this._closeButtonElement = createElement('div', 'dt-close-button'); |
87 this._closeButtonElement.addEventListener('click', this._showRequest.bind(th is, null), false); | 86 this._closeButtonElement.addEventListener('click', this._showRequest.bind(th is, null), false); |
88 | 87 |
89 this._networkLogShowOverviewSetting.addChangeListener(this._toggleShowOvervi ew, this); | 88 this._networkLogShowOverviewSetting.addChangeListener(this._toggleShowOvervi ew, this); |
90 this._networkLogLargeRowsSetting.addChangeListener(this._toggleLargerRequest s, this); | 89 this._networkLogLargeRowsSetting.addChangeListener(this._toggleLargerRequest s, this); |
91 this._networkRecordFilmStripSetting.addChangeListener(this._toggleRecordFilm Strip, this); | 90 this._networkRecordFilmStripSetting.addChangeListener(this._toggleRecordFilm Strip, this); |
92 | 91 |
92 /** @type {!Map<string, !Runtime.Extension>} */ | |
93 this._groupingExtensions = new Map(); | |
94 this._createToolbarButtons(); | |
allada
2017/02/16 02:46:12
This was moved because we need _networkLogView in
| |
95 | |
93 this._toggleRecord(true); | 96 this._toggleRecord(true); |
94 this._toggleShowOverview(); | 97 this._toggleShowOverview(); |
95 this._toggleLargerRequests(); | 98 this._toggleLargerRequests(); |
96 this._toggleRecordFilmStrip(); | 99 this._toggleRecordFilmStrip(); |
97 this._updateUI(); | 100 this._updateUI(); |
98 | 101 |
99 SDK.targetManager.addModelListener( | 102 SDK.targetManager.addModelListener( |
100 SDK.ResourceTreeModel, SDK.ResourceTreeModel.Events.WillReloadPage, this ._willReloadPage, this); | 103 SDK.ResourceTreeModel, SDK.ResourceTreeModel.Events.WillReloadPage, this ._willReloadPage, this); |
101 SDK.targetManager.addModelListener(SDK.ResourceTreeModel, SDK.ResourceTreeMo del.Events.Load, this._load, this); | 104 SDK.targetManager.addModelListener(SDK.ResourceTreeModel, SDK.ResourceTreeMo del.Events.Load, this._load, this); |
102 this._networkLogView.addEventListener(Network.NetworkLogView.Events.RequestS elected, this._onRequestSelected, this); | 105 this._networkLogView.addEventListener(Network.NetworkLogView.Events.RequestS elected, this._onRequestSelected, this); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
172 | 175 |
173 this._disableCacheCheckbox = new UI.ToolbarSettingCheckbox( | 176 this._disableCacheCheckbox = new UI.ToolbarSettingCheckbox( |
174 Common.moduleSetting('cacheDisabled'), Common.UIString('Disable cache (w hile DevTools is open)'), | 177 Common.moduleSetting('cacheDisabled'), Common.UIString('Disable cache (w hile DevTools is open)'), |
175 Common.UIString('Disable cache')); | 178 Common.UIString('Disable cache')); |
176 this._panelToolbar.appendToolbarItem(this._disableCacheCheckbox); | 179 this._panelToolbar.appendToolbarItem(this._disableCacheCheckbox); |
177 | 180 |
178 this._panelToolbar.appendSeparator(); | 181 this._panelToolbar.appendSeparator(); |
179 this._panelToolbar.appendToolbarItem(this._createBlockedURLsButton()); | 182 this._panelToolbar.appendToolbarItem(this._createBlockedURLsButton()); |
180 this._panelToolbar.appendToolbarItem(NetworkConditions.NetworkConditionsSele ctor.createOfflineToolbarCheckbox()); | 183 this._panelToolbar.appendToolbarItem(NetworkConditions.NetworkConditionsSele ctor.createOfflineToolbarCheckbox()); |
181 this._panelToolbar.appendToolbarItem(this._createNetworkConditionsSelect()); | 184 this._panelToolbar.appendToolbarItem(this._createNetworkConditionsSelect()); |
185 | |
186 this._setupGroupingCombo(); | |
187 | |
182 this._panelToolbar.appendToolbarItem(new UI.ToolbarItem(this._progressBarCon tainer)); | 188 this._panelToolbar.appendToolbarItem(new UI.ToolbarItem(this._progressBarCon tainer)); |
183 } | 189 } |
184 | 190 |
191 _setupGroupingCombo() { | |
192 var extensions = self.runtime.extensions(Network.NetworkGroupLookupInterface ); | |
193 if (!extensions.length) | |
194 return; | |
195 | |
196 var setting = Common.settings.createSetting('networkGrouping', ''); | |
197 /** @type {!Array<!{value: string, label: string, title: string}>} */ | |
198 var options = [{value: '', label: Common.UIString('No grouping'), title: Com mon.UIString('No grouping')}]; | |
199 | |
200 extensions.forEach(extension => { | |
201 var identifier = extension.descriptor()['identifier']; | |
202 this._groupingExtensions.set(identifier, extension); | |
203 options.push({value: identifier, label: extension.title(), title: extensio n.title()}); | |
204 }); | |
205 this._panelToolbar.appendToolbarItem(new UI.ToolbarSettingComboBox(options, setting, Common.UIString('Group by'))); | |
206 setting.addChangeListener(event => this._groupingChanged(/** @type {string} */ (event.data))); | |
207 this._groupingChanged(setting.get()); | |
208 } | |
209 | |
210 /** | |
211 * @param {string} identifier | |
212 */ | |
213 _groupingChanged(identifier) { | |
214 var extension = this._groupingExtensions.get(identifier); | |
215 if (extension) { | |
216 extension.instance().then( | |
217 grouping => this._networkLogView.setGrouping(/** @type {?Network.Netwo rkGroupLookupInterface} */ (grouping))); | |
218 } else { | |
219 this._networkLogView.setGrouping(null); | |
220 } | |
221 } | |
222 | |
185 /** | 223 /** |
186 * @return {!UI.ToolbarItem} | 224 * @return {!UI.ToolbarItem} |
187 */ | 225 */ |
188 _createBlockedURLsButton() { | 226 _createBlockedURLsButton() { |
189 var setting = Common.moduleSetting('networkBlockedURLs'); | 227 var setting = Common.moduleSetting('networkBlockedURLs'); |
190 setting.addChangeListener(updateAction); | 228 setting.addChangeListener(updateAction); |
191 var action = /** @type {!UI.Action }*/ (UI.actionRegistry.action('network.bl ocked-urls.show')); | 229 var action = /** @type {!UI.Action }*/ (UI.actionRegistry.action('network.bl ocked-urls.show')); |
192 var button = UI.Toolbar.createActionButton(action); | 230 var button = UI.Toolbar.createActionButton(action); |
193 button.setVisible(Runtime.experiments.isEnabled('requestBlocking')); | 231 button.setVisible(Runtime.experiments.isEnabled('requestBlocking')); |
194 updateAction(); | 232 updateAction(); |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
726 * @param {string} actionId | 764 * @param {string} actionId |
727 * @return {boolean} | 765 * @return {boolean} |
728 */ | 766 */ |
729 handleAction(context, actionId) { | 767 handleAction(context, actionId) { |
730 var panel = UI.context.flavor(Network.NetworkPanel); | 768 var panel = UI.context.flavor(Network.NetworkPanel); |
731 console.assert(panel && panel instanceof Network.NetworkPanel); | 769 console.assert(panel && panel instanceof Network.NetworkPanel); |
732 panel._toggleRecording(); | 770 panel._toggleRecording(); |
733 return true; | 771 return true; |
734 } | 772 } |
735 }; | 773 }; |
OLD | NEW |