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

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

Issue 2817613002: MD Settings: Internet: IP Settings: Only set to static on change (Closed)
Patch Set: . Created 3 years, 8 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
« no previous file with comments | « chrome/browser/resources/settings/internet_page/internet_detail_page.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/settings/internet_page/network_ip_config.js
diff --git a/chrome/browser/resources/settings/internet_page/network_ip_config.js b/chrome/browser/resources/settings/internet_page/network_ip_config.js
index 43f34e18b65d0a36da6cf3e5a46f05ee55d6820f..6da711f7f45440e7493cb34f67dce02492368756 100644
--- a/chrome/browser/resources/settings/internet_page/network_ip_config.js
+++ b/chrome/browser/resources/settings/internet_page/network_ip_config.js
@@ -35,7 +35,7 @@ Polymer({
*/
automatic_: {
type: Boolean,
- value: false,
+ value: true,
observer: 'automaticChanged_',
},
@@ -84,36 +84,32 @@ Polymer({
this.savedStaticIp_ = undefined;
// Update the 'automatic' property.
- var ipConfigType =
- CrOnc.getActiveValue(this.networkProperties.IPAddressConfigType);
- this.automatic_ = (ipConfigType != CrOnc.IPConfigType.STATIC);
-
- // Update the 'ipConfig' property.
- var ipv4 =
- CrOnc.getIPConfigForType(this.networkProperties, CrOnc.IPType.IPV4);
- var ipv6 =
- CrOnc.getIPConfigForType(this.networkProperties, CrOnc.IPType.IPV6);
- this.ipConfig_ = {
- ipv4: this.getIPConfigUIProperties_(ipv4),
- ipv6: this.getIPConfigUIProperties_(ipv6)
- };
+ if (this.networkProperties.IPAddressConfigType ) {
+ var ipConfigType =
+ CrOnc.getActiveValue(this.networkProperties.IPAddressConfigType);
+ this.automatic_ = (ipConfigType != CrOnc.IPConfigType.STATIC);
+ }
+
+ if (this.networkProperties.IPConfigs) {
+ // Update the 'ipConfig' property.
+ var ipv4 =
+ CrOnc.getIPConfigForType(this.networkProperties, CrOnc.IPType.IPV4);
+ var ipv6 =
+ CrOnc.getIPConfigForType(this.networkProperties, CrOnc.IPType.IPV6);
+ this.ipConfig_ = {
+ ipv4: this.getIPConfigUIProperties_(ipv4),
+ ipv6: this.getIPConfigUIProperties_(ipv6)
+ };
+ }
},
- /**
- * Polymer automatic changed method.
- */
+ /** @private */
automaticChanged_: function() {
if (!this.automatic_ || !this.ipConfig_)
return;
if (this.automatic_ || !this.savedStaticIp_) {
// Save the static IP configuration when switching to automatic.
this.savedStaticIp_ = this.ipConfig_.ipv4;
- var configType =
- this.automatic_ ? CrOnc.IPConfigType.DHCP : CrOnc.IPConfigType.STATIC;
- this.fire('ip-change', {
- field: 'IPAddressConfigType',
- value: configType,
- });
} else {
// Restore the saved static IP configuration.
var ipconfig = {
@@ -122,9 +118,13 @@ Polymer({
RoutingPrefix: this.savedStaticIp_.RoutingPrefix,
Type: this.savedStaticIp_.Type,
};
+ }
+ // Only fire ip-change wehn switching to automatic. Changing to static IP
michaelpg 2017/04/12 23:35:18 "when"
stevenjb 2017/04/13 00:04:47 Done.
+ // will occur when a field is changed.
+ if (this.automatic_) {
michaelpg 2017/04/12 23:35:18 the early return on 108 suggests this is never fal
stevenjb 2017/04/13 00:04:47 You're right. There's a bunch of dead / unnecessar
this.fire('ip-change', {
- field: 'StaticIPConfig',
- value: this.getIPConfigProperties_(ipconfig),
+ field: 'IPAddressConfigType',
+ value: CrOnc.IPConfigType.DHCP,
});
}
},
@@ -203,6 +203,7 @@ Polymer({
var value = event.detail.value;
// Note: |field| includes the 'ipv4.' prefix.
this.set('ipConfig_.' + field, value);
+ // This will also set IPAddressConfigType to STATIC.
this.fire('ip-change', {
field: 'StaticIPConfig',
value: this.getIPConfigProperties_(this.ipConfig_.ipv4)
« no previous file with comments | « chrome/browser/resources/settings/internet_page/internet_detail_page.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698