Commit f8bf020b authored by Steven Bennetts's avatar Steven Bennetts Committed by Commit Bot

Fixes for internet detail page mojo conversion

This fixes the following:
* Fixes an issue where the scanning spinner wasn't showing for cellular
* Fixes logic causing the 'connectable' property to be ignored, except
  for Cellular (where it should be ignored), for 'Connect' button
  visibility.
* Fixes incorrect logic determining when to show 'Allow Shared Proxies'
* Only shows the 'Restricted IP' property when 'True' (matching previous
  logic).

Bug: 853953, 1001996
Change-Id: I2461a4e6520f6016731c6d16920cf34d4ab897f2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1799802
Commit-Queue: Steven Bennetts <stevenjb@chromium.org>
Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#696056}
parent e3516fff
...@@ -284,7 +284,7 @@ ...@@ -284,7 +284,7 @@
$i18n{networkSectionNetwork} $i18n{networkSectionNetwork}
</div> </div>
<template is="dom-if" <template is="dom-if"
if="[[showScanningSpinner_(managedProperties_)]]"> if="[[showScanningSpinner_(managedProperties_, deviceState_)]]">
<paper-spinner-lite active></paper-spinner-lite> <paper-spinner-lite active></paper-spinner-lite>
</template> </template>
</div> </div>
......
...@@ -312,15 +312,19 @@ Polymer({ ...@@ -312,15 +312,19 @@ Polymer({
/** CrosNetworkConfigObserver impl */ /** CrosNetworkConfigObserver impl */
onNetworkStateListChanged: function() { onNetworkStateListChanged: function() {
if (!this.guid || !this.managedProperties_) {
return;
}
this.checkNetworkExists_(); this.checkNetworkExists_();
}, },
/** CrosNetworkConfigObserver impl */ /** CrosNetworkConfigObserver impl */
onDeviceStateListChanged: function() { onDeviceStateListChanged: function() {
this.getDeviceState_(); if (!this.guid || !this.managedProperties_) {
if (this.guid) { return;
this.getNetworkDetails_();
} }
this.getDeviceState_();
this.getNetworkDetails_();
}, },
/** @private */ /** @private */
...@@ -706,9 +710,9 @@ Polymer({ ...@@ -706,9 +710,9 @@ Polymer({
mojom.ConnectionStateType.kNotConnected) { mojom.ConnectionStateType.kNotConnected) {
return false; return false;
} }
// Cellular is not configurable, so we show a disabled connect button of // Cellular is not configurable, so we always show the connect button, and
// connectable is false. // disable it if 'connectable' is false.
if (managedProperties.type != mojom.NetworkType.kCellular) { if (managedProperties.type == mojom.NetworkType.kCellular) {
return true; return true;
} }
// If 'connectable' is false we show the configure button. // If 'connectable' is false we show the configure button.
...@@ -1278,9 +1282,10 @@ Polymer({ ...@@ -1278,9 +1282,10 @@ Polymer({
/** @type {!Array<string>} */ const fields = []; /** @type {!Array<string>} */ const fields = [];
const type = this.managedProperties_.type; const type = this.managedProperties_.type;
if (type == mojom.NetworkType.kCellular) { if (type == mojom.NetworkType.kCellular) {
fields.push( fields.push('cellular.activationState', 'cellular.servingOperator.name');
'cellular.activationState', 'restrictedConnectivity', if (this.managedProperties_.restrictedConnectivity) {
'cellular.servingOperator.name'); fields.push('restrictedConnectivity');
}
} else if (type == mojom.NetworkType.kTether) { } else if (type == mojom.NetworkType.kTether) {
fields.push( fields.push(
'tether.batteryPercentage', 'tether.signalStrength', 'tether.batteryPercentage', 'tether.signalStrength',
...@@ -1304,7 +1309,9 @@ Polymer({ ...@@ -1304,7 +1309,9 @@ Polymer({
break; break;
} }
} else if (type == mojom.NetworkType.kWiFi) { } else if (type == mojom.NetworkType.kWiFi) {
fields.push('restrictedConnectivity'); if (this.managedProperties_.restrictedConnectivity) {
fields.push('restrictedConnectivity');
}
} }
return fields; return fields;
}, },
...@@ -1480,14 +1487,15 @@ Polymer({ ...@@ -1480,14 +1487,15 @@ Polymer({
}, },
/** /**
* @param {!mojom.ManagedProperties} managedProperties
* @return {boolean} * @return {boolean}
* @private * @private
*/ */
showScanningSpinner_: function(managedProperties) { showScanningSpinner_: function() {
return !!managedProperties && if (!this.managedProperties_ ||
managedProperties.type == mojom.NetworkType.kCellular && this.managedProperties_.type != mojom.NetworkType.kCellular) {
managedProperties.cellular.scanning; return false;
}
return !!this.deviceState_ && this.deviceState_.scanning;
}, },
/** /**
......
...@@ -62,8 +62,7 @@ ...@@ -62,8 +62,7 @@
<!-- Allow shared proxies --> <!-- Allow shared proxies -->
<settings-toggle-button id="allowShared" class="continuation indented" <settings-toggle-button id="allowShared" class="continuation indented"
hidden$="[[!shouldShowAllowShared_( hidden$="[[!shouldShowAllowShared_(managedProperties.source)]]"
managedProperties.proxySettings.type)]]"
pref="{{prefs.settings.use_shared_proxies}}" pref="{{prefs.settings.use_shared_proxies}}"
label="$i18n{networkProxyAllowShared}" label="$i18n{networkProxyAllowShared}"
on-settings-boolean-control-change="onAllowSharedProxiesChange_" on-settings-boolean-control-change="onAllowSharedProxiesChange_"
......
...@@ -55,8 +55,8 @@ Polymer({ ...@@ -55,8 +55,8 @@ Polymer({
* @private * @private
*/ */
isShared_: function() { isShared_: function() {
return this.managedProperties.source == 'Device' || return this.managedProperties.source == mojom.OncSource.kDevice ||
this.managedProperties.source == 'DevicePolicy'; this.managedProperties.source == mojom.OncSource.kDevicePolicy;
}, },
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment