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

Side by Side Diff: chrome/browser/resources/settings/internet_page/network_ip_config.js

Issue 2856023002: MD Settings: Internet: Fix IP config visibility (Closed)
Patch Set: Rebase Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview Polymer element for displaying the IP Config properties for 6 * @fileoverview Polymer element for displaying the IP Config properties for
7 * a network state. TODO(stevenjb): Allow editing of static IP configurations 7 * a network state. TODO(stevenjb): Allow editing of static IP configurations
8 * when 'editable' is true. 8 * when 'editable' is true.
9 */ 9 */
10 Polymer({ 10 Polymer({
(...skipping 24 matching lines...) Expand all
35 */ 35 */
36 automatic_: { 36 automatic_: {
37 type: Boolean, 37 type: Boolean,
38 value: true, 38 value: true,
39 observer: 'automaticChanged_', 39 observer: 'automaticChanged_',
40 }, 40 },
41 41
42 /** 42 /**
43 * The currently visible IP Config property dictionary. The 'RoutingPrefix' 43 * The currently visible IP Config property dictionary. The 'RoutingPrefix'
44 * property is a human-readable mask instead of a prefix length. 44 * property is a human-readable mask instead of a prefix length.
45 * @private {!{ 45 * @private {?{
46 * ipv4: !CrOnc.IPConfigUIProperties, 46 * ipv4: !CrOnc.IPConfigUIProperties,
47 * ipv6: !CrOnc.IPConfigUIProperties 47 * ipv6: !CrOnc.IPConfigUIProperties
48 * }|undefined} 48 * }}
49 */ 49 */
50 ipConfig_: Object, 50 ipConfig_: {
51 type: Object,
52 value: null,
53 },
51 54
52 /** 55 /**
53 * Array of properties to pass to the property list. 56 * Array of properties to pass to the property list.
54 * @private {!Array<string>} 57 * @private {!Array<string>}
55 */ 58 */
56 ipConfigFields_: { 59 ipConfigFields_: {
57 type: Array, 60 type: Array,
58 value: function() { 61 value: function() {
59 return [ 62 return [
60 'ipv4.IPAddress', 63 'ipv4.IPAddress',
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 */ 167 */
165 showIPEditFields_: function() { 168 showIPEditFields_: function() {
166 return this.editable && !this.automatic_; 169 return this.editable && !this.automatic_;
167 }, 170 },
168 171
169 /** 172 /**
170 * @return {Object} An object with the edit type for each editable field. 173 * @return {Object} An object with the edit type for each editable field.
171 * @private 174 * @private
172 */ 175 */
173 getIPEditFields_: function() { 176 getIPEditFields_: function() {
174 if (!this.editable || this.automatic__) 177 if (!this.editable || this.automatic_)
175 return {}; 178 return {};
176 return { 179 return {
177 'ipv4.IPAddress': 'String', 180 'ipv4.IPAddress': 'String',
178 'ipv4.RoutingPrefix': 'String', 181 'ipv4.RoutingPrefix': 'String',
179 'ipv4.Gateway': 'String' 182 'ipv4.Gateway': 'String'
180 }; 183 };
181 }, 184 },
182 185
183 /** 186 /**
184 * Event triggered when the network property list changes. 187 * Event triggered when the network property list changes.
185 * @param {!{detail: {field: string, value: string}}} event The 188 * @param {!{detail: {field: string, value: string}}} event The
186 * network-property-list change event. 189 * network-property-list change event.
187 * @private 190 * @private
188 */ 191 */
189 onIPChange_: function(event) { 192 onIPChange_: function(event) {
190 if (!this.ipConfig_) 193 if (!this.ipConfig_)
191 return; 194 return;
192 var field = event.detail.field; 195 var field = event.detail.field;
193 var value = event.detail.value; 196 var value = event.detail.value;
194 // Note: |field| includes the 'ipv4.' prefix. 197 // Note: |field| includes the 'ipv4.' prefix.
195 this.set('ipConfig_.' + field, value); 198 this.set('ipConfig_.' + field, value);
196 // This will also set IPAddressConfigType to STATIC. 199 // This will also set IPAddressConfigType to STATIC.
197 this.fire('ip-change', { 200 this.fire('ip-change', {
198 field: 'StaticIPConfig', 201 field: 'StaticIPConfig',
199 value: this.getIPConfigProperties_(this.ipConfig_.ipv4) 202 value: this.getIPConfigProperties_(this.ipConfig_.ipv4)
200 }); 203 });
201 }, 204 },
202 }); 205 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698