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() {
var deviceModeThrottling = deviceModeView._toolbar._throttlingConditionsItem;
var networkPanelThrottling = UI.panels.network.throttlingSelectForTest();
var networkPanelOfflineCheckbox = UI.panels.network.offlineCheckboxForTest().inputElement;
var networkConfigView = self.runtime.sharedInstance(Network.NetworkConfigView);
var networkConditionsDrawerThrottlingSelector =
self.runtime.sharedInstance(Network.NetworkConfigView)._networkThrottlingSelect;
networkConfigView.contentElement.querySelector('.network-config-throttling select.chrome-select');
var performancePanelNetworkThrottling = UI.panels.timeline._networkThrottlingSelect;
var performancePanelCPUThrottling = UI.panels.timeline._cpuThrottlingSelect;
......
// Copyright (c) 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/**
* @unrestricted
*/
Network.NetworkConfigView = class extends UI.VBox {
constructor() {
super(true);
/** @type {!Element} */
this._autoCheckbox;
/** @type {!{input: !Element, select: !Element}} */
this._customSelectAndInput;
this.registerRequiredCSS('network/networkConfigView.css');
this.contentElement.classList.add('network-config');
......@@ -112,42 +106,39 @@ Network.NetworkConfigView = class extends UI.VBox {
_createNetworkThrottlingSection() {
var section = this._createSection(Common.UIString('Network throttling'), 'network-config-throttling');
this._networkThrottlingSelect =
var networkThrottlingSelect =
/** @type {!HTMLSelectElement} */ (section.createChild('select', 'chrome-select'));
MobileThrottling.throttlingManager().decorateSelectWithNetworkThrottling(this._networkThrottlingSelect);
MobileThrottling.throttlingManager().decorateSelectWithNetworkThrottling(networkThrottlingSelect);
}
_createUserAgentSection() {
var section = this._createSection(Common.UIString('User agent'), 'network-config-ua');
var checkboxLabel = UI.CheckboxLabel.create(Common.UIString('Select automatically'), true);
section.appendChild(checkboxLabel);
this._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();
}
var autoCheckbox = checkboxLabel.checkboxElement;
_customUserAgentChanged() {
if (this._autoCheckbox.checked)
return;
SDK.multitargetNetworkManager.setCustomUserAgentOverride(this._customUserAgentSetting.get());
}
var customUserAgentSetting = Common.settings.createSetting('customUserAgent', '');
customUserAgentSetting.addChangeListener(() => {
if (autoCheckbox.checked)
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() {
var useCustomUA = !this._autoCheckbox.checked;
this._customUserAgent.classList.toggle('checked', useCustomUA);
this._customSelectAndInput.select.disabled = !useCustomUA;
this._customSelectAndInput.input.disabled = !useCustomUA;
var customUA = useCustomUA ? this._customUserAgentSetting.get() : '';
SDK.multitargetNetworkManager.setCustomUserAgentOverride(customUA);
function userAgentSelectBoxChanged() {
var useCustomUA = !autoCheckbox.checked;
customUserAgentSelectBox.classList.toggle('checked', useCustomUA);
customSelectAndInput.select.disabled = !useCustomUA;
customSelectAndInput.input.disabled = !useCustomUA;
var customUA = useCustomUA ? customUserAgentSetting.get() : '';
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