| 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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 if (this.didSetFocus_) { | 235 if (this.didSetFocus_) { |
| 236 // Focus a button once the initial state is set. | 236 // Focus a button once the initial state is set. |
| 237 this.didSetFocus_ = true; | 237 this.didSetFocus_ = true; |
| 238 var button = this.$$('#buttonDiv .primary-button:not([hidden])'); | 238 var button = this.$$('#buttonDiv .primary-button:not([hidden])'); |
| 239 if (!button) | 239 if (!button) |
| 240 button = this.$$('#buttonDiv .secondary-button:not([hidden])'); | 240 button = this.$$('#buttonDiv .secondary-button:not([hidden])'); |
| 241 assert(button); // At least one button will always be visible. | 241 assert(button); // At least one button will always be visible. |
| 242 button.focus(); | 242 button.focus(); |
| 243 } | 243 } |
| 244 | 244 |
| 245 if (this.shoudlShowConfigureWhenNetworkLoaded_ | 245 if (this.shoudlShowConfigureWhenNetworkLoaded_ && |
| 246 && this.networkProperties.Tether) { | 246 this.networkProperties.Tether) { |
| 247 this.showTetherDialog_(); | 247 this.showTetherDialog_(); |
| 248 } | 248 } |
| 249 }, | 249 }, |
| 250 | 250 |
| 251 /** @private */ | 251 /** @private */ |
| 252 autoConnectChanged_: function() { | 252 autoConnectChanged_: function() { |
| 253 if (!this.networkProperties || !this.guid) | 253 if (!this.networkProperties || !this.guid) |
| 254 return; | 254 return; |
| 255 var onc = this.getEmptyNetworkProperties_(); | 255 var onc = this.getEmptyNetworkProperties_(); |
| 256 CrOnc.setTypeProperty(onc, 'AutoConnect', this.autoConnect_); | 256 CrOnc.setTypeProperty(onc, 'AutoConnect', this.autoConnect_); |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 }, | 560 }, |
| 561 | 561 |
| 562 /** @private */ | 562 /** @private */ |
| 563 onConnectTap_: function() { | 563 onConnectTap_: function() { |
| 564 this.fire('network-connect', {networkProperties: this.networkProperties}); | 564 this.fire('network-connect', {networkProperties: this.networkProperties}); |
| 565 }, | 565 }, |
| 566 | 566 |
| 567 /** @private */ | 567 /** @private */ |
| 568 onTetherConnect_: function() { | 568 onTetherConnect_: function() { |
| 569 this.getTetherDialog_().close(); | 569 this.getTetherDialog_().close(); |
| 570 this.fire('network-connect', | 570 this.fire('network-connect', { |
| 571 {networkProperties: this.networkProperties, | 571 networkProperties: this.networkProperties, |
| 572 bypassConnectionDialog: true}); | 572 bypassConnectionDialog: true |
| 573 }); |
| 573 }, | 574 }, |
| 574 | 575 |
| 575 /** @private */ | 576 /** @private */ |
| 576 onTetherDialogClose_: function() { | 577 onTetherDialogClose_: function() { |
| 577 // The tether dialog is opened by specifying "showConfigure=true" | 578 // The tether dialog is opened by specifying "showConfigure=true" |
| 578 // in the query params. This may lead to the previous route also | 579 // in the query params. This may lead to the previous route also |
| 579 // being the detail page, in which case we should navigate back to | 580 // being the detail page, in which case we should navigate back to |
| 580 // the previous route here so that when the user navigates back | 581 // the previous route here so that when the user navigates back |
| 581 // they will navigate to the previous non-detail page. | 582 // they will navigate to the previous non-detail page. |
| 582 if (this.wasPreviousRouteNetworkDetailPage_) | 583 if (this.wasPreviousRouteNetworkDetailPage_) |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 967 return true; | 968 return true; |
| 968 return this.isRememberedOrConnected_(networkProperties); | 969 return this.isRememberedOrConnected_(networkProperties); |
| 969 }, | 970 }, |
| 970 | 971 |
| 971 /** | 972 /** |
| 972 * @param {!CrOnc.NetworkProperties} networkProperties | 973 * @param {!CrOnc.NetworkProperties} networkProperties |
| 973 * @return {boolean} | 974 * @return {boolean} |
| 974 * @private | 975 * @private |
| 975 */ | 976 */ |
| 976 showCellularSim_: function(networkProperties) { | 977 showCellularSim_: function(networkProperties) { |
| 977 if (networkProperties.Type != 'Cellular' || | 978 if (networkProperties.Type != 'Cellular' || !networkProperties.Cellular) { |
| 978 !networkProperties.Cellular) { | |
| 979 return false; | 979 return false; |
| 980 } | 980 } |
| 981 return networkProperties.Cellular.Family == 'GSM'; | 981 return networkProperties.Cellular.Family == 'GSM'; |
| 982 }, | 982 }, |
| 983 | 983 |
| 984 /** | 984 /** |
| 985 * @param {!Object} curValue | 985 * @param {!Object} curValue |
| 986 * @param {!Object} newValue | 986 * @param {!Object} newValue |
| 987 * @return {boolean} True if all properties set in |newValue| are equal to | 987 * @return {boolean} True if all properties set in |newValue| are equal to |
| 988 * the corresponding properties in |curValue|. Note: Not all properties | 988 * the corresponding properties in |curValue|. Note: Not all properties |
| 989 * of |curValue| need to be specified in |newValue| for this to return | 989 * of |curValue| need to be specified in |newValue| for this to return |
| 990 * true. | 990 * true. |
| 991 * @private | 991 * @private |
| 992 */ | 992 */ |
| 993 allPropertiesMatch_: function(curValue, newValue) { | 993 allPropertiesMatch_: function(curValue, newValue) { |
| 994 for (var key in newValue) { | 994 for (var key in newValue) { |
| 995 if (newValue[key] != curValue[key]) | 995 if (newValue[key] != curValue[key]) |
| 996 return false; | 996 return false; |
| 997 } | 997 } |
| 998 return true; | 998 return true; |
| 999 } | 999 } |
| 1000 }); | 1000 }); |
| 1001 })(); | 1001 })(); |
| OLD | NEW |