| OLD | NEW |
| 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 | 6 * @fileoverview |
| 7 * 'settings-internet-detail' is the settings subpage containing details | 7 * 'settings-internet-detail' is the settings subpage containing details |
| 8 * for a network. | 8 * for a network. |
| 9 */ | 9 */ |
| 10 (function() { | 10 (function() { |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 this.preferNetwork_ = preferNetwork; | 215 this.preferNetwork_ = preferNetwork; |
| 216 | 216 |
| 217 // Set the IPAddress property to the IPV4 Address. | 217 // Set the IPAddress property to the IPV4 Address. |
| 218 var ipv4 = | 218 var ipv4 = |
| 219 CrOnc.getIPConfigForType(this.networkProperties, CrOnc.IPType.IPV4); | 219 CrOnc.getIPConfigForType(this.networkProperties, CrOnc.IPType.IPV4); |
| 220 this.IPAddress_ = (ipv4 && ipv4.IPAddress) || ''; | 220 this.IPAddress_ = (ipv4 && ipv4.IPAddress) || ''; |
| 221 | 221 |
| 222 // Update the detail page title. | 222 // Update the detail page title. |
| 223 this.parentNode.pageTitle = CrOnc.getNetworkName(this.networkProperties); | 223 this.parentNode.pageTitle = CrOnc.getNetworkName(this.networkProperties); |
| 224 | 224 |
| 225 if (this.didSetFocus_) |
| 226 return; |
| 227 |
| 225 // Focus a button once the initial state is set. | 228 // Focus a button once the initial state is set. |
| 226 if (!this.didSetFocus_) { | 229 this.async(function() { |
| 227 this.didSetFocus_ = true; | 230 this.didSetFocus_ = true; |
| 228 var button = this.$$('#buttonDiv .primary-button:not([hidden])'); | 231 var button = this.$$('#buttonDiv .primary-button:not([hidden])'); |
| 229 if (!button) | 232 if (!button) |
| 230 button = this.$$('#buttonDiv .secondary-button:not([hidden])'); | 233 button = this.$$('#buttonDiv .secondary-button:not([hidden])'); |
| 231 assert(button); // At least one button will always be visible. | 234 assert(button); // At least one button will always be visible. |
| 232 button.focus(); | 235 button.focus(); |
| 233 } | 236 }.bind(this)); |
| 234 }, | 237 }, |
| 235 | 238 |
| 236 /** @private */ | 239 /** @private */ |
| 237 autoConnectChanged_: function() { | 240 autoConnectChanged_: function() { |
| 238 if (!this.networkProperties || !this.guid) | 241 if (!this.networkProperties || !this.guid) |
| 239 return; | 242 return; |
| 240 var onc = this.getEmptyNetworkProperties_(); | 243 var onc = this.getEmptyNetworkProperties_(); |
| 241 CrOnc.setTypeProperty(onc, 'AutoConnect', this.autoConnect_); | 244 CrOnc.setTypeProperty(onc, 'AutoConnect', this.autoConnect_); |
| 242 this.setNetworkProperties_(onc); | 245 this.setNetworkProperties_(onc); |
| 243 }, | 246 }, |
| (...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 930 */ | 933 */ |
| 931 showCellularSim_: function(networkProperties) { | 934 showCellularSim_: function(networkProperties) { |
| 932 if (networkProperties.Type != 'Cellular' || | 935 if (networkProperties.Type != 'Cellular' || |
| 933 !networkProperties.Cellular) { | 936 !networkProperties.Cellular) { |
| 934 return false; | 937 return false; |
| 935 } | 938 } |
| 936 return networkProperties.Cellular.Family == 'GSM'; | 939 return networkProperties.Cellular.Family == 'GSM'; |
| 937 }, | 940 }, |
| 938 | 941 |
| 939 /** | 942 /** |
| 940 * @param {!CrOnc.NetworkProperties} networkProperties | |
| 941 * @return {boolean} | |
| 942 * @private | |
| 943 */ | |
| 944 showIpConfig_: function(networkProperties) { | |
| 945 if (!this.isRememberedOrConnected_(networkProperties)) | |
| 946 return false; | |
| 947 return !!networkProperties.IPAddressConfigType; | |
| 948 }, | |
| 949 | |
| 950 /** | |
| 951 * @param {!Object} curValue | 943 * @param {!Object} curValue |
| 952 * @param {!Object} newValue | 944 * @param {!Object} newValue |
| 953 * @return {boolean} True if all properties set in |newValue| are equal to | 945 * @return {boolean} True if all properties set in |newValue| are equal to |
| 954 * the corresponding properties in |curValue|. Note: Not all properties | 946 * the corresponding properties in |curValue|. Note: Not all properties |
| 955 * of |curValue| need to be specified in |newValue| for this to return | 947 * of |curValue| need to be specified in |newValue| for this to return |
| 956 * true. | 948 * true. |
| 957 * @private | 949 * @private |
| 958 */ | 950 */ |
| 959 allPropertiesMatch_: function(curValue, newValue) { | 951 allPropertiesMatch_: function(curValue, newValue) { |
| 960 for (var key in newValue) { | 952 for (var key in newValue) { |
| 961 if (newValue[key] != curValue[key]) | 953 if (newValue[key] != curValue[key]) |
| 962 return false; | 954 return false; |
| 963 } | 955 } |
| 964 return true; | 956 return true; |
| 965 } | 957 } |
| 966 }); | 958 }); |
| 967 })(); | 959 })(); |
| OLD | NEW |