Commit c8a44298 authored by Nathan Bruer's avatar Nathan Bruer Committed by Commit Bot

[Devtools] Removed @unrestricted from NetworkConfigView

For code health removes @unrestricted closure doc from
NetworkConfigView.js.

R=dgozman,luoe,einbinder
BUG=None

Change-Id: Ia7ffd3260602fc892e5a16df44642cab7fc1975e
Reviewed-on: https://chromium-review.googlesource.com/691188
Commit-Queue: Blaise Bruer <allada@chromium.org>
Reviewed-by: default avatarDmitry Gozman <dgozman@chromium.org>
Reviewed-by: default avatarAndrey Kosyakov <caseq@chromium.org>
Cr-Commit-Position: refs/heads/master@{#505845}
parent 8e7c1213
...@@ -15,8 +15,9 @@ function test() { ...@@ -15,8 +15,9 @@ function test() {
var deviceModeThrottling = deviceModeView._toolbar._throttlingConditionsItem; var deviceModeThrottling = deviceModeView._toolbar._throttlingConditionsItem;
var networkPanelThrottling = UI.panels.network.throttlingSelectForTest(); var networkPanelThrottling = UI.panels.network.throttlingSelectForTest();
var networkPanelOfflineCheckbox = UI.panels.network.offlineCheckboxForTest().inputElement; var networkPanelOfflineCheckbox = UI.panels.network.offlineCheckboxForTest().inputElement;
var networkConfigView = self.runtime.sharedInstance(Network.NetworkConfigView);
var networkConditionsDrawerThrottlingSelector = var networkConditionsDrawerThrottlingSelector =
self.runtime.sharedInstance(Network.NetworkConfigView)._networkThrottlingSelect; networkConfigView.contentElement.querySelector('.network-config-throttling select.chrome-select');
var performancePanelNetworkThrottling = UI.panels.timeline._networkThrottlingSelect; var performancePanelNetworkThrottling = UI.panels.timeline._networkThrottlingSelect;
var performancePanelCPUThrottling = UI.panels.timeline._cpuThrottlingSelect; var performancePanelCPUThrottling = UI.panels.timeline._cpuThrottlingSelect;
......
// Copyright (c) 2015 The Chromium Authors. All rights reserved. // Copyright (c) 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
/**
* @unrestricted
*/
Network.NetworkConfigView = class extends UI.VBox { Network.NetworkConfigView = class extends UI.VBox {
constructor() { constructor() {
super(true); super(true);
/** @type {!Element} */
this._autoCheckbox;
/** @type {!{input: !Element, select: !Element}} */
this._customSelectAndInput;
this.registerRequiredCSS('network/networkConfigView.css'); this.registerRequiredCSS('network/networkConfigView.css');
this.contentElement.classList.add('network-config'); this.contentElement.classList.add('network-config');
...@@ -112,42 +106,39 @@ Network.NetworkConfigView = class extends UI.VBox { ...@@ -112,42 +106,39 @@ Network.NetworkConfigView = class extends UI.VBox {
_createNetworkThrottlingSection() { _createNetworkThrottlingSection() {
var section = this._createSection(Common.UIString('Network throttling'), 'network-config-throttling'); var section = this._createSection(Common.UIString('Network throttling'), 'network-config-throttling');
this._networkThrottlingSelect = var networkThrottlingSelect =
/** @type {!HTMLSelectElement} */ (section.createChild('select', 'chrome-select')); /** @type {!HTMLSelectElement} */ (section.createChild('select', 'chrome-select'));
MobileThrottling.throttlingManager().decorateSelectWithNetworkThrottling(this._networkThrottlingSelect); MobileThrottling.throttlingManager().decorateSelectWithNetworkThrottling(networkThrottlingSelect);
} }
_createUserAgentSection() { _createUserAgentSection() {
var section = this._createSection(Common.UIString('User agent'), 'network-config-ua'); var section = this._createSection(Common.UIString('User agent'), 'network-config-ua');
var checkboxLabel = UI.CheckboxLabel.create(Common.UIString('Select automatically'), true); var checkboxLabel = UI.CheckboxLabel.create(Common.UIString('Select automatically'), true);
section.appendChild(checkboxLabel); section.appendChild(checkboxLabel);
this._autoCheckbox = checkboxLabel.checkboxElement; var autoCheckbox = checkboxLabel.checkboxElement;
this._autoCheckbox.addEventListener('change', this._userAgentTypeChanged.bind(this));
this._customUserAgentSetting = Common.settings.createSetting('customUserAgent', '');
this._customUserAgentSetting.addChangeListener(this._customUserAgentChanged, this);
this._customUserAgent = section.createChild('div', 'network-config-ua-custom');
this._customSelectAndInput = Network.NetworkConfigView.createUserAgentSelectAndInput();
this._customSelectAndInput.select.classList.add('chrome-select');
this._customUserAgent.appendChild(this._customSelectAndInput.select);
this._customUserAgent.appendChild(this._customSelectAndInput.input);
this._userAgentTypeChanged();
}
_customUserAgentChanged() { var customUserAgentSetting = Common.settings.createSetting('customUserAgent', '');
if (this._autoCheckbox.checked) customUserAgentSetting.addChangeListener(() => {
return; if (autoCheckbox.checked)
SDK.multitargetNetworkManager.setCustomUserAgentOverride(this._customUserAgentSetting.get()); return;
} SDK.multitargetNetworkManager.setCustomUserAgentOverride(customUserAgentSetting.get());
});
var customUserAgentSelectBox = section.createChild('div', 'network-config-ua-custom');
autoCheckbox.addEventListener('change', userAgentSelectBoxChanged);
var customSelectAndInput = Network.NetworkConfigView.createUserAgentSelectAndInput();
customSelectAndInput.select.classList.add('chrome-select');
customUserAgentSelectBox.appendChild(customSelectAndInput.select);
customUserAgentSelectBox.appendChild(customSelectAndInput.input);
userAgentSelectBoxChanged();
_userAgentTypeChanged() { function userAgentSelectBoxChanged() {
var useCustomUA = !this._autoCheckbox.checked; var useCustomUA = !autoCheckbox.checked;
this._customUserAgent.classList.toggle('checked', useCustomUA); customUserAgentSelectBox.classList.toggle('checked', useCustomUA);
this._customSelectAndInput.select.disabled = !useCustomUA; customSelectAndInput.select.disabled = !useCustomUA;
this._customSelectAndInput.input.disabled = !useCustomUA; customSelectAndInput.input.disabled = !useCustomUA;
var customUA = useCustomUA ? this._customUserAgentSetting.get() : ''; var customUA = useCustomUA ? customUserAgentSetting.get() : '';
SDK.multitargetNetworkManager.setCustomUserAgentOverride(customUA); SDK.multitargetNetworkManager.setCustomUserAgentOverride(customUA);
}
} }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment