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

Unified Diff: chrome/browser/resources/settings/internet_page/network_proxy.js

Issue 2179223004: MD Settings: Internet: Clean up network and proxy sections. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@issue_609156_internet_cleanup_3
Patch Set: Add MAX_NAMESERVERS Created 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/settings/internet_page/network_proxy.js
diff --git a/chrome/browser/resources/settings/internet_page/network_proxy.js b/chrome/browser/resources/settings/internet_page/network_proxy.js
index 1d9fd1131005fb59dc88c733dcc73ccde1d0556d..9f2ef04899b8224ad9648029733a935bf80b95b7 100644
--- a/chrome/browser/resources/settings/internet_page/network_proxy.js
+++ b/chrome/browser/resources/settings/internet_page/network_proxy.js
@@ -19,7 +19,7 @@ Polymer({
*/
networkProperties: {
type: Object,
- observer: 'networkPropertiesChanged_'
+ observer: 'networkPropertiesChanged_',
},
/**
@@ -27,7 +27,7 @@ Polymer({
*/
editable: {
type: Boolean,
- value: false
+ value: false,
},
/**
@@ -36,7 +36,9 @@ Polymer({
*/
proxy: {
type: Object,
- value: function() { return this.createDefaultProxySettings_(); }
+ value: function() {
+ return this.createDefaultProxySettings_();
+ },
},
/**
@@ -44,7 +46,7 @@ Polymer({
*/
WPAD: {
type: String,
- value: ''
+ value: '',
},
/**
@@ -53,7 +55,7 @@ Polymer({
useSameProxy: {
type: Boolean,
value: false,
- observer: 'useSameProxyChanged_'
+ observer: 'useSameProxyChanged_',
},
/**
@@ -67,7 +69,7 @@ Polymer({
CrOnc.ProxySettingsType.DIRECT,
CrOnc.ProxySettingsType.PAC,
CrOnc.ProxySettingsType.WPAD,
- CrOnc.ProxySettingsType.MANUAL
+ CrOnc.ProxySettingsType.MANUAL,
],
readOnly: true
},
@@ -83,9 +85,9 @@ Polymer({
DIRECT: CrOnc.ProxySettingsType.DIRECT,
PAC: CrOnc.ProxySettingsType.PAC,
MANUAL: CrOnc.ProxySettingsType.MANUAL,
- WPAD: CrOnc.ProxySettingsType.WPAD
+ WPAD: CrOnc.ProxySettingsType.WPAD,
},
- readOnly: true
+ readOnly: true,
},
},
@@ -115,33 +117,32 @@ Polymer({
/** @type {!chrome.networkingPrivate.ManagedProxySettings|undefined} */
var proxySettings = this.networkProperties.ProxySettings;
if (proxySettings) {
- proxy.Type = /** @type {!CrOnc.ProxySettingsType} */(
+ proxy.Type = /** @type {!CrOnc.ProxySettingsType} */ (
CrOnc.getActiveValue(proxySettings.Type));
if (proxySettings.Manual) {
- proxy.Manual.HTTPProxy = /** @type {!CrOnc.ProxyLocation|undefined} */(
+ proxy.Manual.HTTPProxy = /** @type {!CrOnc.ProxyLocation|undefined} */ (
CrOnc.getSimpleActiveProperties(proxySettings.Manual.HTTPProxy));
proxy.Manual.SecureHTTPProxy =
- /** @type {!CrOnc.ProxyLocation|undefined} */(
+ /** @type {!CrOnc.ProxyLocation|undefined} */ (
CrOnc.getSimpleActiveProperties(
proxySettings.Manual.SecureHTTPProxy));
- proxy.Manual.FTPProxy = /** @type {!CrOnc.ProxyLocation|undefined} */(
+ proxy.Manual.FTPProxy = /** @type {!CrOnc.ProxyLocation|undefined} */ (
CrOnc.getSimpleActiveProperties(proxySettings.Manual.FTPProxy));
- proxy.Manual.SOCKS = /** @type {!CrOnc.ProxyLocation|undefined} */(
+ proxy.Manual.SOCKS = /** @type {!CrOnc.ProxyLocation|undefined} */ (
CrOnc.getSimpleActiveProperties(proxySettings.Manual.SOCKS));
}
if (proxySettings.ExcludeDomains) {
- proxy.ExcludeDomains = /** @type {!Array<string>|undefined} */(
+ proxy.ExcludeDomains = /** @type {!Array<string>|undefined} */ (
CrOnc.getActiveValue(proxySettings.ExcludeDomains));
}
- proxy.PAC = /** @type {string|undefined} */(
+ proxy.PAC = /** @type {string|undefined} */ (
CrOnc.getActiveValue(proxySettings.PAC));
}
// Use saved ExcludeDomanains and Manual if not defined.
proxy.ExcludeDomains = proxy.ExcludeDomains || this.savedExcludeDomains_;
proxy.Manual = proxy.Manual || this.savedManual_;
- this.set('proxy', proxy);
- this.$.selectType.value = proxy.Type;
+ this.proxy = proxy;
// Set the Web Proxy Auto Discovery URL.
var ipv4 =
@@ -178,34 +179,43 @@ Polymer({
*/
sendProxyChange_: function() {
if (this.proxy.Type == CrOnc.ProxySettingsType.MANUAL) {
- if (this.useSameProxy) {
- var defaultProxy = this.proxy.Manual.HTTPProxy;
- this.set('proxy.Manual.SecureHTTPProxy',
- Object.assign({}, defaultProxy));
- this.set('proxy.Manual.FTPProxy', Object.assign({}, defaultProxy));
- this.set('proxy.Manual.SOCKS', Object.assign({}, defaultProxy));
+ var proxy =
+ /** @type {!CrOnc.ProxySettings} */ (Object.assign({}, this.proxy));
+ var defaultProxy = proxy.Manual.HTTPProxy;
+ if (!defaultProxy || !defaultProxy.Host)
+ return;
+ if (this.useSameProxy || !proxy.Manual.SecureHTTPProxy) {
+ proxy.Manual.SecureHTTPProxy = /** @type {!CrOnc.ProxyLocation} */ (
+ Object.assign({}, defaultProxy));
+ }
+ if (this.useSameProxy || !proxy.Manual.FTPProxy) {
+ proxy.Manual.FTPProxy = /** @type {!CrOnc.ProxyLocation} */ (
+ Object.assign({}, defaultProxy));
}
- this.savedManual_ = this.proxy.Manual;
- this.savedExcludeDomains_ = this.proxy.ExcludeDomains;
+ if (this.useSameProxy || !proxy.Manual.SOCKS) {
+ proxy.Manual.SOCKS = /** @type {!CrOnc.ProxyLocation} */ (
+ Object.assign({}, defaultProxy));
+ }
+ this.savedManual_ = Object.assign({}, proxy.Manual);
+ this.savedExcludeDomains_ = proxy.ExcludeDomains;
+ this.proxy = proxy;
+ } else if (this.proxy.Type == CrOnc.ProxySettingsType.PAC) {
+ if (!this.proxy.PAC)
+ return;
}
- this.fire('proxy-change', {
- field: 'ProxySettings',
- value: this.proxy
- });
+ this.fire('proxy-change', {field: 'ProxySettings', value: this.proxy});
},
/**
* Event triggered when the selected proxy type changes.
- * @param {Event} event The select node change event.
+ * @param {!{detail: !{selected: string}}} e
* @private
*/
- onTypeChange_: function(event) {
- var type = this.proxyTypes_[event.target.selectedIndex];
+ onTypeChange_: function(e) {
+ var type = /** @type {chrome.networkingPrivate.ProxySettingsType} */ (
+ e.detail.selected);
this.set('proxy.Type', type);
- if (type != CrOnc.ProxySettingsType.MANUAL ||
- this.savedManual_) {
- this.sendProxyChange_();
- }
+ this.sendProxyChange_();
},
/**
@@ -267,7 +277,7 @@ Polymer({
isPropertyEditable_: function(editable, networkProperties, key) {
if (!editable)
return false;
- var property = /** @type {!CrOnc.ManagedProperty|undefined} */(
+ var property = /** @type {!CrOnc.ManagedProperty|undefined} */ (
this.get(key, networkProperties));
return !this.isNetworkPolicyEnforced(property);
},

Powered by Google App Engine
This is Rietveld 408576698