Commit 6b0a0e0a authored by James Vecore's avatar James Vecore Committed by Commit Bot

[Networking] Fixed closure issues with networking struct validation

Fixes warnings produced when this CL is patched in
https://crrev.com/c/2006413 which does stricter type checking on mojom
structs from colsure.

Fixed: 1047844
Change-Id: Ia1dd0159329ec697bce6d5b832abc8a70d083706
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2050846
Commit-Queue: James Vecore <vecore@google.com>
Auto-Submit: James Vecore <vecore@google.com>
Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#740532}
parent c08274e9
...@@ -395,13 +395,37 @@ Polymer({ ...@@ -395,13 +395,37 @@ Polymer({
return; return;
} }
const PolicySource = chromeos.networkConfig.mojom.PolicySource;
let enforcement; let enforcement;
let controlledBy; let controlledBy;
if (autoConnect.enforced ||
(!!this.globalPolicy && if (this.globalPolicy &&
!!this.globalPolicy.allowOnlyPolicyNetworksToAutoconnect)) { this.globalPolicy.allowOnlyPolicyNetworksToAutoconnect) {
enforcement = chrome.settingsPrivate.Enforcement.ENFORCED; enforcement = chrome.settingsPrivate.Enforcement.ENFORCED;
controlledBy = chrome.settingsPrivate.ControlledBy.DEVICE_POLICY; controlledBy = chrome.settingsPrivate.ControlledBy.DEVICE_POLICY;
} else {
switch (autoConnect.policySource) {
case PolicySource.kUserPolicyEnforced:
case PolicySource.kDevicePolicyEnforced:
enforcement = chrome.settingsPrivate.Enforcement.ENFORCED;
break;
case PolicySource.kUserPolicyRecommended:
case PolicySource.kDevicePolicyRecommended:
enforcement = chrome.settingsPrivate.Enforcement.RECOMMENDED;
break;
}
switch (autoConnect.policySource) {
case PolicySource.kDevicePolicyEnforced:
case PolicySource.kDevicePolicyRecommended:
controlledBy = chrome.settingsPrivate.ControlledBy.DEVICE_POLICY;
break;
case PolicySource.kUserPolicyEnforced:
case PolicySource.kUserPolicyRecommended:
controlledBy = chrome.settingsPrivate.ControlledBy.USER_POLICY;
break;
}
} }
if (this.autoConnectPref_ && if (this.autoConnectPref_ &&
...@@ -909,8 +933,7 @@ Polymer({ ...@@ -909,8 +933,7 @@ Polymer({
if (!managedProperties) { if (!managedProperties) {
return false; return false;
} }
for (const key of Object.keys(managedProperties)) { for (const value of Object.values(managedProperties)) {
const value = managedProperties[key];
if (typeof value != 'object' || value === null) { if (typeof value != 'object' || value === null) {
continue; continue;
} }
......
...@@ -669,7 +669,7 @@ Polymer({ ...@@ -669,7 +669,7 @@ Polymer({
* @private * @private
*/ */
matchesType_(typeString, device) { matchesType_(typeString, device) {
return device && return !!device &&
device.type == OncMojo.getNetworkTypeFromString(typeString); device.type == OncMojo.getNetworkTypeFromString(typeString);
}, },
......
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