Chromium Code Reviews| Index: chrome/browser/resources/settings/internet_page/network_summary_item.js |
| diff --git a/chrome/browser/resources/settings/internet_page/network_summary_item.js b/chrome/browser/resources/settings/internet_page/network_summary_item.js |
| index f688f0524e3041e42e1a1aa8c2acbe65fc762aa4..d3e0496201bdda7cc6ea1c0452d949438302afef 100644 |
| --- a/chrome/browser/resources/settings/internet_page/network_summary_item.js |
| +++ b/chrome/browser/resources/settings/internet_page/network_summary_item.js |
| @@ -4,7 +4,9 @@ |
| /** |
| * @fileoverview Polymer element for displaying the network state for a specific |
| - * type and a list of networks for that type. |
| + * type and a list of networks for that type. NOTE: It both Cellular and Tether |
| + * technologies are available, they are combined into a single 'Mobile data' |
| + * section. See crbug.com/726380. |
| */ |
| Polymer({ |
| @@ -21,6 +23,13 @@ Polymer({ |
| deviceState: Object, |
| /** |
| + * If both Cellular and Tether technologies exist, we combine the sections |
| + * and set this to the device state for Tether. |
| + * @type {!CrOnc.DeviceStateProperties|undefined} |
| + */ |
| + tetherDeviceState: Object, |
| + |
| + /** |
| * Network state for the active network. |
| * @type {!CrOnc.NetworkStateProperties|undefined} |
| */ |
| @@ -162,7 +171,8 @@ Polymer({ |
| */ |
| enableToggleIsVisible_: function(deviceState) { |
| return !!deviceState && deviceState.Type != CrOnc.Type.ETHERNET && |
| - deviceState.Type != CrOnc.Type.VPN; |
| + deviceState.Type != CrOnc.Type.VPN && |
| + deviceState.State != CrOnc.DeviceState.UNINITIALIZED; |
|
Kyle Horimoto
2017/06/01 20:15:21
If Type == CELLULAR and neither Cellular or Tether
stevenjb
2017/06/01 21:55:03
Enable/Disable is separate for networks existing,
|
| }, |
| /** |
| @@ -171,7 +181,8 @@ Polymer({ |
| * @private |
| */ |
| enableToggleIsEnabled_: function(deviceState) { |
| - return !!deviceState && deviceState.State != CrOnc.DeviceState.PROHIBITED; |
| + return this.enableToggleIsVisible_(deviceState) && |
| + deviceState.State != CrOnc.DeviceState.PROHIBITED; |
| }, |
| /** |
| @@ -184,7 +195,6 @@ Polymer({ |
| return ''; |
| switch (deviceState.Type) { |
| case CrOnc.Type.TETHER: |
| - return this.i18n('internetToggleTetherA11yLabel'); |
| case CrOnc.Type.CELLULAR: |
| return this.i18n('internetToggleMobileA11yLabel'); |
| case CrOnc.Type.WI_FI: |
| @@ -219,9 +229,10 @@ Polymer({ |
| if (!deviceState) |
| return false; |
| var type = deviceState.Type; |
| - var minlen = (deviceState.Type == CrOnc.Type.WI_FI || |
| - deviceState.Type == CrOnc.Type.VPN || |
| - deviceState.Type == CrOnc.Type.TETHER) ? |
| + if (type == CrOnc.Type.CELLULAR && this.tetherDeviceState) |
|
Kyle Horimoto
2017/06/01 20:15:21
nit: Shouldn't this be !!this.tetherDeviceState?
stevenjb
2017/06/01 21:55:03
That's only necessary when you are returning a boo
|
| + return true; |
| + var minlen = (type == CrOnc.Type.WI_FI || type == CrOnc.Type.VPN || |
| + type == CrOnc.Type.TETHER) ? |
|
Kyle Horimoto
2017/06/01 20:15:21
Isn't it impossible for type to be TETHER now that
stevenjb
2017/06/01 21:55:03
We combine Tether with Cellular *IF* Cellular exis
|
| 1 : |
| 2; |
| return networkStateList.length >= minlen; |
| @@ -233,9 +244,11 @@ Polymer({ |
| */ |
| onShowDetailsTap_: function(event) { |
| if (!this.deviceIsEnabled_(this.deviceState)) { |
| - this.fire( |
| - 'device-enabled-toggled', |
| - {enabled: true, type: this.deviceState.Type}); |
| + if (this.enableToggleIsEnabled_(this.deviceState)) { |
| + this.fire( |
| + 'device-enabled-toggled', |
| + {enabled: true, type: this.deviceState.Type}); |
| + } |
| } else if (this.shouldShowSubpage_( |
| this.deviceState, this.networkStateList)) { |
| this.fire('show-networks', this.deviceState); |