| 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 10 matching lines...) Expand all Loading... |
| 21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 22 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY | 22 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY |
| 23 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 23 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 /** | 30 /** |
| 31 * @implements {WebInspector.ContextMenu.Provider} | 31 * @implements {UI.ContextMenu.Provider} |
| 32 * @implements {WebInspector.Searchable} | 32 * @implements {UI.Searchable} |
| 33 * @unrestricted | 33 * @unrestricted |
| 34 */ | 34 */ |
| 35 WebInspector.NetworkPanel = class extends WebInspector.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 = WebInspector.settings.createSetting('n
etworkLogShowOverview', true); | 40 this._networkLogShowOverviewSetting = Common.settings.createSetting('network
LogShowOverview', true); |
| 41 this._networkLogLargeRowsSetting = WebInspector.settings.createSetting('netw
orkLogLargeRows', false); | 41 this._networkLogLargeRowsSetting = Common.settings.createSetting('networkLog
LargeRows', false); |
| 42 this._networkRecordFilmStripSetting = WebInspector.settings.createSetting('n
etworkRecordFilmStripSetting', false); | 42 this._networkRecordFilmStripSetting = Common.settings.createSetting('network
RecordFilmStripSetting', false); |
| 43 this._toggleRecordAction = | 43 this._toggleRecordAction = |
| 44 /** @type {!WebInspector.Action }*/ (WebInspector.actionRegistry.action(
'network.toggle-recording')); | 44 /** @type {!UI.Action }*/ (UI.actionRegistry.action('network.toggle-reco
rding')); |
| 45 | 45 |
| 46 /** @type {?WebInspector.FilmStripView} */ | 46 /** @type {?Components.FilmStripView} */ |
| 47 this._filmStripView = null; | 47 this._filmStripView = null; |
| 48 /** @type {?WebInspector.NetworkPanel.FilmStripRecorder} */ | 48 /** @type {?Network.NetworkPanel.FilmStripRecorder} */ |
| 49 this._filmStripRecorder = null; | 49 this._filmStripRecorder = null; |
| 50 | 50 |
| 51 this._panelToolbar = new WebInspector.Toolbar('', this.element); | 51 this._panelToolbar = new UI.Toolbar('', this.element); |
| 52 this._filterBar = new WebInspector.FilterBar('networkPanel', true); | 52 this._filterBar = new UI.FilterBar('networkPanel', true); |
| 53 this._filterBar.show(this.element); | 53 this._filterBar.show(this.element); |
| 54 | 54 |
| 55 // Create top overview component. | 55 // Create top overview component. |
| 56 this._overviewPane = new WebInspector.TimelineOverviewPane('network'); | 56 this._overviewPane = new UI.TimelineOverviewPane('network'); |
| 57 this._overviewPane.addEventListener( | 57 this._overviewPane.addEventListener( |
| 58 WebInspector.TimelineOverviewPane.Events.WindowChanged, this._onWindowCh
anged.bind(this)); | 58 UI.TimelineOverviewPane.Events.WindowChanged, this._onWindowChanged.bind
(this)); |
| 59 this._overviewPane.element.id = 'network-overview-panel'; | 59 this._overviewPane.element.id = 'network-overview-panel'; |
| 60 this._networkOverview = new WebInspector.NetworkOverview(); | 60 this._networkOverview = new Network.NetworkOverview(); |
| 61 this._overviewPane.setOverviewControls([this._networkOverview]); | 61 this._overviewPane.setOverviewControls([this._networkOverview]); |
| 62 this._calculator = new WebInspector.NetworkTransferTimeCalculator(); | 62 this._calculator = new Network.NetworkTransferTimeCalculator(); |
| 63 | 63 |
| 64 this._splitWidget = new WebInspector.SplitWidget(true, false, 'networkPanelS
plitViewState'); | 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(); | 70 this._createToolbarButtons(); |
| 71 | 71 |
| 72 this._searchableView = new WebInspector.SearchableView(this); | 72 this._searchableView = new UI.SearchableView(this); |
| 73 this._searchableView.setPlaceholder(WebInspector.UIString('Find by filename
or path')); | 73 this._searchableView.setPlaceholder(Common.UIString('Find by filename or pat
h')); |
| 74 | 74 |
| 75 /** @type {!WebInspector.NetworkLogView} */ | 75 /** @type {!Network.NetworkLogView} */ |
| 76 this._networkLogView = | 76 this._networkLogView = |
| 77 new WebInspector.NetworkLogView(this._filterBar, this._progressBarContai
ner, this._networkLogLargeRowsSetting); | 77 new Network.NetworkLogView(this._filterBar, this._progressBarContainer,
this._networkLogLargeRowsSetting); |
| 78 this._networkLogView.show(this._searchableView.element); | 78 this._networkLogView.show(this._searchableView.element); |
| 79 | 79 |
| 80 this._splitWidget.setSidebarWidget(this._searchableView); | 80 this._splitWidget.setSidebarWidget(this._searchableView); |
| 81 | 81 |
| 82 this._detailsWidget = new WebInspector.VBox(); | 82 this._detailsWidget = new UI.VBox(); |
| 83 this._detailsWidget.element.classList.add('network-details-view'); | 83 this._detailsWidget.element.classList.add('network-details-view'); |
| 84 this._splitWidget.setMainWidget(this._detailsWidget); | 84 this._splitWidget.setMainWidget(this._detailsWidget); |
| 85 | 85 |
| 86 this._closeButtonElement = createElement('div', 'dt-close-button'); | 86 this._closeButtonElement = createElement('div', 'dt-close-button'); |
| 87 this._closeButtonElement.addEventListener('click', this._showRequest.bind(th
is, null), false); | 87 this._closeButtonElement.addEventListener('click', this._showRequest.bind(th
is, null), false); |
| 88 | 88 |
| 89 this._networkLogShowOverviewSetting.addChangeListener(this._toggleShowOvervi
ew, this); | 89 this._networkLogShowOverviewSetting.addChangeListener(this._toggleShowOvervi
ew, this); |
| 90 this._networkLogLargeRowsSetting.addChangeListener(this._toggleLargerRequest
s, this); | 90 this._networkLogLargeRowsSetting.addChangeListener(this._toggleLargerRequest
s, this); |
| 91 this._networkRecordFilmStripSetting.addChangeListener(this._toggleRecordFilm
Strip, this); | 91 this._networkRecordFilmStripSetting.addChangeListener(this._toggleRecordFilm
Strip, this); |
| 92 | 92 |
| 93 this._toggleRecord(true); | 93 this._toggleRecord(true); |
| 94 this._toggleShowOverview(); | 94 this._toggleShowOverview(); |
| 95 this._toggleLargerRequests(); | 95 this._toggleLargerRequests(); |
| 96 this._toggleRecordFilmStrip(); | 96 this._toggleRecordFilmStrip(); |
| 97 this._updateUI(); | 97 this._updateUI(); |
| 98 | 98 |
| 99 WebInspector.targetManager.addModelListener( | 99 SDK.targetManager.addModelListener( |
| 100 WebInspector.ResourceTreeModel, WebInspector.ResourceTreeModel.Events.Wi
llReloadPage, this._willReloadPage, | 100 SDK.ResourceTreeModel, SDK.ResourceTreeModel.Events.WillReloadPage, this
._willReloadPage, |
| 101 this); | 101 this); |
| 102 WebInspector.targetManager.addModelListener( | 102 SDK.targetManager.addModelListener( |
| 103 WebInspector.ResourceTreeModel, WebInspector.ResourceTreeModel.Events.Lo
ad, this._load, this); | 103 SDK.ResourceTreeModel, SDK.ResourceTreeModel.Events.Load, this._load, th
is); |
| 104 this._networkLogView.addEventListener( | 104 this._networkLogView.addEventListener( |
| 105 WebInspector.NetworkLogView.Events.RequestSelected, this._onRequestSelec
ted, this); | 105 Network.NetworkLogView.Events.RequestSelected, this._onRequestSelected,
this); |
| 106 this._networkLogView.addEventListener( | 106 this._networkLogView.addEventListener( |
| 107 WebInspector.NetworkLogView.Events.SearchCountUpdated, this._onSearchCou
ntUpdated, this); | 107 Network.NetworkLogView.Events.SearchCountUpdated, this._onSearchCountUpd
ated, this); |
| 108 this._networkLogView.addEventListener( | 108 this._networkLogView.addEventListener( |
| 109 WebInspector.NetworkLogView.Events.SearchIndexUpdated, this._onSearchInd
exUpdated, this); | 109 Network.NetworkLogView.Events.SearchIndexUpdated, this._onSearchIndexUpd
ated, this); |
| 110 this._networkLogView.addEventListener( | 110 this._networkLogView.addEventListener( |
| 111 WebInspector.NetworkLogView.Events.UpdateRequest, this._onUpdateRequest,
this); | 111 Network.NetworkLogView.Events.UpdateRequest, this._onUpdateRequest, this
); |
| 112 | 112 |
| 113 WebInspector.DataSaverInfobar.maybeShowInPanel(this); | 113 Components.DataSaverInfobar.maybeShowInPanel(this); |
| 114 } | 114 } |
| 115 | 115 |
| 116 /** | 116 /** |
| 117 * @param {!Array<{filterType: !WebInspector.NetworkLogView.FilterType, filter
Value: string}>} filters | 117 * @param {!Array<{filterType: !Network.NetworkLogView.FilterType, filterValue
: string}>} filters |
| 118 */ | 118 */ |
| 119 static revealAndFilter(filters) { | 119 static revealAndFilter(filters) { |
| 120 var panel = WebInspector.NetworkPanel._instance(); | 120 var panel = Network.NetworkPanel._instance(); |
| 121 var filterString = ''; | 121 var filterString = ''; |
| 122 for (var filter of filters) | 122 for (var filter of filters) |
| 123 filterString += `${filter.filterType}:${filter.filterValue} `; | 123 filterString += `${filter.filterType}:${filter.filterValue} `; |
| 124 panel._networkLogView.setTextFilterValue(filterString); | 124 panel._networkLogView.setTextFilterValue(filterString); |
| 125 WebInspector.viewManager.showView('network'); | 125 UI.viewManager.showView('network'); |
| 126 } | 126 } |
| 127 | 127 |
| 128 /** | 128 /** |
| 129 * @return {!WebInspector.NetworkPanel} | 129 * @return {!Network.NetworkPanel} |
| 130 */ | 130 */ |
| 131 static _instance() { | 131 static _instance() { |
| 132 return /** @type {!WebInspector.NetworkPanel} */ (self.runtime.sharedInstanc
e(WebInspector.NetworkPanel)); | 132 return /** @type {!Network.NetworkPanel} */ (self.runtime.sharedInstance(Net
work.NetworkPanel)); |
| 133 } | 133 } |
| 134 | 134 |
| 135 /** | 135 /** |
| 136 * @param {!WebInspector.Event} event | 136 * @param {!Common.Event} event |
| 137 */ | 137 */ |
| 138 _onWindowChanged(event) { | 138 _onWindowChanged(event) { |
| 139 var startTime = Math.max(this._calculator.minimumBoundary(), event.data.star
tTime / 1000); | 139 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); | 140 var endTime = Math.min(this._calculator.maximumBoundary(), event.data.endTim
e / 1000); |
| 141 this._networkLogView.setWindow(startTime, endTime); | 141 this._networkLogView.setWindow(startTime, endTime); |
| 142 } | 142 } |
| 143 | 143 |
| 144 _createToolbarButtons() { | 144 _createToolbarButtons() { |
| 145 this._panelToolbar.appendToolbarItem(WebInspector.Toolbar.createActionButton
(this._toggleRecordAction)); | 145 this._panelToolbar.appendToolbarItem(UI.Toolbar.createActionButton(this._tog
gleRecordAction)); |
| 146 | 146 |
| 147 this._clearButton = new WebInspector.ToolbarButton(WebInspector.UIString('Cl
ear'), 'largeicon-clear'); | 147 this._clearButton = new UI.ToolbarButton(Common.UIString('Clear'), 'largeico
n-clear'); |
| 148 this._clearButton.addEventListener('click', this._onClearButtonClicked, this
); | 148 this._clearButton.addEventListener('click', this._onClearButtonClicked, this
); |
| 149 this._panelToolbar.appendToolbarItem(this._clearButton); | 149 this._panelToolbar.appendToolbarItem(this._clearButton); |
| 150 this._panelToolbar.appendSeparator(); | 150 this._panelToolbar.appendSeparator(); |
| 151 var recordFilmStripButton = new WebInspector.ToolbarSettingToggle( | 151 var recordFilmStripButton = new UI.ToolbarSettingToggle( |
| 152 this._networkRecordFilmStripSetting, 'largeicon-camera', WebInspector.UI
String('Capture screenshots')); | 152 this._networkRecordFilmStripSetting, 'largeicon-camera', Common.UIString
('Capture screenshots')); |
| 153 this._panelToolbar.appendToolbarItem(recordFilmStripButton); | 153 this._panelToolbar.appendToolbarItem(recordFilmStripButton); |
| 154 | 154 |
| 155 this._panelToolbar.appendToolbarItem(this._filterBar.filterButton()); | 155 this._panelToolbar.appendToolbarItem(this._filterBar.filterButton()); |
| 156 this._panelToolbar.appendSeparator(); | 156 this._panelToolbar.appendSeparator(); |
| 157 | 157 |
| 158 this._panelToolbar.appendText(WebInspector.UIString('View:')); | 158 this._panelToolbar.appendText(Common.UIString('View:')); |
| 159 | 159 |
| 160 var largerRequestsButton = new WebInspector.ToolbarSettingToggle( | 160 var largerRequestsButton = new UI.ToolbarSettingToggle( |
| 161 this._networkLogLargeRowsSetting, 'largeicon-large-list', WebInspector.U
IString('Use large request rows'), | 161 this._networkLogLargeRowsSetting, 'largeicon-large-list', Common.UIStrin
g('Use large request rows'), |
| 162 WebInspector.UIString('Use small request rows')); | 162 Common.UIString('Use small request rows')); |
| 163 this._panelToolbar.appendToolbarItem(largerRequestsButton); | 163 this._panelToolbar.appendToolbarItem(largerRequestsButton); |
| 164 | 164 |
| 165 var showOverviewButton = new WebInspector.ToolbarSettingToggle( | 165 var showOverviewButton = new UI.ToolbarSettingToggle( |
| 166 this._networkLogShowOverviewSetting, 'largeicon-waterfall', WebInspector
.UIString('Show overview'), | 166 this._networkLogShowOverviewSetting, 'largeicon-waterfall', Common.UIStr
ing('Show overview'), |
| 167 WebInspector.UIString('Hide overview')); | 167 Common.UIString('Hide overview')); |
| 168 this._panelToolbar.appendToolbarItem(showOverviewButton); | 168 this._panelToolbar.appendToolbarItem(showOverviewButton); |
| 169 this._panelToolbar.appendSeparator(); | 169 this._panelToolbar.appendSeparator(); |
| 170 | 170 |
| 171 this._preserveLogCheckbox = new WebInspector.ToolbarCheckbox( | 171 this._preserveLogCheckbox = new UI.ToolbarCheckbox( |
| 172 WebInspector.UIString('Preserve log'), WebInspector.UIString('Do not cle
ar log on page reload / navigation')); | 172 Common.UIString('Preserve log'), Common.UIString('Do not clear log on pa
ge reload / navigation')); |
| 173 this._preserveLogCheckbox.inputElement.addEventListener( | 173 this._preserveLogCheckbox.inputElement.addEventListener( |
| 174 'change', this._onPreserveLogCheckboxChanged.bind(this), false); | 174 'change', this._onPreserveLogCheckboxChanged.bind(this), false); |
| 175 this._panelToolbar.appendToolbarItem(this._preserveLogCheckbox); | 175 this._panelToolbar.appendToolbarItem(this._preserveLogCheckbox); |
| 176 | 176 |
| 177 this._disableCacheCheckbox = new WebInspector.ToolbarCheckbox( | 177 this._disableCacheCheckbox = new UI.ToolbarCheckbox( |
| 178 WebInspector.UIString('Disable cache'), WebInspector.UIString('Disable c
ache (while DevTools is open)'), | 178 Common.UIString('Disable cache'), Common.UIString('Disable cache (while
DevTools is open)'), |
| 179 WebInspector.moduleSetting('cacheDisabled')); | 179 Common.moduleSetting('cacheDisabled')); |
| 180 this._panelToolbar.appendToolbarItem(this._disableCacheCheckbox); | 180 this._panelToolbar.appendToolbarItem(this._disableCacheCheckbox); |
| 181 | 181 |
| 182 this._panelToolbar.appendSeparator(); | 182 this._panelToolbar.appendSeparator(); |
| 183 this._panelToolbar.appendToolbarItem(this._createBlockedURLsButton()); | 183 this._panelToolbar.appendToolbarItem(this._createBlockedURLsButton()); |
| 184 this._panelToolbar.appendToolbarItem(WebInspector.NetworkConditionsSelector.
createOfflineToolbarCheckbox()); | 184 this._panelToolbar.appendToolbarItem(Components.NetworkConditionsSelector.cr
eateOfflineToolbarCheckbox()); |
| 185 this._panelToolbar.appendToolbarItem(this._createNetworkConditionsSelect()); | 185 this._panelToolbar.appendToolbarItem(this._createNetworkConditionsSelect()); |
| 186 this._panelToolbar.appendToolbarItem(new WebInspector.ToolbarItem(this._prog
ressBarContainer)); | 186 this._panelToolbar.appendToolbarItem(new UI.ToolbarItem(this._progressBarCon
tainer)); |
| 187 } | 187 } |
| 188 | 188 |
| 189 /** | 189 /** |
| 190 * @return {!WebInspector.ToolbarItem} | 190 * @return {!UI.ToolbarItem} |
| 191 */ | 191 */ |
| 192 _createBlockedURLsButton() { | 192 _createBlockedURLsButton() { |
| 193 var setting = WebInspector.moduleSetting('blockedURLs'); | 193 var setting = Common.moduleSetting('blockedURLs'); |
| 194 setting.addChangeListener(updateAction); | 194 setting.addChangeListener(updateAction); |
| 195 var action = /** @type {!WebInspector.Action }*/ (WebInspector.actionRegistr
y.action('network.blocked-urls.show')); | 195 var action = /** @type {!UI.Action }*/ (UI.actionRegistry.action('network.bl
ocked-urls.show')); |
| 196 var button = WebInspector.Toolbar.createActionButton(action); | 196 var button = UI.Toolbar.createActionButton(action); |
| 197 button.setVisible(Runtime.experiments.isEnabled('requestBlocking')); | 197 button.setVisible(Runtime.experiments.isEnabled('requestBlocking')); |
| 198 updateAction(); | 198 updateAction(); |
| 199 return button; | 199 return button; |
| 200 | 200 |
| 201 function updateAction() { | 201 function updateAction() { |
| 202 action.setToggled(!!setting.get().length); | 202 action.setToggled(!!setting.get().length); |
| 203 } | 203 } |
| 204 } | 204 } |
| 205 | 205 |
| 206 /** | 206 /** |
| 207 * @return {!WebInspector.ToolbarComboBox} | 207 * @return {!UI.ToolbarComboBox} |
| 208 */ | 208 */ |
| 209 _createNetworkConditionsSelect() { | 209 _createNetworkConditionsSelect() { |
| 210 var toolbarItem = new WebInspector.ToolbarComboBox(null); | 210 var toolbarItem = new UI.ToolbarComboBox(null); |
| 211 toolbarItem.setMaxWidth(140); | 211 toolbarItem.setMaxWidth(140); |
| 212 WebInspector.NetworkConditionsSelector.decorateSelect(toolbarItem.selectElem
ent()); | 212 Components.NetworkConditionsSelector.decorateSelect(toolbarItem.selectElemen
t()); |
| 213 return toolbarItem; | 213 return toolbarItem; |
| 214 } | 214 } |
| 215 | 215 |
| 216 _toggleRecording() { | 216 _toggleRecording() { |
| 217 if (!this._preserveLogCheckbox.checked() && !this._toggleRecordAction.toggle
d()) | 217 if (!this._preserveLogCheckbox.checked() && !this._toggleRecordAction.toggle
d()) |
| 218 this._reset(); | 218 this._reset(); |
| 219 this._toggleRecord(!this._toggleRecordAction.toggled()); | 219 this._toggleRecord(!this._toggleRecordAction.toggled()); |
| 220 } | 220 } |
| 221 | 221 |
| 222 /** | 222 /** |
| 223 * @param {boolean} toggled | 223 * @param {boolean} toggled |
| 224 */ | 224 */ |
| 225 _toggleRecord(toggled) { | 225 _toggleRecord(toggled) { |
| 226 this._toggleRecordAction.setToggled(toggled); | 226 this._toggleRecordAction.setToggled(toggled); |
| 227 this._networkLogView.setRecording(toggled); | 227 this._networkLogView.setRecording(toggled); |
| 228 if (!toggled && this._filmStripRecorder) | 228 if (!toggled && this._filmStripRecorder) |
| 229 this._filmStripRecorder.stopRecording(this._filmStripAvailable.bind(this))
; | 229 this._filmStripRecorder.stopRecording(this._filmStripAvailable.bind(this))
; |
| 230 } | 230 } |
| 231 | 231 |
| 232 /** | 232 /** |
| 233 * @param {?WebInspector.FilmStripModel} filmStripModel | 233 * @param {?Components.FilmStripModel} filmStripModel |
| 234 */ | 234 */ |
| 235 _filmStripAvailable(filmStripModel) { | 235 _filmStripAvailable(filmStripModel) { |
| 236 if (!filmStripModel) | 236 if (!filmStripModel) |
| 237 return; | 237 return; |
| 238 var calculator = this._networkLogView.timeCalculator(); | 238 var calculator = this._networkLogView.timeCalculator(); |
| 239 this._filmStripView.setModel(filmStripModel, calculator.minimumBoundary() *
1000, calculator.boundarySpan() * 1000); | 239 this._filmStripView.setModel(filmStripModel, calculator.minimumBoundary() *
1000, calculator.boundarySpan() * 1000); |
| 240 this._networkOverview.setFilmStripModel(filmStripModel); | 240 this._networkOverview.setFilmStripModel(filmStripModel); |
| 241 var timestamps = filmStripModel.frames().map(mapTimestamp); | 241 var timestamps = filmStripModel.frames().map(mapTimestamp); |
| 242 | 242 |
| 243 /** | 243 /** |
| 244 * @param {!WebInspector.FilmStripModel.Frame} frame | 244 * @param {!Components.FilmStripModel.Frame} frame |
| 245 * @return {number} | 245 * @return {number} |
| 246 */ | 246 */ |
| 247 function mapTimestamp(frame) { | 247 function mapTimestamp(frame) { |
| 248 return frame.timestamp / 1000; | 248 return frame.timestamp / 1000; |
| 249 } | 249 } |
| 250 | 250 |
| 251 this._networkLogView.addFilmStripFrames(timestamps); | 251 this._networkLogView.addFilmStripFrames(timestamps); |
| 252 } | 252 } |
| 253 | 253 |
| 254 /** | 254 /** |
| 255 * @param {!Event} event | 255 * @param {!Event} event |
| 256 */ | 256 */ |
| 257 _onPreserveLogCheckboxChanged(event) { | 257 _onPreserveLogCheckboxChanged(event) { |
| 258 this._networkLogView.setPreserveLog(this._preserveLogCheckbox.checked()); | 258 this._networkLogView.setPreserveLog(this._preserveLogCheckbox.checked()); |
| 259 } | 259 } |
| 260 | 260 |
| 261 /** | 261 /** |
| 262 * @param {!WebInspector.Event} event | 262 * @param {!Common.Event} event |
| 263 */ | 263 */ |
| 264 _onClearButtonClicked(event) { | 264 _onClearButtonClicked(event) { |
| 265 this._reset(); | 265 this._reset(); |
| 266 } | 266 } |
| 267 | 267 |
| 268 _reset() { | 268 _reset() { |
| 269 this._calculator.reset(); | 269 this._calculator.reset(); |
| 270 this._overviewPane.reset(); | 270 this._overviewPane.reset(); |
| 271 this._networkLogView.reset(); | 271 this._networkLogView.reset(); |
| 272 WebInspector.BlockedURLsPane.reset(); | 272 Network.BlockedURLsPane.reset(); |
| 273 if (this._filmStripView) | 273 if (this._filmStripView) |
| 274 this._resetFilmStripView(); | 274 this._resetFilmStripView(); |
| 275 } | 275 } |
| 276 | 276 |
| 277 /** | 277 /** |
| 278 * @param {!WebInspector.Event} event | 278 * @param {!Common.Event} event |
| 279 */ | 279 */ |
| 280 _willReloadPage(event) { | 280 _willReloadPage(event) { |
| 281 if (!this._preserveLogCheckbox.checked()) | 281 if (!this._preserveLogCheckbox.checked()) |
| 282 this._reset(); | 282 this._reset(); |
| 283 this._toggleRecord(true); | 283 this._toggleRecord(true); |
| 284 if (this._pendingStopTimer) { | 284 if (this._pendingStopTimer) { |
| 285 clearTimeout(this._pendingStopTimer); | 285 clearTimeout(this._pendingStopTimer); |
| 286 delete this._pendingStopTimer; | 286 delete this._pendingStopTimer; |
| 287 } | 287 } |
| 288 if (this.isShowing() && this._filmStripRecorder) | 288 if (this.isShowing() && this._filmStripRecorder) |
| 289 this._filmStripRecorder.startRecording(); | 289 this._filmStripRecorder.startRecording(); |
| 290 } | 290 } |
| 291 | 291 |
| 292 /** | 292 /** |
| 293 * @param {!WebInspector.Event} event | 293 * @param {!Common.Event} event |
| 294 */ | 294 */ |
| 295 _load(event) { | 295 _load(event) { |
| 296 if (this._filmStripRecorder && this._filmStripRecorder.isRecording()) | 296 if (this._filmStripRecorder && this._filmStripRecorder.isRecording()) |
| 297 this._pendingStopTimer = | 297 this._pendingStopTimer = |
| 298 setTimeout(this._stopFilmStripRecording.bind(this), WebInspector.Netwo
rkPanel.displayScreenshotDelay); | 298 setTimeout(this._stopFilmStripRecording.bind(this), Network.NetworkPan
el.displayScreenshotDelay); |
| 299 } | 299 } |
| 300 | 300 |
| 301 _stopFilmStripRecording() { | 301 _stopFilmStripRecording() { |
| 302 this._filmStripRecorder.stopRecording(this._filmStripAvailable.bind(this)); | 302 this._filmStripRecorder.stopRecording(this._filmStripAvailable.bind(this)); |
| 303 delete this._pendingStopTimer; | 303 delete this._pendingStopTimer; |
| 304 } | 304 } |
| 305 | 305 |
| 306 _toggleLargerRequests() { | 306 _toggleLargerRequests() { |
| 307 this._updateUI(); | 307 this._updateUI(); |
| 308 } | 308 } |
| 309 | 309 |
| 310 _toggleShowOverview() { | 310 _toggleShowOverview() { |
| 311 var toggled = this._networkLogShowOverviewSetting.get(); | 311 var toggled = this._networkLogShowOverviewSetting.get(); |
| 312 if (toggled) | 312 if (toggled) |
| 313 this._overviewPane.show(this.element, this._splitWidget.element); | 313 this._overviewPane.show(this.element, this._splitWidget.element); |
| 314 else | 314 else |
| 315 this._overviewPane.detach(); | 315 this._overviewPane.detach(); |
| 316 this.doResize(); | 316 this.doResize(); |
| 317 } | 317 } |
| 318 | 318 |
| 319 _toggleRecordFilmStrip() { | 319 _toggleRecordFilmStrip() { |
| 320 var toggled = this._networkRecordFilmStripSetting.get(); | 320 var toggled = this._networkRecordFilmStripSetting.get(); |
| 321 if (toggled && !this._filmStripRecorder) { | 321 if (toggled && !this._filmStripRecorder) { |
| 322 this._filmStripView = new WebInspector.FilmStripView(); | 322 this._filmStripView = new Components.FilmStripView(); |
| 323 this._filmStripView.setMode(WebInspector.FilmStripView.Modes.FrameBased); | 323 this._filmStripView.setMode(Components.FilmStripView.Modes.FrameBased); |
| 324 this._filmStripView.element.classList.add('network-film-strip'); | 324 this._filmStripView.element.classList.add('network-film-strip'); |
| 325 this._filmStripRecorder = | 325 this._filmStripRecorder = |
| 326 new WebInspector.NetworkPanel.FilmStripRecorder(this._networkLogView.t
imeCalculator(), this._filmStripView); | 326 new Network.NetworkPanel.FilmStripRecorder(this._networkLogView.timeCa
lculator(), this._filmStripView); |
| 327 this._filmStripView.show(this.element, this.element.firstElementChild); | 327 this._filmStripView.show(this.element, this.element.firstElementChild); |
| 328 this._filmStripView.addEventListener( | 328 this._filmStripView.addEventListener( |
| 329 WebInspector.FilmStripView.Events.FrameSelected, this._onFilmFrameSele
cted, this); | 329 Components.FilmStripView.Events.FrameSelected, this._onFilmFrameSelect
ed, this); |
| 330 this._filmStripView.addEventListener(WebInspector.FilmStripView.Events.Fra
meEnter, this._onFilmFrameEnter, this); | 330 this._filmStripView.addEventListener(Components.FilmStripView.Events.Frame
Enter, this._onFilmFrameEnter, this); |
| 331 this._filmStripView.addEventListener(WebInspector.FilmStripView.Events.Fra
meExit, this._onFilmFrameExit, this); | 331 this._filmStripView.addEventListener(Components.FilmStripView.Events.Frame
Exit, this._onFilmFrameExit, this); |
| 332 this._resetFilmStripView(); | 332 this._resetFilmStripView(); |
| 333 } | 333 } |
| 334 | 334 |
| 335 if (!toggled && this._filmStripRecorder) { | 335 if (!toggled && this._filmStripRecorder) { |
| 336 this._filmStripView.detach(); | 336 this._filmStripView.detach(); |
| 337 this._filmStripView = null; | 337 this._filmStripView = null; |
| 338 this._filmStripRecorder = null; | 338 this._filmStripRecorder = null; |
| 339 } | 339 } |
| 340 } | 340 } |
| 341 | 341 |
| 342 _resetFilmStripView() { | 342 _resetFilmStripView() { |
| 343 this._filmStripView.reset(); | 343 this._filmStripView.reset(); |
| 344 this._filmStripView.setStatusText(WebInspector.UIString( | 344 this._filmStripView.setStatusText(Common.UIString( |
| 345 'Hit %s to reload and capture filmstrip.', | 345 'Hit %s to reload and capture filmstrip.', |
| 346 WebInspector.shortcutRegistry.shortcutDescriptorsForAction('main.reload'
)[0].name)); | 346 UI.shortcutRegistry.shortcutDescriptorsForAction('main.reload')[0].name)
); |
| 347 } | 347 } |
| 348 | 348 |
| 349 /** | 349 /** |
| 350 * @override | 350 * @override |
| 351 * @return {!Array.<!Element>} | 351 * @return {!Array.<!Element>} |
| 352 */ | 352 */ |
| 353 elementsToRestoreScrollPositionsFor() { | 353 elementsToRestoreScrollPositionsFor() { |
| 354 return this._networkLogView.elementsToRestoreScrollPositionsFor(); | 354 return this._networkLogView.elementsToRestoreScrollPositionsFor(); |
| 355 } | 355 } |
| 356 | 356 |
| 357 /** | 357 /** |
| 358 * @override | 358 * @override |
| 359 * @return {!WebInspector.SearchableView} | 359 * @return {!UI.SearchableView} |
| 360 */ | 360 */ |
| 361 searchableView() { | 361 searchableView() { |
| 362 return this._searchableView; | 362 return this._searchableView; |
| 363 } | 363 } |
| 364 | 364 |
| 365 /** | 365 /** |
| 366 * @override | 366 * @override |
| 367 * @param {!KeyboardEvent} event | 367 * @param {!KeyboardEvent} event |
| 368 */ | 368 */ |
| 369 handleShortcut(event) { | 369 handleShortcut(event) { |
| 370 if (this._networkItemView && event.keyCode === WebInspector.KeyboardShortcut
.Keys.Esc.code) { | 370 if (this._networkItemView && event.keyCode === UI.KeyboardShortcut.Keys.Esc.
code) { |
| 371 this._showRequest(null); | 371 this._showRequest(null); |
| 372 event.handled = true; | 372 event.handled = true; |
| 373 return; | 373 return; |
| 374 } | 374 } |
| 375 | 375 |
| 376 super.handleShortcut(event); | 376 super.handleShortcut(event); |
| 377 } | 377 } |
| 378 | 378 |
| 379 /** | 379 /** |
| 380 * @override | 380 * @override |
| 381 */ | 381 */ |
| 382 wasShown() { | 382 wasShown() { |
| 383 WebInspector.context.setFlavor(WebInspector.NetworkPanel, this); | 383 UI.context.setFlavor(Network.NetworkPanel, this); |
| 384 } | 384 } |
| 385 | 385 |
| 386 /** | 386 /** |
| 387 * @override | 387 * @override |
| 388 */ | 388 */ |
| 389 willHide() { | 389 willHide() { |
| 390 WebInspector.context.setFlavor(WebInspector.NetworkPanel, null); | 390 UI.context.setFlavor(Network.NetworkPanel, null); |
| 391 } | 391 } |
| 392 | 392 |
| 393 /** | 393 /** |
| 394 * @param {!WebInspector.NetworkRequest} request | 394 * @param {!SDK.NetworkRequest} request |
| 395 */ | 395 */ |
| 396 revealAndHighlightRequest(request) { | 396 revealAndHighlightRequest(request) { |
| 397 this._showRequest(null); | 397 this._showRequest(null); |
| 398 if (request) | 398 if (request) |
| 399 this._networkLogView.revealAndHighlightRequest(request); | 399 this._networkLogView.revealAndHighlightRequest(request); |
| 400 } | 400 } |
| 401 | 401 |
| 402 /** | 402 /** |
| 403 * @param {!WebInspector.Event} event | 403 * @param {!Common.Event} event |
| 404 */ | 404 */ |
| 405 _onRowSizeChanged(event) { | 405 _onRowSizeChanged(event) { |
| 406 this._updateUI(); | 406 this._updateUI(); |
| 407 } | 407 } |
| 408 | 408 |
| 409 /** | 409 /** |
| 410 * @param {!WebInspector.Event} event | 410 * @param {!Common.Event} event |
| 411 */ | 411 */ |
| 412 _onSearchCountUpdated(event) { | 412 _onSearchCountUpdated(event) { |
| 413 var count = /** @type {number} */ (event.data); | 413 var count = /** @type {number} */ (event.data); |
| 414 this._searchableView.updateSearchMatchesCount(count); | 414 this._searchableView.updateSearchMatchesCount(count); |
| 415 } | 415 } |
| 416 | 416 |
| 417 /** | 417 /** |
| 418 * @param {!WebInspector.Event} event | 418 * @param {!Common.Event} event |
| 419 */ | 419 */ |
| 420 _onSearchIndexUpdated(event) { | 420 _onSearchIndexUpdated(event) { |
| 421 var index = /** @type {number} */ (event.data); | 421 var index = /** @type {number} */ (event.data); |
| 422 this._searchableView.updateCurrentMatchIndex(index); | 422 this._searchableView.updateCurrentMatchIndex(index); |
| 423 } | 423 } |
| 424 | 424 |
| 425 /** | 425 /** |
| 426 * @param {!WebInspector.Event} event | 426 * @param {!Common.Event} event |
| 427 */ | 427 */ |
| 428 _onRequestSelected(event) { | 428 _onRequestSelected(event) { |
| 429 var request = /** @type {?WebInspector.NetworkRequest} */ (event.data); | 429 var request = /** @type {?SDK.NetworkRequest} */ (event.data); |
| 430 this._showRequest(request); | 430 this._showRequest(request); |
| 431 } | 431 } |
| 432 | 432 |
| 433 /** | 433 /** |
| 434 * @param {?WebInspector.NetworkRequest} request | 434 * @param {?SDK.NetworkRequest} request |
| 435 */ | 435 */ |
| 436 _showRequest(request) { | 436 _showRequest(request) { |
| 437 if (this._networkItemView) { | 437 if (this._networkItemView) { |
| 438 this._networkItemView.detach(); | 438 this._networkItemView.detach(); |
| 439 this._networkItemView = null; | 439 this._networkItemView = null; |
| 440 } | 440 } |
| 441 | 441 |
| 442 if (request) { | 442 if (request) { |
| 443 this._networkItemView = new WebInspector.NetworkItemView(request, this._ne
tworkLogView.timeCalculator()); | 443 this._networkItemView = new Network.NetworkItemView(request, this._network
LogView.timeCalculator()); |
| 444 this._networkItemView.leftToolbar().appendToolbarItem(new WebInspector.Too
lbarItem(this._closeButtonElement)); | 444 this._networkItemView.leftToolbar().appendToolbarItem(new UI.ToolbarItem(t
his._closeButtonElement)); |
| 445 this._networkItemView.show(this._detailsWidget.element); | 445 this._networkItemView.show(this._detailsWidget.element); |
| 446 this._splitWidget.showBoth(); | 446 this._splitWidget.showBoth(); |
| 447 } else { | 447 } else { |
| 448 this._splitWidget.hideMain(); | 448 this._splitWidget.hideMain(); |
| 449 this._networkLogView.clearSelection(); | 449 this._networkLogView.clearSelection(); |
| 450 } | 450 } |
| 451 this._updateUI(); | 451 this._updateUI(); |
| 452 } | 452 } |
| 453 | 453 |
| 454 _updateUI() { | 454 _updateUI() { |
| 455 this._detailsWidget.element.classList.toggle( | 455 this._detailsWidget.element.classList.toggle( |
| 456 'network-details-view-tall-header', this._networkLogLargeRowsSetting.get
()); | 456 'network-details-view-tall-header', this._networkLogLargeRowsSetting.get
()); |
| 457 this._networkLogView.switchViewMode(!this._splitWidget.isResizable()); | 457 this._networkLogView.switchViewMode(!this._splitWidget.isResizable()); |
| 458 } | 458 } |
| 459 | 459 |
| 460 /** | 460 /** |
| 461 * @override | 461 * @override |
| 462 * @param {!WebInspector.SearchableView.SearchConfig} searchConfig | 462 * @param {!UI.SearchableView.SearchConfig} searchConfig |
| 463 * @param {boolean} shouldJump | 463 * @param {boolean} shouldJump |
| 464 * @param {boolean=} jumpBackwards | 464 * @param {boolean=} jumpBackwards |
| 465 */ | 465 */ |
| 466 performSearch(searchConfig, shouldJump, jumpBackwards) { | 466 performSearch(searchConfig, shouldJump, jumpBackwards) { |
| 467 this._networkLogView.performSearch(searchConfig, shouldJump, jumpBackwards); | 467 this._networkLogView.performSearch(searchConfig, shouldJump, jumpBackwards); |
| 468 } | 468 } |
| 469 | 469 |
| 470 /** | 470 /** |
| 471 * @override | 471 * @override |
| 472 */ | 472 */ |
| (...skipping 27 matching lines...) Expand all Loading... |
| 500 /** | 500 /** |
| 501 * @override | 501 * @override |
| 502 */ | 502 */ |
| 503 searchCanceled() { | 503 searchCanceled() { |
| 504 this._networkLogView.searchCanceled(); | 504 this._networkLogView.searchCanceled(); |
| 505 } | 505 } |
| 506 | 506 |
| 507 /** | 507 /** |
| 508 * @override | 508 * @override |
| 509 * @param {!Event} event | 509 * @param {!Event} event |
| 510 * @param {!WebInspector.ContextMenu} contextMenu | 510 * @param {!UI.ContextMenu} contextMenu |
| 511 * @param {!Object} target | 511 * @param {!Object} target |
| 512 * @this {WebInspector.NetworkPanel} | 512 * @this {Network.NetworkPanel} |
| 513 */ | 513 */ |
| 514 appendApplicableItems(event, contextMenu, target) { | 514 appendApplicableItems(event, contextMenu, target) { |
| 515 /** | 515 /** |
| 516 * @this {WebInspector.NetworkPanel} | 516 * @this {Network.NetworkPanel} |
| 517 */ | 517 */ |
| 518 function reveal(request) { | 518 function reveal(request) { |
| 519 WebInspector.viewManager.showView('network').then(this.revealAndHighlightR
equest.bind(this, request)); | 519 UI.viewManager.showView('network').then(this.revealAndHighlightRequest.bin
d(this, request)); |
| 520 } | 520 } |
| 521 | 521 |
| 522 /** | 522 /** |
| 523 * @this {WebInspector.NetworkPanel} | 523 * @this {Network.NetworkPanel} |
| 524 */ | 524 */ |
| 525 function appendRevealItem(request) { | 525 function appendRevealItem(request) { |
| 526 contextMenu.appendItem(WebInspector.UIString.capitalize('Reveal in Network
^panel'), reveal.bind(this, request)); | 526 contextMenu.appendItem(Common.UIString.capitalize('Reveal in Network ^pane
l'), reveal.bind(this, request)); |
| 527 } | 527 } |
| 528 | 528 |
| 529 if (event.target.isSelfOrDescendant(this.element)) | 529 if (event.target.isSelfOrDescendant(this.element)) |
| 530 return; | 530 return; |
| 531 | 531 |
| 532 if (target instanceof WebInspector.Resource) { | 532 if (target instanceof SDK.Resource) { |
| 533 var resource = /** @type {!WebInspector.Resource} */ (target); | 533 var resource = /** @type {!SDK.Resource} */ (target); |
| 534 if (resource.request) | 534 if (resource.request) |
| 535 appendRevealItem.call(this, resource.request); | 535 appendRevealItem.call(this, resource.request); |
| 536 return; | 536 return; |
| 537 } | 537 } |
| 538 if (target instanceof WebInspector.UISourceCode) { | 538 if (target instanceof Workspace.UISourceCode) { |
| 539 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (target); | 539 var uiSourceCode = /** @type {!Workspace.UISourceCode} */ (target); |
| 540 var resource = WebInspector.resourceForURL(uiSourceCode.url()); | 540 var resource = Bindings.resourceForURL(uiSourceCode.url()); |
| 541 if (resource && resource.request) | 541 if (resource && resource.request) |
| 542 appendRevealItem.call(this, resource.request); | 542 appendRevealItem.call(this, resource.request); |
| 543 return; | 543 return; |
| 544 } | 544 } |
| 545 | 545 |
| 546 if (!(target instanceof WebInspector.NetworkRequest)) | 546 if (!(target instanceof SDK.NetworkRequest)) |
| 547 return; | 547 return; |
| 548 var request = /** @type {!WebInspector.NetworkRequest} */ (target); | 548 var request = /** @type {!SDK.NetworkRequest} */ (target); |
| 549 if (this._networkItemView && this._networkItemView.isShowing() && this._netw
orkItemView.request() === request) | 549 if (this._networkItemView && this._networkItemView.isShowing() && this._netw
orkItemView.request() === request) |
| 550 return; | 550 return; |
| 551 | 551 |
| 552 appendRevealItem.call(this, request); | 552 appendRevealItem.call(this, request); |
| 553 } | 553 } |
| 554 | 554 |
| 555 /** | 555 /** |
| 556 * @param {!WebInspector.Event} event | 556 * @param {!Common.Event} event |
| 557 */ | 557 */ |
| 558 _onFilmFrameSelected(event) { | 558 _onFilmFrameSelected(event) { |
| 559 var timestamp = /** @type {number} */ (event.data); | 559 var timestamp = /** @type {number} */ (event.data); |
| 560 this._overviewPane.requestWindowTimes(0, timestamp); | 560 this._overviewPane.requestWindowTimes(0, timestamp); |
| 561 } | 561 } |
| 562 | 562 |
| 563 /** | 563 /** |
| 564 * @param {!WebInspector.Event} event | 564 * @param {!Common.Event} event |
| 565 */ | 565 */ |
| 566 _onFilmFrameEnter(event) { | 566 _onFilmFrameEnter(event) { |
| 567 var timestamp = /** @type {number} */ (event.data); | 567 var timestamp = /** @type {number} */ (event.data); |
| 568 this._networkOverview.selectFilmStripFrame(timestamp); | 568 this._networkOverview.selectFilmStripFrame(timestamp); |
| 569 this._networkLogView.selectFilmStripFrame(timestamp / 1000); | 569 this._networkLogView.selectFilmStripFrame(timestamp / 1000); |
| 570 } | 570 } |
| 571 | 571 |
| 572 /** | 572 /** |
| 573 * @param {!WebInspector.Event} event | 573 * @param {!Common.Event} event |
| 574 */ | 574 */ |
| 575 _onFilmFrameExit(event) { | 575 _onFilmFrameExit(event) { |
| 576 this._networkOverview.clearFilmStripFrame(); | 576 this._networkOverview.clearFilmStripFrame(); |
| 577 this._networkLogView.clearFilmStripFrame(); | 577 this._networkLogView.clearFilmStripFrame(); |
| 578 } | 578 } |
| 579 | 579 |
| 580 /** | 580 /** |
| 581 * @param {!WebInspector.Event} event | 581 * @param {!Common.Event} event |
| 582 */ | 582 */ |
| 583 _onUpdateRequest(event) { | 583 _onUpdateRequest(event) { |
| 584 var request = /** @type {!WebInspector.NetworkRequest} */ (event.data); | 584 var request = /** @type {!SDK.NetworkRequest} */ (event.data); |
| 585 this._calculator.updateBoundaries(request); | 585 this._calculator.updateBoundaries(request); |
| 586 // FIXME: Unify all time units across the frontend! | 586 // FIXME: Unify all time units across the frontend! |
| 587 this._overviewPane.setBounds(this._calculator.minimumBoundary() * 1000, this
._calculator.maximumBoundary() * 1000); | 587 this._overviewPane.setBounds(this._calculator.minimumBoundary() * 1000, this
._calculator.maximumBoundary() * 1000); |
| 588 this._networkOverview.updateRequest(request); | 588 this._networkOverview.updateRequest(request); |
| 589 this._overviewPane.scheduleUpdate(); | 589 this._overviewPane.scheduleUpdate(); |
| 590 } | 590 } |
| 591 }; | 591 }; |
| 592 | 592 |
| 593 WebInspector.NetworkPanel.displayScreenshotDelay = 1000; | 593 Network.NetworkPanel.displayScreenshotDelay = 1000; |
| 594 | 594 |
| 595 /** | 595 /** |
| 596 * @implements {WebInspector.ContextMenu.Provider} | 596 * @implements {UI.ContextMenu.Provider} |
| 597 * @unrestricted | 597 * @unrestricted |
| 598 */ | 598 */ |
| 599 WebInspector.NetworkPanel.ContextMenuProvider = class { | 599 Network.NetworkPanel.ContextMenuProvider = class { |
| 600 /** | 600 /** |
| 601 * @override | 601 * @override |
| 602 * @param {!Event} event | 602 * @param {!Event} event |
| 603 * @param {!WebInspector.ContextMenu} contextMenu | 603 * @param {!UI.ContextMenu} contextMenu |
| 604 * @param {!Object} target | 604 * @param {!Object} target |
| 605 */ | 605 */ |
| 606 appendApplicableItems(event, contextMenu, target) { | 606 appendApplicableItems(event, contextMenu, target) { |
| 607 WebInspector.NetworkPanel._instance().appendApplicableItems(event, contextMe
nu, target); | 607 Network.NetworkPanel._instance().appendApplicableItems(event, contextMenu, t
arget); |
| 608 } | 608 } |
| 609 }; | 609 }; |
| 610 | 610 |
| 611 /** | 611 /** |
| 612 * @implements {WebInspector.Revealer} | 612 * @implements {Common.Revealer} |
| 613 * @unrestricted | 613 * @unrestricted |
| 614 */ | 614 */ |
| 615 WebInspector.NetworkPanel.RequestRevealer = class { | 615 Network.NetworkPanel.RequestRevealer = class { |
| 616 /** | 616 /** |
| 617 * @override | 617 * @override |
| 618 * @param {!Object} request | 618 * @param {!Object} request |
| 619 * @return {!Promise} | 619 * @return {!Promise} |
| 620 */ | 620 */ |
| 621 reveal(request) { | 621 reveal(request) { |
| 622 if (!(request instanceof WebInspector.NetworkRequest)) | 622 if (!(request instanceof SDK.NetworkRequest)) |
| 623 return Promise.reject(new Error('Internal error: not a network request')); | 623 return Promise.reject(new Error('Internal error: not a network request')); |
| 624 var panel = WebInspector.NetworkPanel._instance(); | 624 var panel = Network.NetworkPanel._instance(); |
| 625 return WebInspector.viewManager.showView('network').then(panel.revealAndHigh
lightRequest.bind(panel, request)); | 625 return UI.viewManager.showView('network').then(panel.revealAndHighlightReque
st.bind(panel, request)); |
| 626 } | 626 } |
| 627 }; | 627 }; |
| 628 | 628 |
| 629 | 629 |
| 630 /** | 630 /** |
| 631 * @implements {WebInspector.TracingManagerClient} | 631 * @implements {SDK.TracingManagerClient} |
| 632 * @unrestricted | 632 * @unrestricted |
| 633 */ | 633 */ |
| 634 WebInspector.NetworkPanel.FilmStripRecorder = class { | 634 Network.NetworkPanel.FilmStripRecorder = class { |
| 635 /** | 635 /** |
| 636 * @param {!WebInspector.NetworkTimeCalculator} timeCalculator | 636 * @param {!Network.NetworkTimeCalculator} timeCalculator |
| 637 * @param {!WebInspector.FilmStripView} filmStripView | 637 * @param {!Components.FilmStripView} filmStripView |
| 638 */ | 638 */ |
| 639 constructor(timeCalculator, filmStripView) { | 639 constructor(timeCalculator, filmStripView) { |
| 640 this._timeCalculator = timeCalculator; | 640 this._timeCalculator = timeCalculator; |
| 641 this._filmStripView = filmStripView; | 641 this._filmStripView = filmStripView; |
| 642 } | 642 } |
| 643 | 643 |
| 644 /** | 644 /** |
| 645 * @override | 645 * @override |
| 646 */ | 646 */ |
| 647 tracingStarted() { | 647 tracingStarted() { |
| 648 } | 648 } |
| 649 | 649 |
| 650 /** | 650 /** |
| 651 * @override | 651 * @override |
| 652 * @param {!Array.<!WebInspector.TracingManager.EventPayload>} events | 652 * @param {!Array.<!SDK.TracingManager.EventPayload>} events |
| 653 */ | 653 */ |
| 654 traceEventsCollected(events) { | 654 traceEventsCollected(events) { |
| 655 if (this._tracingModel) | 655 if (this._tracingModel) |
| 656 this._tracingModel.addEvents(events); | 656 this._tracingModel.addEvents(events); |
| 657 } | 657 } |
| 658 | 658 |
| 659 /** | 659 /** |
| 660 * @override | 660 * @override |
| 661 */ | 661 */ |
| 662 tracingComplete() { | 662 tracingComplete() { |
| 663 if (!this._tracingModel) | 663 if (!this._tracingModel) |
| 664 return; | 664 return; |
| 665 this._tracingModel.tracingComplete(); | 665 this._tracingModel.tracingComplete(); |
| 666 WebInspector.targetManager.resumeReload(this._target); | 666 SDK.targetManager.resumeReload(this._target); |
| 667 this._target = null; | 667 this._target = null; |
| 668 this._callback(new WebInspector.FilmStripModel(this._tracingModel, this._tim
eCalculator.minimumBoundary() * 1000)); | 668 this._callback(new Components.FilmStripModel(this._tracingModel, this._timeC
alculator.minimumBoundary() * 1000)); |
| 669 delete this._callback; | 669 delete this._callback; |
| 670 } | 670 } |
| 671 | 671 |
| 672 /** | 672 /** |
| 673 * @override | 673 * @override |
| 674 */ | 674 */ |
| 675 tracingBufferUsage() { | 675 tracingBufferUsage() { |
| 676 } | 676 } |
| 677 | 677 |
| 678 /** | 678 /** |
| 679 * @override | 679 * @override |
| 680 * @param {number} progress | 680 * @param {number} progress |
| 681 */ | 681 */ |
| 682 eventsRetrievalProgress(progress) { | 682 eventsRetrievalProgress(progress) { |
| 683 } | 683 } |
| 684 | 684 |
| 685 startRecording() { | 685 startRecording() { |
| 686 this._filmStripView.reset(); | 686 this._filmStripView.reset(); |
| 687 this._filmStripView.setStatusText(WebInspector.UIString('Recording frames...
')); | 687 this._filmStripView.setStatusText(Common.UIString('Recording frames...')); |
| 688 if (this._target) | 688 if (this._target) |
| 689 return; | 689 return; |
| 690 | 690 |
| 691 this._target = WebInspector.targetManager.mainTarget(); | 691 this._target = SDK.targetManager.mainTarget(); |
| 692 if (this._tracingModel) | 692 if (this._tracingModel) |
| 693 this._tracingModel.reset(); | 693 this._tracingModel.reset(); |
| 694 else | 694 else |
| 695 this._tracingModel = new WebInspector.TracingModel(new WebInspector.TempFi
leBackingStorage('tracing')); | 695 this._tracingModel = new SDK.TracingModel(new Bindings.TempFileBackingStor
age('tracing')); |
| 696 this._target.tracingManager.start(this, '-*,disabled-by-default-devtools.scr
eenshot', ''); | 696 this._target.tracingManager.start(this, '-*,disabled-by-default-devtools.scr
eenshot', ''); |
| 697 } | 697 } |
| 698 | 698 |
| 699 /** | 699 /** |
| 700 * @return {boolean} | 700 * @return {boolean} |
| 701 */ | 701 */ |
| 702 isRecording() { | 702 isRecording() { |
| 703 return !!this._target; | 703 return !!this._target; |
| 704 } | 704 } |
| 705 | 705 |
| 706 /** | 706 /** |
| 707 * @param {function(?WebInspector.FilmStripModel)} callback | 707 * @param {function(?Components.FilmStripModel)} callback |
| 708 */ | 708 */ |
| 709 stopRecording(callback) { | 709 stopRecording(callback) { |
| 710 if (!this._target) | 710 if (!this._target) |
| 711 return; | 711 return; |
| 712 | 712 |
| 713 this._target.tracingManager.stop(); | 713 this._target.tracingManager.stop(); |
| 714 WebInspector.targetManager.suspendReload(this._target); | 714 SDK.targetManager.suspendReload(this._target); |
| 715 this._callback = callback; | 715 this._callback = callback; |
| 716 this._filmStripView.setStatusText(WebInspector.UIString('Fetching frames...'
)); | 716 this._filmStripView.setStatusText(Common.UIString('Fetching frames...')); |
| 717 } | 717 } |
| 718 }; | 718 }; |
| 719 | 719 |
| 720 /** | 720 /** |
| 721 * @implements {WebInspector.ActionDelegate} | 721 * @implements {UI.ActionDelegate} |
| 722 * @unrestricted | 722 * @unrestricted |
| 723 */ | 723 */ |
| 724 WebInspector.NetworkPanel.RecordActionDelegate = class { | 724 Network.NetworkPanel.RecordActionDelegate = class { |
| 725 /** | 725 /** |
| 726 * @override | 726 * @override |
| 727 * @param {!WebInspector.Context} context | 727 * @param {!UI.Context} context |
| 728 * @param {string} actionId | 728 * @param {string} actionId |
| 729 * @return {boolean} | 729 * @return {boolean} |
| 730 */ | 730 */ |
| 731 handleAction(context, actionId) { | 731 handleAction(context, actionId) { |
| 732 var panel = WebInspector.context.flavor(WebInspector.NetworkPanel); | 732 var panel = UI.context.flavor(Network.NetworkPanel); |
| 733 console.assert(panel && panel instanceof WebInspector.NetworkPanel); | 733 console.assert(panel && panel instanceof Network.NetworkPanel); |
| 734 panel._toggleRecording(); | 734 panel._toggleRecording(); |
| 735 return true; | 735 return true; |
| 736 } | 736 } |
| 737 }; | 737 }; |
| OLD | NEW |