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

Unified Diff: chrome/browser/resources/options/chromeos/internet_detail.js

Issue 2939273002: DO NOT SUBMIT: what chrome/browser/resources/ could eventually look like with clang-format (Closed)
Patch Set: Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/options/chromeos/internet_detail.js
diff --git a/chrome/browser/resources/options/chromeos/internet_detail.js b/chrome/browser/resources/options/chromeos/internet_detail.js
index 41db2c8a6588b074be728b2b951dda8f9243f85e..f0f516e769ddc71c855732077e97304dbe5e8eb0 100644
--- a/chrome/browser/resources/options/chromeos/internet_detail.js
+++ b/chrome/browser/resources/options/chromeos/internet_detail.js
@@ -265,7 +265,7 @@ cr.define('options.internet', function() {
var guid = this.onc_.guid();
if (changes.indexOf(guid) != -1) {
chrome.networkingPrivate.getManagedProperties(
- guid, DetailsInternetPage.updateConnectionData);
+ guid, DetailsInternetPage.updateConnectionData);
}
},
@@ -282,25 +282,26 @@ cr.define('options.internet', function() {
DetailsInternetPage.loginFromDetails();
});
- $('details-internet-disconnect').addEventListener('click',
- function(event) {
- DetailsInternetPage.setDetails();
- DetailsInternetPage.disconnectNetwork();
- });
+ $('details-internet-disconnect')
+ .addEventListener('click', function(event) {
+ DetailsInternetPage.setDetails();
+ DetailsInternetPage.disconnectNetwork();
+ });
- $('details-internet-configure').addEventListener('click',
- function(event) {
- DetailsInternetPage.setDetails();
- DetailsInternetPage.configureNetwork();
- });
+ $('details-internet-configure')
+ .addEventListener('click', function(event) {
+ DetailsInternetPage.setDetails();
+ DetailsInternetPage.configureNetwork();
+ });
$('activate-details').addEventListener('click', function(event) {
DetailsInternetPage.activateFromDetails();
});
$('view-account-details').addEventListener('click', function(event) {
- chrome.send('showMorePlanInfo',
- [DetailsInternetPage.getInstance().onc_.guid()]);
+ chrome.send(
+ 'showMorePlanInfo',
+ [DetailsInternetPage.getInstance().onc_.guid()]);
PageManager.closeOverlay();
});
@@ -334,26 +335,23 @@ cr.define('options.internet', function() {
});
// Proxy
- ['proxy-host-single-port',
- 'secure-proxy-port',
- 'socks-port',
- 'ftp-proxy-port',
- 'proxy-host-port'
- ].forEach(function(id) {
- options.PrefPortNumber.decorate($(id));
- });
+ ['proxy-host-single-port', 'secure-proxy-port', 'socks-port',
+ 'ftp-proxy-port', 'proxy-host-port']
+ .forEach(function(id) {
+ options.PrefPortNumber.decorate($(id));
+ });
options.proxyexceptions.ProxyExceptions.decorate($('ignored-host-list'));
- $('remove-host').addEventListener('click',
- this.handleRemoveProxyExceptions_);
+ $('remove-host')
+ .addEventListener('click', this.handleRemoveProxyExceptions_);
$('add-host').addEventListener('click', this.handleAddProxyException_);
$('direct-proxy').addEventListener('click', this.disableManualProxy_);
$('manual-proxy').addEventListener('click', this.enableManualProxy_);
$('auto-proxy').addEventListener('click', this.disableManualProxy_);
- $('proxy-all-protocols').addEventListener('click',
- this.toggleSingleProxy_);
- $('proxy-use-pac-url').addEventListener('change',
- this.handleAutoConfigProxy_);
+ $('proxy-all-protocols')
+ .addEventListener('click', this.toggleSingleProxy_);
+ $('proxy-use-pac-url')
+ .addEventListener('change', this.handleAutoConfigProxy_);
observePrefsUI($('direct-proxy'));
observePrefsUI($('manual-proxy'));
@@ -361,14 +359,14 @@ cr.define('options.internet', function() {
observePrefsUI($('proxy-all-protocols'));
observePrefsUI($('proxy-use-pac-url'));
- $('ip-automatic-configuration-checkbox').addEventListener('click',
- this.handleIpAutoConfig_);
- $('automatic-dns-radio').addEventListener('click',
- this.handleNameServerTypeChange_);
- $('google-dns-radio').addEventListener('click',
- this.handleNameServerTypeChange_);
- $('user-dns-radio').addEventListener('click',
- this.handleNameServerTypeChange_);
+ $('ip-automatic-configuration-checkbox')
+ .addEventListener('click', this.handleIpAutoConfig_);
+ $('automatic-dns-radio')
+ .addEventListener('click', this.handleNameServerTypeChange_);
+ $('google-dns-radio')
+ .addEventListener('click', this.handleNameServerTypeChange_);
+ $('user-dns-radio')
+ .addEventListener('click', this.handleNameServerTypeChange_);
// We only load this string if we have the string data available
// because the proxy settings page on the login screen re-uses the
@@ -498,8 +496,9 @@ cr.define('options.internet', function() {
* @private
*/
createControlledEvent_: function(name, propData) {
- assert('value' in propData && 'controlledBy' in propData &&
- 'recommendedValue' in propData);
+ assert(
+ 'value' in propData && 'controlledBy' in propData &&
+ 'recommendedValue' in propData);
var event = new Event(name);
event.value = {
value: propData.value,
@@ -562,12 +561,12 @@ cr.define('options.internet', function() {
$('ipconfig-dns-section').hidden = false;
// Network type related.
- updateHidden('#details-internet-page .cellular-details',
- this.type_ != 'Cellular');
- updateHidden('#details-internet-page .wifi-details',
- this.type_ != 'WiFi');
- updateHidden('#details-internet-page .wimax-details',
- this.type_ != 'WiMAX');
+ updateHidden(
+ '#details-internet-page .cellular-details', this.type_ != 'Cellular');
+ updateHidden(
+ '#details-internet-page .wifi-details', this.type_ != 'WiFi');
+ updateHidden(
+ '#details-internet-page .wimax-details', this.type_ != 'WiMAX');
updateHidden('#details-internet-page .vpn-details', this.type_ != 'VPN');
updateHidden('#details-internet-page .proxy-details', !this.showProxy_);
@@ -583,15 +582,16 @@ cr.define('options.internet', function() {
// Wifi
// Hide network tab for VPN.
- updateHidden('#details-internet-page .network-details',
- this.type_ == 'VPN');
+ updateHidden(
+ '#details-internet-page .network-details', this.type_ == 'VPN');
// Password and shared.
var source = onc ? onc.getSource() : 'None';
var shared = (source == 'Device' || source == 'DevicePolicy');
var security = onc ? onc.getWiFiSecurity() : 'None';
- updateHidden('#details-internet-page #password-details',
- this.type_ != 'WiFi' || security == 'None');
+ updateHidden(
+ '#details-internet-page #password-details',
+ this.type_ != 'WiFi' || security == 'None');
updateHidden('#details-internet-page #wifi-shared-network', !shared);
updateHidden('#details-internet-page #prefer-network', source == 'None');
@@ -630,7 +630,7 @@ cr.define('options.internet', function() {
bannerDiv.hidden = false;
// The possible banner texts are loaded in proxy_handler.cc.
var bannerText = 'proxyBanner' + controlledBy.charAt(0).toUpperCase() +
- controlledBy.slice(1);
+ controlledBy.slice(1);
$('banner-text').textContent = loadTimeData.getString(bannerText);
}
},
@@ -680,10 +680,10 @@ cr.define('options.internet', function() {
$('ftp-proxy-port').disabled = true;
$('socks-host').disabled = true;
$('socks-port').disabled = true;
- $('proxy-use-pac-url').disabled = $('auto-proxy').disabled ||
- !$('auto-proxy').checked;
- $('proxy-pac-url').disabled = $('proxy-use-pac-url').disabled ||
- !$('proxy-use-pac-url').checked;
+ $('proxy-use-pac-url').disabled =
+ $('auto-proxy').disabled || !$('auto-proxy').checked;
+ $('proxy-pac-url').disabled =
+ $('proxy-use-pac-url').disabled || !$('proxy-use-pac-url').checked;
$('auto-proxy-parms').hidden = !$('auto-proxy').checked;
$('manual-proxy-parms').hidden = !$('manual-proxy').checked;
sendChromeMetricsAction('Options_NetworkManualProxy_Disable');
@@ -727,8 +727,7 @@ cr.define('options.internet', function() {
updateConnectionButtonVisibility_: function() {
var onc = this.onc_;
- var prohibitedByPolicy =
- this.type_ == 'WiFi' &&
+ var prohibitedByPolicy = this.type_ == 'WiFi' &&
loadTimeData.valueExists('allowOnlyPolicyNetworksToConnect') &&
loadTimeData.getBoolean('allowOnlyPolicyNetworksToConnect') &&
(onc.data_.Source != 'DevicePolicy' &&
@@ -752,11 +751,13 @@ cr.define('options.internet', function() {
// installation UI. Until that gets handled here, always enable the
// Connect button for built-in networks.
var enabled = ((this.type_ != 'VPN') ||
- (onc.getActiveValue('VPN.Type') != 'ThirdPartyVPN') ||
- connectable) && !prohibitedByPolicy;
+ (onc.getActiveValue('VPN.Type') != 'ThirdPartyVPN') ||
+ connectable) &&
+ !prohibitedByPolicy;
if (prohibitedByPolicy) {
- $('details-internet-login').setAttribute(
- 'title', loadTimeData.getString('prohibitedNetwork'));
+ $('details-internet-login')
+ .setAttribute(
+ 'title', loadTimeData.getString('prohibitedNetwork'));
} else {
$('details-internet-login').removeAttribute('title');
}
@@ -772,9 +773,10 @@ cr.define('options.internet', function() {
} else if (this.type_ == 'WiMAX' && connectState == 'NotConnected') {
showConfigure = true;
} else if (this.type_ == 'WiFi') {
- showConfigure = (connectState == 'NotConnected' &&
- (!connectable || onc.getWiFiSecurity() != 'None') &&
- !prohibitedByPolicy);
+ showConfigure =
+ (connectState == 'NotConnected' &&
+ (!connectable || onc.getWiFiSecurity() != 'None') &&
+ !prohibitedByPolicy);
}
$('details-internet-configure').hidden = !showConfigure;
},
@@ -808,8 +810,9 @@ cr.define('options.internet', function() {
}
showViewAccount = shouldShowViewAccountButton(onc);
var activationState = onc.getActiveValue('Cellular.ActivationState');
- showActivate = (activationState == 'NotActivated' ||
- activationState == 'PartiallyActivated');
+ showActivate =
+ (activationState == 'NotActivated' ||
+ activationState == 'PartiallyActivated');
}
$('view-account-details').hidden = !showViewAccount;
@@ -934,7 +937,7 @@ cr.define('options.internet', function() {
this.userApnIndex_ = -1;
var onc = this.onc_;
- var apnSelector = /** @type {HTMLSelectElement} */($('select-apn'));
+ var apnSelector = /** @type {HTMLSelectElement} */ ($('select-apn'));
// Clear APN lists, keep only last element, 'other'.
while (apnSelector.length != 1)
@@ -947,15 +950,15 @@ cr.define('options.internet', function() {
} else {
// Create a single 'default' entry.
var otherOption = apnSelector[0];
- var defaultOption = /** @type {HTMLElement} */(
- document.createElement('option'));
+ var defaultOption =
+ /** @type {HTMLElement} */ (document.createElement('option'));
defaultOption.textContent =
loadTimeData.getString('cellularApnUseDefault');
defaultOption.value = -1;
// Add 'default' entry before 'other' option
apnSelector.add(defaultOption, otherOption);
assert(apnSelector.length == 2); // 'default', 'other'
- this.selectedApnIndex_ = 0; // Select 'default'
+ this.selectedApnIndex_ = 0; // Select 'default'
}
assert(this.selectedApnIndex_ >= 0);
apnSelector.selectedIndex = this.selectedApnIndex_;
@@ -981,8 +984,8 @@ cr.define('options.internet', function() {
// Set an ONC object with just the APN values.
var oncData = new OncData({});
oncData.setProperty('Cellular.APN', activeApn);
- chrome.networkingPrivate.setProperties(this.onc_.guid(),
- oncData.getData());
+ chrome.networkingPrivate.setProperties(
+ this.onc_.guid(), oncData.getData());
},
/**
@@ -990,7 +993,7 @@ cr.define('options.internet', function() {
* @private
*/
setDefaultApn_: function() {
- var apnSelector = /** @type {HTMLSelectElement} */($('select-apn'));
+ var apnSelector = /** @type {HTMLSelectElement} */ ($('select-apn'));
// Remove the 'user' entry if it exists.
if (this.userApnIndex_ != -1) {
@@ -1019,7 +1022,7 @@ cr.define('options.internet', function() {
if (apnValue == '')
return;
- var apnSelector = /** @type {HTMLSelectElement} */($('select-apn'));
+ var apnSelector = /** @type {HTMLSelectElement} */ ($('select-apn'));
var activeApn = {};
activeApn['AccessPointName'] = stringFromValue(apnValue);
@@ -1051,7 +1054,9 @@ cr.define('options.internet', function() {
* Event Listener for the cellular-apn-cancel button.
* @private
*/
- cancelApn_: function() { this.initializeApnList_(); },
+ cancelApn_: function() {
+ this.initializeApnList_();
+ },
/**
* Event Listener for the select-apn button.
@@ -1069,7 +1074,7 @@ cr.define('options.internet', function() {
} else if (apnSelector.selectedIndex == this.userApnIndex_) {
this.selectedApnIndex_ = apnSelector.selectedIndex;
this.setActiveApn_(this.userApn_);
- } else { // 'Other'
+ } else { // 'Other'
var apnDict;
if (this.userApn_['AccessPointName']) {
// Fill in the details fields with the existing 'user' config.
@@ -1096,12 +1101,10 @@ cr.define('options.internet', function() {
* network.
*/
DetailsInternetPage.changeCellularButtonsState = function(disable) {
- var buttonsToDisableList =
- new Array('details-internet-login',
- 'details-internet-disconnect',
- 'details-internet-configure',
- 'activate-details',
- 'view-account-details');
+ var buttonsToDisableList = new Array(
+ 'details-internet-login', 'details-internet-disconnect',
+ 'details-internet-configure', 'activate-details',
+ 'view-account-details');
for (var i = 0; i < buttonsToDisableList.length; ++i) {
var button = $(buttonsToDisableList[i]);
@@ -1163,36 +1166,35 @@ cr.define('options.internet', function() {
};
DetailsInternetPage.updateProxySettings = function(type) {
- var proxyHost = null,
- proxyPort = null;
-
- if (type == 'cros.session.proxy.singlehttp') {
- proxyHost = 'proxy-host-single-name';
- proxyPort = 'proxy-host-single-port';
- } else if (type == 'cros.session.proxy.httpurl') {
- proxyHost = 'proxy-host-name';
- proxyPort = 'proxy-host-port';
- } else if (type == 'cros.session.proxy.httpsurl') {
- proxyHost = 'secure-proxy-host-name';
- proxyPort = 'secure-proxy-port';
- } else if (type == 'cros.session.proxy.ftpurl') {
- proxyHost = 'ftp-proxy';
- proxyPort = 'ftp-proxy-port';
- } else if (type == 'cros.session.proxy.socks') {
- proxyHost = 'socks-host';
- proxyPort = 'socks-port';
- } else {
- return;
- }
+ var proxyHost = null, proxyPort = null;
+
+ if (type == 'cros.session.proxy.singlehttp') {
+ proxyHost = 'proxy-host-single-name';
+ proxyPort = 'proxy-host-single-port';
+ } else if (type == 'cros.session.proxy.httpurl') {
+ proxyHost = 'proxy-host-name';
+ proxyPort = 'proxy-host-port';
+ } else if (type == 'cros.session.proxy.httpsurl') {
+ proxyHost = 'secure-proxy-host-name';
+ proxyPort = 'secure-proxy-port';
+ } else if (type == 'cros.session.proxy.ftpurl') {
+ proxyHost = 'ftp-proxy';
+ proxyPort = 'ftp-proxy-port';
+ } else if (type == 'cros.session.proxy.socks') {
+ proxyHost = 'socks-host';
+ proxyPort = 'socks-port';
+ } else {
+ return;
+ }
- var hostValue = $(proxyHost).value;
- if (hostValue.indexOf(':') !== -1) {
- if (hostValue.match(/:/g).length == 1) {
- hostValue = hostValue.split(':');
- $(proxyHost).value = hostValue[0];
- $(proxyPort).value = hostValue[1];
- }
+ var hostValue = $(proxyHost).value;
+ if (hostValue.indexOf(':') !== -1) {
+ if (hostValue.match(/:/g).length == 1) {
+ hostValue = hostValue.split(':');
+ $(proxyHost).value = hostValue[0];
+ $(proxyPort).value = hostValue[1];
}
+ }
};
DetailsInternetPage.loginFromDetails = function() {
@@ -1354,8 +1356,10 @@ cr.define('options.internet', function() {
*/
DetailsInternetPage.updateNameServerDisplay = function(type) {
var editable = type == 'user';
- var fields = [$('ipconfig-dns1'), $('ipconfig-dns2'),
- $('ipconfig-dns3'), $('ipconfig-dns4')];
+ var fields = [
+ $('ipconfig-dns1'), $('ipconfig-dns2'), $('ipconfig-dns3'),
+ $('ipconfig-dns4')
+ ];
for (var i = 0; i < fields.length; ++i) {
fields[i].editable = editable;
}
@@ -1439,8 +1443,8 @@ cr.define('options.internet', function() {
$('web-proxy-auto-discovery').hidden = true;
var restricted = onc.getActiveValue('RestrictedConnectivity');
- var restrictedString = loadTimeData.getString(
- restricted ? 'restrictedYes' : 'restrictedNo');
+ var restrictedString =
+ loadTimeData.getString(restricted ? 'restrictedYes' : 'restrictedNo');
// These objects contain an 'automatic' property that is displayed when
// ip-automatic-configuration-checkbox is checked, and a 'value' property
@@ -1502,7 +1506,7 @@ cr.define('options.internet', function() {
if (savedPrefix != undefined) {
assert(typeof savedPrefix == 'number');
var savedNetmask = prefixLengthToNetmask(
- /** @type {number} */(savedPrefix));
+ /** @type {number} */ (savedPrefix));
inetNetmask.automatic = savedNetmask;
if (!inetNetmask.value)
inetNetmask.value = savedNetmask;
@@ -1652,8 +1656,8 @@ cr.define('options.internet', function() {
frequencyFormat = frequencyFormat.replace('$1', frequency);
$('wifi-frequency').textContent = frequencyFormat;
$('wifi-signal-strength').textContent = strengthString;
- setOrHideParent('wifi-hardware-address',
- onc.getActiveValue('MacAddress'));
+ setOrHideParent(
+ 'wifi-hardware-address', onc.getActiveValue('MacAddress'));
var priority = onc.getActiveValue('Priority');
$('prefer-network-wifi').checked = priority > 0;
$('prefer-network-wifi').disabled = !remembered;
@@ -1730,12 +1734,11 @@ cr.define('options.internet', function() {
OptionsPage.showTab($('vpn-nav-tab'));
var providerType = onc.getActiveValue('VPN.Type');
var isThirdPartyVPN = providerType == 'ThirdPartyVPN';
- $('vpn-tab').classList.toggle('third-party-vpn-provider',
- isThirdPartyVPN);
+ $('vpn-tab').classList.toggle(
+ 'third-party-vpn-provider', isThirdPartyVPN);
$('inet-service-name').textContent = networkName;
- $('inet-provider-type').textContent =
- onc.getTranslatedValue('VPN.Type');
+ $('inet-provider-type').textContent = onc.getTranslatedValue('VPN.Type');
if (isThirdPartyVPN) {
$('inet-provider-name').textContent =
@@ -1779,9 +1782,8 @@ cr.define('options.internet', function() {
var propName = indicators[i].getAttribute(attributeName);
if (!propName)
continue;
- var propValue = managed ?
- onc.getManagedProperty(propName) :
- onc.getActiveValue(propName);
+ var propValue = managed ? onc.getManagedProperty(propName) :
+ onc.getActiveValue(propName);
// If the property is unset or unmanaged (i.e. not an Object) skip it.
if (propValue == undefined || (typeof propValue != 'object'))
continue;
@@ -1789,9 +1791,10 @@ cr.define('options.internet', function() {
if (managed)
event = detailsPage.createManagedEvent_(propName, propValue);
else
- event = detailsPage.createControlledEvent_(propName,
- /** @type {{value: *, controlledBy: *, recommendedValue: *}} */(
- propValue));
+ event = detailsPage.createControlledEvent_(
+ propName,
+ /** @type {{value: *, controlledBy: *, recommendedValue: *}} */
+ (propValue));
indicators[i].handlePrefChange(event);
var forElement = $(indicators[i].getAttribute('internet-detail-for'));
if (forElement) {
@@ -1809,7 +1812,5 @@ cr.define('options.internet', function() {
PageManager.showPageByName('detailsInternetPage', false);
};
- return {
- DetailsInternetPage: DetailsInternetPage
- };
+ return {DetailsInternetPage: DetailsInternetPage};
});

Powered by Google App Engine
This is Rietveld 408576698