| OLD | NEW |
| 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 * @unrestricted |
| 6 */ | 6 */ |
| 7 Components.NetworkConditionsSelector = class { | 7 Components.NetworkConditionsSelector = class { |
| 8 /** | 8 /** |
| 9 * @param {function(!Array<!Components.NetworkConditionsGroup>):!Array<?SDK.Ne
tworkManager.Conditions>} populateCallback | 9 * @param {function(!Array<!Components.NetworkConditionsGroup>):!Array<?SDK.Ne
tworkManager.Conditions>} populateCallback |
| 10 * @param {function(number)} selectCallback | 10 * @param {function(number)} selectCallback |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 selectedIndex = index; | 164 selectedIndex = index; |
| 165 button.setText(options[index].title); | 165 button.setText(options[index].title); |
| 166 } | 166 } |
| 167 } | 167 } |
| 168 | 168 |
| 169 /** | 169 /** |
| 170 * @return {!UI.ToolbarCheckbox} | 170 * @return {!UI.ToolbarCheckbox} |
| 171 */ | 171 */ |
| 172 static createOfflineToolbarCheckbox() { | 172 static createOfflineToolbarCheckbox() { |
| 173 var checkbox = new UI.ToolbarCheckbox( | 173 var checkbox = new UI.ToolbarCheckbox( |
| 174 Common.UIString('Offline'), Common.UIString('Force disconnected from net
work'), undefined, forceOffline); | 174 Common.UIString('Offline'), Common.UIString('Force disconnected from net
work'), forceOffline); |
| 175 SDK.multitargetNetworkManager.addEventListener( | 175 SDK.multitargetNetworkManager.addEventListener( |
| 176 SDK.MultitargetNetworkManager.Events.ConditionsChanged, networkCondition
sChanged); | 176 SDK.MultitargetNetworkManager.Events.ConditionsChanged, networkCondition
sChanged); |
| 177 checkbox.setChecked(SDK.multitargetNetworkManager.networkConditions() === SD
K.NetworkManager.OfflineConditions); | 177 checkbox.setChecked(SDK.multitargetNetworkManager.networkConditions() === SD
K.NetworkManager.OfflineConditions); |
| 178 | 178 |
| 179 var lastNetworkConditions; | 179 var lastNetworkConditions; |
| 180 | 180 |
| 181 function forceOffline() { | 181 function forceOffline() { |
| 182 if (checkbox.checked()) { | 182 if (checkbox.checked()) { |
| 183 lastNetworkConditions = SDK.multitargetNetworkManager.networkConditions(
); | 183 lastNetworkConditions = SDK.multitargetNetworkManager.networkConditions(
); |
| 184 SDK.multitargetNetworkManager.setNetworkConditions(SDK.NetworkManager.Of
flineConditions); | 184 SDK.multitargetNetworkManager.setNetworkConditions(SDK.NetworkManager.Of
flineConditions); |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 543 priorityMap = new Map(); | 543 priorityMap = new Map(); |
| 544 priorityMap.set(Protocol.Network.ResourcePriority.VeryLow, 1); | 544 priorityMap.set(Protocol.Network.ResourcePriority.VeryLow, 1); |
| 545 priorityMap.set(Protocol.Network.ResourcePriority.Low, 2); | 545 priorityMap.set(Protocol.Network.ResourcePriority.Low, 2); |
| 546 priorityMap.set(Protocol.Network.ResourcePriority.Medium, 3); | 546 priorityMap.set(Protocol.Network.ResourcePriority.Medium, 3); |
| 547 priorityMap.set(Protocol.Network.ResourcePriority.High, 4); | 547 priorityMap.set(Protocol.Network.ResourcePriority.High, 4); |
| 548 priorityMap.set(Protocol.Network.ResourcePriority.VeryHigh, 5); | 548 priorityMap.set(Protocol.Network.ResourcePriority.VeryHigh, 5); |
| 549 Components.prioritySymbolToNumericMap._symbolicToNumericPriorityMap = priority
Map; | 549 Components.prioritySymbolToNumericMap._symbolicToNumericPriorityMap = priority
Map; |
| 550 | 550 |
| 551 return priorityMap; | 551 return priorityMap; |
| 552 }; | 552 }; |
| OLD | NEW |