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

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

Issue 2958833002: Settings: Network: Specify a default IPCofig when not set (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
« no previous file with comments | « chrome/browser/resources/settings/internet_page/network_ip_config.html ('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 d84e8ea49645f6347cb70c246741bd5c06f7a227..d8143ddbfa0406b4d326a3c27451bb82b96b7da1 100644
--- a/chrome/browser/resources/settings/internet_page/network_ip_config.js
+++ b/chrome/browser/resources/settings/internet_page/network_ip_config.js
@@ -44,7 +44,7 @@ Polymer({
* property is a human-readable mask instead of a prefix length.
* @private {?{
* ipv4: !CrOnc.IPConfigUIProperties,
- * ipv6: !CrOnc.IPConfigUIProperties
+ * ipv6: (!CrOnc.IPConfigUIProperties|undefined)
* }}
*/
ipConfig_: {
@@ -108,13 +108,23 @@ Polymer({
/** @private */
automaticChanged_: function() {
- if (!this.automatic_ || !this.ipConfig_) {
- // When switching from automatic, don't send any changes, ip-change will
- // be fired in onIPChange when a field is changed.
+ if (!this.automatic_) {
+ // Ensure that there is a valid IPConfig object.
+ this.ipConfig_ = this.ipConfig_ || {
+ ipv4: {
+ Gateway: '192.168.1.1',
+ IPAddress: '192.168.1.1',
+ RoutingPrefix: '255.255.255.0',
+ Type: CrOnc.IPType.IPV4,
+ },
+ };
+ this.sendStaticIpConfig_();
return;
}
+
// Save the static IP configuration when switching to automatic.
- this.savedStaticIp_ = this.ipConfig_.ipv4;
+ if (this.ipConfig_)
+ this.savedStaticIp_ = this.ipConfig_.ipv4;
// Send the change.
this.fire('ip-change', {
field: 'IPAddressConfigType',
@@ -188,6 +198,11 @@ Polymer({
var value = event.detail.value;
// Note: |field| includes the 'ipv4.' prefix.
this.set('ipConfig_.' + field, value);
+ this.sendStaticIpConfig_();
+ },
+
+ /** @private */
+ sendStaticIpConfig_: function() {
// This will also set IPAddressConfigType to STATIC.
this.fire('ip-change', {
field: 'StaticIPConfig',
« no previous file with comments | « chrome/browser/resources/settings/internet_page/network_ip_config.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698