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/mobile_throttling/ThrottlingSelector.js

Issue 2938503002: DevTools: unify Network & CPU throttling (Closed)
Patch Set: rebaseline Created 3 years, 5 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 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 /** 4
5 * @unrestricted 5 MobileThrottling.NetworkThrottlingSelector = class {
6 */
7 MobileThrottling.NetworkConditionsSelector = class {
8 /** 6 /**
9 * @param {function(!Array<!MobileThrottling.NetworkConditionsGroup>):!Array<? SDK.NetworkManager.Conditions>} populateCallback 7 * @param {function(!Array<!MobileThrottling.NetworkThrottlingConditionsGroup> ):!Array<?SDK.NetworkManager.Conditions>} populateCallback
10 * @param {function(number)} selectCallback 8 * @param {function(number)} selectCallback
11 */ 9 */
12 constructor(populateCallback, selectCallback) { 10 constructor(populateCallback, selectCallback) {
13 this._populateCallback = populateCallback; 11 this._populateCallback = populateCallback;
14 this._selectCallback = selectCallback; 12 this._selectCallback = selectCallback;
15 this._customSetting = Common.moduleSetting('customNetworkConditions'); 13 MobileThrottling.customNetworkConditionsSetting().addChangeListener(this._po pulateOptions, this);
16 this._customSetting.addChangeListener(this._populateOptions, this); 14 SDK.multitargetNetworkManager.addEventListener(
17 this._manager = SDK.multitargetNetworkManager; 15 SDK.MultitargetNetworkManager.Events.ConditionsChanged, this._networkCon ditionsChanged, this);
18 this._manager.addEventListener( 16 /** @type {!Array<?SDK.NetworkManager.Conditions>} */
19 SDK.MultitargetNetworkManager.Events.ConditionsChanged, this._conditions Changed, this); 17 this._options;
20 this._populateOptions(); 18 this._populateOptions();
21 } 19 }
22 20
23 /** 21 /**
24 * @param {number} throughput
25 * @param {boolean=} plainText
26 * @return {string}
27 */
28 static throughputText(throughput, plainText) {
29 if (throughput < 0)
30 return '';
31 var throughputInKbps = throughput / (1024 / 8);
32 var delimiter = plainText ? '' : ' ';
33 if (throughputInKbps < 1024)
34 return Common.UIString('%d%skb/s', throughputInKbps, delimiter);
35 if (throughputInKbps < 1024 * 10)
36 return Common.UIString('%.1f%sMb/s', throughputInKbps / 1024, delimiter);
37 return Common.UIString('%d%sMb/s', (throughputInKbps / 1024) | 0, delimiter) ;
38 }
39
40 /**
41 * @param {!HTMLSelectElement} selectElement 22 * @param {!HTMLSelectElement} selectElement
23 * @return {!MobileThrottling.NetworkThrottlingSelector}
42 */ 24 */
43 static decorateSelect(selectElement) { 25 static decorateSelect(selectElement) {
44 var options = []; 26 var options = [];
45 var selector = new MobileThrottling.NetworkConditionsSelector(populate, sele ct); 27 var selector = new MobileThrottling.NetworkThrottlingSelector(populate, sele ct);
46 selectElement.addEventListener('change', optionSelected, false); 28 selectElement.addEventListener('change', optionSelected, false);
29 return selector;
47 30
48 /** 31 /**
49 * @param {!Array.<!MobileThrottling.NetworkConditionsGroup>} groups 32 * @param {!Array.<!MobileThrottling.NetworkThrottlingConditionsGroup>} grou ps
50 * @return {!Array<?SDK.NetworkManager.Conditions>} 33 * @return {!Array<?SDK.NetworkManager.Conditions>}
51 */ 34 */
52 function populate(groups) { 35 function populate(groups) {
53 selectElement.removeChildren(); 36 selectElement.removeChildren();
54 options = []; 37 options = [];
55 for (var i = 0; i < groups.length; ++i) { 38 for (var i = 0; i < groups.length; ++i) {
56 var group = groups[i]; 39 var group = groups[i];
57 var groupElement = selectElement.createChild('optgroup'); 40 var groupElement = selectElement.createChild('optgroup');
58 groupElement.label = group.title; 41 groupElement.label = group.title;
59 for (var conditions of group.items) { 42 for (var conditions of group.items) {
60 var title = Common.UIString(conditions.title); 43 var title = conditions.title;
61 var option = new Option(title, title); 44 var option = new Option(title, title);
62 groupElement.appendChild(option); 45 groupElement.appendChild(option);
63 options.push(conditions); 46 options.push(conditions);
64 } 47 }
65 if (i === groups.length - 1) { 48 if (i === groups.length - 1) {
66 groupElement.appendChild(new Option(Common.UIString('Add\u2026'), Comm on.UIString('Add\u2026'))); 49 groupElement.appendChild(new Option(Common.UIString('Add\u2026'), Comm on.UIString('Add\u2026')));
67 options.push(null); 50 options.push(null);
68 } 51 }
69 } 52 }
70 return options; 53 return options;
71 } 54 }
72 55
73 function optionSelected() { 56 function optionSelected() {
74 if (selectElement.selectedIndex === selectElement.options.length - 1) 57 if (selectElement.selectedIndex === selectElement.options.length - 1)
75 selector.revealAndUpdate(); 58 selector._revealAndUpdate();
76 else 59 else
77 selector.optionSelected(options[selectElement.selectedIndex]); 60 selector._optionSelected(options[selectElement.selectedIndex]);
78 } 61 }
79 62
80 /** 63 /**
81 * @param {number} index 64 * @param {number} index
82 */ 65 */
83 function select(index) { 66 function select(index) {
84 if (selectElement.selectedIndex !== index) 67 if (selectElement.selectedIndex !== index)
85 selectElement.selectedIndex = index; 68 selectElement.selectedIndex = index;
86 } 69 }
87 } 70 }
88 71
89 /** 72 /**
73 * @return {!UI.ToolbarCheckbox}
74 */
75 static createOfflineToolbarCheckbox() {
76 var checkbox = new UI.ToolbarCheckbox(
77 Common.UIString('Offline'), Common.UIString('Force disconnected from net work'), forceOffline);
78 SDK.multitargetNetworkManager.addEventListener(
79 SDK.MultitargetNetworkManager.Events.ConditionsChanged, networkCondition sChanged);
80 checkbox.setChecked(isOfflineConditions(SDK.multitargetNetworkManager.networ kConditions()));
81
82 function forceOffline() {
83 if (checkbox.checked()) {
84 MobileThrottling.NetworkThrottlingSelector._lastNetworkThrottlingConditi ons =
85 SDK.multitargetNetworkManager.networkConditions();
86 SDK.multitargetNetworkManager.setNetworkConditions(SDK.NetworkManager.Of flineConditions);
87 } else {
88 SDK.multitargetNetworkManager.setNetworkConditions(
89 MobileThrottling.NetworkThrottlingSelector._lastNetworkThrottlingCon ditions);
90 }
91 }
92
93 function networkConditionsChanged() {
94 checkbox.setChecked(isOfflineConditions(SDK.multitargetNetworkManager.netw orkConditions()));
95 }
96
97 function isOfflineConditions(conditions) {
98 return conditions.latency === SDK.NetworkManager.OfflineConditions.latency &&
99 conditions.upload === SDK.NetworkManager.OfflineConditions.upload &&
100 conditions.download === SDK.NetworkManager.OfflineConditions.download;
101 }
102 return checkbox;
103 }
104
105 _populateOptions() {
106 var disabledGroup = {title: Common.UIString('Disabled'), items: [MobileThrot tling.NoThrottlingConditions]};
107 var presetsGroup = {title: Common.UIString('Common'), items: MobileThrottlin g.networkPresets};
108 var advancedGroup = {title: Common.UIString('Advanced'), items: MobileThrott ling.advancedNetworkPresets};
109 var customGroup = {
110 title: Common.UIString('Custom'),
111 items: MobileThrottling.customNetworkConditionsSetting().get()
112 };
113 this._options = this._populateCallback([disabledGroup, presetsGroup, advance dGroup, customGroup]);
114 if (!this._networkConditionsChanged()) {
115 for (var i = this._options.length - 1; i >= 0; i--) {
116 if (this._options[i]) {
117 this._optionSelected(/** @type {!MobileThrottling.Conditions} */ (this ._options[i]));
118 break;
119 }
120 }
121 }
122 }
123
124 _revealAndUpdate() {
125 Common.Revealer.reveal(MobileThrottling.customNetworkConditionsSetting());
126 this._networkConditionsChanged();
127 }
128
129 /**
130 * @param {!SDK.NetworkManager.Conditions} conditions
131 */
132 _optionSelected(conditions) {
133 SDK.multitargetNetworkManager.setNetworkConditions(conditions);
134 }
135
136 /**
137 * @return {boolean} returns false if selected condition no longer exists
138 */
139 _networkConditionsChanged() {
140 var value = SDK.multitargetNetworkManager.networkConditions();
141 for (var index = 0; index < this._options.length; ++index) {
142 var option = this._options[index];
143 if (option && option.download === value.download && option.upload === valu e.upload &&
144 option.latency === value.latency) {
145 this._selectCallback(index);
146 return true;
147 }
148 }
149 return false;
150 }
151 };
152
153 MobileThrottling.MobileThrottlingSelector = class {
154 /**
155 * @param {function(!Array<!MobileThrottling.MobileThrottlingConditionsGroup>) :!MobileThrottling.ConditionsList} populateCallback
156 * @param {function(number)} selectCallback
157 */
158 constructor(populateCallback, selectCallback) {
159 this._populateCallback = populateCallback;
160 this._selectCallback = selectCallback;
161 MobileThrottling.cpuThrottlingRateSetting().addChangeListener(this._conditio nsChanged, this);
162 SDK.multitargetNetworkManager.addEventListener(
163 SDK.MultitargetNetworkManager.Events.ConditionsChanged, this._conditions Changed, this);
164 /** @type {!MobileThrottling.ConditionsList} */
165 this._options = this._populateOptions();
166 this._conditionsChanged();
167 }
168
169 /**
90 * @return {!UI.ToolbarMenuButton} 170 * @return {!UI.ToolbarMenuButton}
91 */ 171 */
92 static createToolbarMenuButton() { 172 static createToolbarMenuButton() {
93 var button = new UI.ToolbarMenuButton(appendItems); 173 var button = new UI.ToolbarMenuButton(appendItems);
174 button.setTitle(Common.UIString('Throttling'));
94 button.setGlyph(''); 175 button.setGlyph('');
95 button.turnIntoSelect(); 176 button.turnIntoSelect();
96 177
97 /** @type {!Array<?SDK.NetworkManager.Conditions>} */ 178 /** @type {!MobileThrottling.ConditionsList} */
98 var options = []; 179 var options = [];
99 var selectedIndex = -1; 180 var selectedIndex = -1;
100 var selector = new MobileThrottling.NetworkConditionsSelector(populate, sele ct); 181 var selector = new MobileThrottling.MobileThrottlingSelector(populate, selec t);
101 return button; 182 return button;
102 183
103 /** 184 /**
104 * @param {!UI.ContextMenu} contextMenu 185 * @param {!UI.ContextMenu} contextMenu
105 */ 186 */
106 function appendItems(contextMenu) { 187 function appendItems(contextMenu) {
107 for (var index = 0; index < options.length; ++index) { 188 for (var index = 0; index < options.length; ++index) {
108 var conditions = options[index]; 189 var conditions = options[index];
109 if (!conditions) { 190 if (!conditions) {
110 contextMenu.appendSeparator(); 191 contextMenu.appendSeparator();
111 } else { 192 continue;
112 contextMenu.appendCheckboxItem(
113 Common.UIString(conditions.title), selector.optionSelected.bind(se lector, conditions),
114 selectedIndex === index);
115 } 193 }
194 if (conditions.title === MobileThrottling.CustomConditions.title &&
195 conditions.description === MobileThrottling.CustomConditions.descrip tion)
196 continue;
197 contextMenu.appendCheckboxItem(
198 Common.UIString(conditions.title),
199 selector._optionSelected.bind(selector, /** @type {!MobileThrottling .Conditions} */ (conditions)),
200 selectedIndex === index);
116 } 201 }
117 contextMenu.appendItem(Common.UIString('Edit\u2026'), selector.revealAndUp date.bind(selector));
118 } 202 }
119 203
120 /** 204 /**
121 * @param {!Array.<!MobileThrottling.NetworkConditionsGroup>} groups 205 * @param {!Array.<!MobileThrottling.MobileThrottlingConditionsGroup>} group s
122 * @return {!Array<?SDK.NetworkManager.Conditions>} 206 * @return {!MobileThrottling.ConditionsList}
123 */ 207 */
124 function populate(groups) { 208 function populate(groups) {
125 options = []; 209 options = [];
126 for (var group of groups) { 210 for (var group of groups) {
127 for (var conditions of group.items) 211 for (var conditions of group.items)
128 options.push(conditions); 212 options.push(conditions);
129 options.push(null); 213 options.push(null);
130 } 214 }
131 return options; 215 return options;
132 } 216 }
133 217
134 /** 218 /**
135 * @param {number} index 219 * @param {number} index
136 */ 220 */
137 function select(index) { 221 function select(index) {
138 selectedIndex = index; 222 selectedIndex = index;
139 button.setText(options[index].title); 223 button.setText(options[index].title);
224 button.setTitle(options[index].description || 'Throttling');
140 } 225 }
141 } 226 }
142 227
143 /** 228 /**
144 * @return {!UI.ToolbarCheckbox} 229 * @return {!MobileThrottling.ConditionsList}
145 */ 230 */
146 static createOfflineToolbarCheckbox() {
147 var checkbox = new UI.ToolbarCheckbox(
148 Common.UIString('Offline'), Common.UIString('Force disconnected from net work'), forceOffline);
149 SDK.multitargetNetworkManager.addEventListener(
150 SDK.MultitargetNetworkManager.Events.ConditionsChanged, networkCondition sChanged);
151 checkbox.setChecked(SDK.multitargetNetworkManager.networkConditions() === SD K.NetworkManager.OfflineConditions);
152
153 function forceOffline() {
154 if (checkbox.checked()) {
155 MobileThrottling.NetworkConditionsSelector._lastNetworkConditions =
156 SDK.multitargetNetworkManager.networkConditions();
157 SDK.multitargetNetworkManager.setNetworkConditions(SDK.NetworkManager.Of flineConditions);
158 } else {
159 SDK.multitargetNetworkManager.setNetworkConditions(
160 MobileThrottling.NetworkConditionsSelector._lastNetworkConditions);
161 }
162 }
163
164 function networkConditionsChanged() {
165 var conditions = SDK.multitargetNetworkManager.networkConditions();
166 checkbox.setChecked(conditions === SDK.NetworkManager.OfflineConditions);
167 }
168 return checkbox;
169 }
170
171 _populateOptions() { 231 _populateOptions() {
172 var customGroup = {title: Common.UIString('Custom'), items: this._customSett ing.get()}; 232 var disabledGroup = {title: Common.UIString('Disabled'), items: [MobileThrot tling.NoThrottlingConditions]};
173 var presetsGroup = {title: Common.UIString('Presets'), items: MobileThrottli ng.NetworkConditionsSelector.presets}; 233 var presetsGroup = {title: Common.UIString('Presets'), items: MobileThrottli ng.mobilePresets};
174 var disabledGroup = {title: Common.UIString('Disabled'), items: [SDK.Network Manager.NoThrottlingConditions]}; 234 var advancedGroup = {title: Common.UIString('Advanced'), items: MobileThrott ling.advancedMobilePresets};
175 this._options = this._populateCallback([disabledGroup, presetsGroup, customG roup]); 235 return this._populateCallback([disabledGroup, presetsGroup, advancedGroup]);
176 if (!this._conditionsChanged()) {
177 for (var i = this._options.length - 1; i >= 0; i--) {
178 if (this._options[i]) {
179 this.optionSelected(/** @type {!SDK.NetworkManager.Conditions} */ (thi s._options[i]));
180 break;
181 }
182 }
183 }
184 }
185
186 revealAndUpdate() {
187 Common.Revealer.reveal(this._customSetting);
188 this._conditionsChanged();
189 } 236 }
190 237
191 /** 238 /**
192 * @param {!SDK.NetworkManager.Conditions} conditions 239 * @param {!MobileThrottling.Conditions} conditions
193 */ 240 */
194 optionSelected(conditions) { 241 _optionSelected(conditions) {
195 this._manager.setNetworkConditions(conditions); 242 SDK.multitargetNetworkManager.setNetworkConditions(conditions);
243 MobileThrottling.cpuThrottlingRateSetting().set(conditions.cpuThrottlingRate );
196 } 244 }
197 245
198 /**
199 * @return {boolean}
200 */
201 _conditionsChanged() { 246 _conditionsChanged() {
202 var value = this._manager.networkConditions(); 247 var value = Object.assign(
248 {}, SDK.multitargetNetworkManager.networkConditions(),
249 {cpuThrottlingRate: MobileThrottling.cpuThrottlingRateSetting().get()});
203 for (var index = 0; index < this._options.length; ++index) { 250 for (var index = 0; index < this._options.length; ++index) {
204 var option = this._options[index]; 251 var option = this._options[index];
205 if (option && option.download === value.download && option.upload === valu e.upload && 252 if (option && option.download === value.download && option.upload === valu e.upload &&
206 option.latency === value.latency && option.title === value.title) { 253 option.latency === value.latency && option.cpuThrottlingRate === value .cpuThrottlingRate) {
207 this._selectCallback(index); 254 this._selectCallback(index);
208 return true; 255 return;
209 } 256 }
210 } 257 }
211 return false; 258 this._selectCallback(this._options.indexOf(MobileThrottling.CustomConditions ));
212 } 259 }
213 }; 260 };
214 261
262 /**
263 * @return {!Common.Setting<!Array<!SDK.NetworkManager.Conditions>>}
264 */
265 MobileThrottling.customNetworkConditionsSetting = function() {
266 if (!MobileThrottling._customNetworkConditionsSetting)
267 MobileThrottling._customNetworkConditionsSetting = Common.moduleSetting('cus tomNetworkConditions');
268 return MobileThrottling._customNetworkConditionsSetting;
269 };
270
271 /**
272 * @return {!Common.Setting<number>}
273 */
274 MobileThrottling.cpuThrottlingRateSetting = function() {
275 if (!MobileThrottling._cpuThrottlingRateSetting)
276 MobileThrottling._cpuThrottlingRateSetting = Common.moduleSetting('cpuThrott lingRate');
277 return MobileThrottling._cpuThrottlingRateSetting;
278 };
279
280 /**
281 * Superset of SDK.NetworkManager.Conditions
282 * @typedef {{
dgozman 2017/06/28 22:33:09 Should we have network:SDK.NetworkManager.Conditio
chenwilliam 2017/06/29 20:34:02 I agree - done.
283 * download: number,
284 * upload: number,
285 * latency: number,
286 * title: string,
287 * description: (string|undefined),
288 * cpuThrottlingRate: number
289 * }}
290 **/
291 MobileThrottling.Conditions;
292
293 /** @enum {number} */
294 MobileThrottling.CPUThrottlingRates = {
295 NoThrottling: 1,
296 MidTierMobile: 4,
297 LowEndMobile: 6,
298 };
299
300 MobileThrottling.NoThrottlingConditions = /** @type {!MobileThrottling.Condition s} */ (
301 Object.assign(/** @type {!Object} */ ({}), SDK.NetworkManager.NoThrottlingCo nditions, {
302 cpuThrottlingRate: MobileThrottling.CPUThrottlingRates.NoThrottling,
303 }));
304
305 MobileThrottling.OfflineConditions = /** @type {!MobileThrottling.Conditions} */ (
306 Object.assign(/** @type {!Object} */ ({}), SDK.NetworkManager.OfflineConditi ons, {
307 cpuThrottlingRate: MobileThrottling.CPUThrottlingRates.MidTierMobile,
308 }));
309
310 MobileThrottling.LieFiMobileConditions = /** @type {!MobileThrottling.Conditions } */ (
311 Object.assign(/** @type {!Object} */ ({}), SDK.NetworkManager.LieFiMobileCon ditions, {
312 cpuThrottlingRate: MobileThrottling.CPUThrottlingRates.MidTierMobile,
313 }));
314
315 /**
316 * @typedef {{
317 * title: string,
318 * description: string
319 * }}
320 **/
321 MobileThrottling.PlaceholderConditions;
322
323 /** @type {!MobileThrottling.PlaceholderConditions} */
324 MobileThrottling.CustomConditions = {
325 title: Common.UIString('Custom'),
326 description: Common.UIString('Check Network and Performance panels'),
327 };
328
215 /** @typedef {!{title: string, items: !Array<!SDK.NetworkManager.Conditions>}} * / 329 /** @typedef {!{title: string, items: !Array<!SDK.NetworkManager.Conditions>}} * /
216 MobileThrottling.NetworkConditionsGroup; 330 MobileThrottling.NetworkThrottlingConditionsGroup;
217 331
332 /** @typedef {!{title: string, items: !Array<!MobileThrottling.Conditions|!Mobil eThrottling.PlaceholderConditions>}} */
333 MobileThrottling.MobileThrottlingConditionsGroup;
218 334
219 /** @type {!Array.<!SDK.NetworkManager.Conditions>} */ 335 /** @typedef {!Array<?MobileThrottling.Conditions|!MobileThrottling.PlaceholderC onditions>} */
220 MobileThrottling.NetworkConditionsSelector.presets = [ 336 MobileThrottling.ConditionsList;
337
338 /** @type {!MobileThrottling.Conditions} */
339 MobileThrottling.LowEndMobileConditions = /** @type {!MobileThrottling.Condition s} */ (
340 Object.assign(/** @type {!Object} */ ({}), SDK.NetworkManager.Slow3GConditio ns, {
341 title: Common.UIString('Low-end mobile'),
342 cpuThrottlingRate: MobileThrottling.CPUThrottlingRates.LowEndMobile,
343 description: Common.UIString('Slow 3G & 6x CPU slowdown')
344 }));
345
346 /** @type {!MobileThrottling.Conditions} */
347 MobileThrottling.MidTierMobileConditions = /** @type {!MobileThrottling.Conditio ns} */ (
348 Object.assign(/** @type {!Object} */ ({}), SDK.NetworkManager.Fast3GConditio ns, {
349 title: Common.UIString('Mid-tier mobile'),
350 cpuThrottlingRate: MobileThrottling.CPUThrottlingRates.MidTierMobile,
351 description: Common.UIString('Fast 3G & 4x CPU slowdown')
352 }));
353
354 /** @type {!Array.<!MobileThrottling.Conditions>} */
355 MobileThrottling.mobilePresets = [
356 MobileThrottling.MidTierMobileConditions, MobileThrottling.LowEndMobileConditi ons, MobileThrottling.CustomConditions
357 ];
358
359 /** @type {!Array.<!MobileThrottling.Conditions>} */
360 MobileThrottling.advancedMobilePresets = [
361 MobileThrottling.OfflineConditions,
362 MobileThrottling.LieFiMobileConditions,
363 ];
364
365 /** @type {!Array<!SDK.NetworkManager.Conditions>} */
366 MobileThrottling.networkPresets = [
367 SDK.NetworkManager.Fast3GConditions,
368 SDK.NetworkManager.Slow3GConditions,
369 ];
370
371 /** @type {!Array<!SDK.NetworkManager.Conditions>} */
372 MobileThrottling.advancedNetworkPresets = [
221 SDK.NetworkManager.OfflineConditions, 373 SDK.NetworkManager.OfflineConditions,
222 {title: 'Slow 3G', download: 500 * 1024 / 8 * .8, upload: 500 * 1024 / 8 * .8, latency: 400 * 5}, 374 SDK.NetworkManager.LieFiMobileConditions,
223 {title: 'Fast 3G', download: 1.6 * 1024 * 1024 / 8 * .9, upload: 750 * 1024 / 8 * .9, latency: 150 * 3.75}
224 ]; 375 ];
225 376
226 /** 377 /**
227 * @implements {UI.ActionDelegate} 378 * @implements {UI.ActionDelegate}
228 * @unrestricted 379 * @unrestricted
229 */ 380 */
230 MobileThrottling.NetworkConditionsActionDelegate = class { 381 MobileThrottling.NetworkConditionsActionDelegate = class {
231 /** 382 /**
232 * @override 383 * @override
233 * @param {!UI.Context} context 384 * @param {!UI.Context} context
234 * @param {string} actionId 385 * @param {string} actionId
235 * @return {boolean} 386 * @return {boolean}
236 */ 387 */
237 handleAction(context, actionId) { 388 handleAction(context, actionId) {
238 if (actionId === 'network-conditions.network-online') { 389 if (actionId === 'network-conditions.network-online') {
239 SDK.multitargetNetworkManager.setNetworkConditions(SDK.NetworkManager.NoTh rottlingConditions); 390 SDK.multitargetNetworkManager.setNetworkConditions(MobileThrottling.NoThro ttlingConditions);
240 return true; 391 return true;
241 } 392 }
242 if (actionId === 'network-conditions.network-offline') { 393 if (actionId === 'network-conditions.network-offline') {
243 SDK.multitargetNetworkManager.setNetworkConditions(SDK.NetworkManager.Offl ineConditions); 394 SDK.multitargetNetworkManager.setNetworkConditions(MobileThrottling.Offlin eConditions);
244 return true; 395 return true;
245 } 396 }
246 return false; 397 return false;
247 } 398 }
248 }; 399 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698