Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(487)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/network/NetworkPanel.js

Issue 2668413003: DevTools: extract NetworkConditionsSelector into its own module (Closed)
Patch Set: rebaseline Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 'change', this._onPreserveLogCheckboxChanged.bind(this), false); 170 'change', this._onPreserveLogCheckboxChanged.bind(this), false);
171 this._panelToolbar.appendToolbarItem(this._preserveLogCheckbox); 171 this._panelToolbar.appendToolbarItem(this._preserveLogCheckbox);
172 172
173 this._disableCacheCheckbox = new UI.ToolbarCheckbox( 173 this._disableCacheCheckbox = new UI.ToolbarCheckbox(
174 Common.UIString('Disable cache'), Common.UIString('Disable cache (while DevTools is open)'), 174 Common.UIString('Disable cache'), Common.UIString('Disable cache (while DevTools is open)'),
175 Common.moduleSetting('cacheDisabled')); 175 Common.moduleSetting('cacheDisabled'));
176 this._panelToolbar.appendToolbarItem(this._disableCacheCheckbox); 176 this._panelToolbar.appendToolbarItem(this._disableCacheCheckbox);
177 177
178 this._panelToolbar.appendSeparator(); 178 this._panelToolbar.appendSeparator();
179 this._panelToolbar.appendToolbarItem(this._createBlockedURLsButton()); 179 this._panelToolbar.appendToolbarItem(this._createBlockedURLsButton());
180 this._panelToolbar.appendToolbarItem(Components.NetworkConditionsSelector.cr eateOfflineToolbarCheckbox()); 180 this._panelToolbar.appendToolbarItem(NetworkConditions.NetworkConditionsSele ctor.createOfflineToolbarCheckbox());
181 this._panelToolbar.appendToolbarItem(this._createNetworkConditionsSelect()); 181 this._panelToolbar.appendToolbarItem(this._createNetworkConditionsSelect());
182 this._panelToolbar.appendToolbarItem(new UI.ToolbarItem(this._progressBarCon tainer)); 182 this._panelToolbar.appendToolbarItem(new UI.ToolbarItem(this._progressBarCon tainer));
183 } 183 }
184 184
185 /** 185 /**
186 * @return {!UI.ToolbarItem} 186 * @return {!UI.ToolbarItem}
187 */ 187 */
188 _createBlockedURLsButton() { 188 _createBlockedURLsButton() {
189 var setting = Common.moduleSetting('blockedURLs'); 189 var setting = Common.moduleSetting('blockedURLs');
190 setting.addChangeListener(updateAction); 190 setting.addChangeListener(updateAction);
191 var action = /** @type {!UI.Action }*/ (UI.actionRegistry.action('network.bl ocked-urls.show')); 191 var action = /** @type {!UI.Action }*/ (UI.actionRegistry.action('network.bl ocked-urls.show'));
192 var button = UI.Toolbar.createActionButton(action); 192 var button = UI.Toolbar.createActionButton(action);
193 button.setVisible(Runtime.experiments.isEnabled('requestBlocking')); 193 button.setVisible(Runtime.experiments.isEnabled('requestBlocking'));
194 updateAction(); 194 updateAction();
195 return button; 195 return button;
196 196
197 function updateAction() { 197 function updateAction() {
198 action.setToggled(!!setting.get().length); 198 action.setToggled(!!setting.get().length);
199 } 199 }
200 } 200 }
201 201
202 /** 202 /**
203 * @return {!UI.ToolbarComboBox} 203 * @return {!UI.ToolbarComboBox}
204 */ 204 */
205 _createNetworkConditionsSelect() { 205 _createNetworkConditionsSelect() {
206 var toolbarItem = new UI.ToolbarComboBox(null); 206 var toolbarItem = new UI.ToolbarComboBox(null);
207 toolbarItem.setMaxWidth(140); 207 toolbarItem.setMaxWidth(140);
208 Components.NetworkConditionsSelector.decorateSelect(toolbarItem.selectElemen t()); 208 NetworkConditions.NetworkConditionsSelector.decorateSelect(toolbarItem.selec tElement());
209 return toolbarItem; 209 return toolbarItem;
210 } 210 }
211 211
212 _toggleRecording() { 212 _toggleRecording() {
213 if (!this._preserveLogCheckbox.checked() && !this._toggleRecordAction.toggle d()) 213 if (!this._preserveLogCheckbox.checked() && !this._toggleRecordAction.toggle d())
214 this._reset(); 214 this._reset();
215 this._toggleRecord(!this._toggleRecordAction.toggled()); 215 this._toggleRecord(!this._toggleRecordAction.toggled());
216 } 216 }
217 217
218 /** 218 /**
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 * @param {string} actionId 726 * @param {string} actionId
727 * @return {boolean} 727 * @return {boolean}
728 */ 728 */
729 handleAction(context, actionId) { 729 handleAction(context, actionId) {
730 var panel = UI.context.flavor(Network.NetworkPanel); 730 var panel = UI.context.flavor(Network.NetworkPanel);
731 console.assert(panel && panel instanceof Network.NetworkPanel); 731 console.assert(panel && panel instanceof Network.NetworkPanel);
732 panel._toggleRecording(); 732 panel._toggleRecording();
733 return true; 733 return true;
734 } 734 }
735 }; 735 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698