Index: ui/webui/resources/cr_elements/v1_0/network/cr_onc_types.js |
diff --git a/ui/webui/resources/cr_elements/v1_0/network/cr_onc_types.js b/ui/webui/resources/cr_elements/v1_0/network/cr_onc_types.js |
index 8ff05c45e5b0bd826e2ee506f7305cde91797ae5..0bbcaee6a0b365e51b8ea069d718edbe87898655 100644 |
--- a/ui/webui/resources/cr_elements/v1_0/network/cr_onc_types.js |
+++ b/ui/webui/resources/cr_elements/v1_0/network/cr_onc_types.js |
@@ -42,6 +42,9 @@ CrOnc.NetworkPropertyType; |
*/ |
CrOnc.ManagedProperty; |
+/** @typedef {!CrOnc.NetworkPropertyType|!CrOnc.ManagedProperty} */ |
+CrOnc.NetworkProperty; |
+ |
/** @typedef {chrome.networkingPrivate.SIMLockStatus} */ |
CrOnc.SIMLockStatus; |
@@ -265,23 +268,34 @@ CrOnc.getSignalStrength = function(properties) { |
} |
/** |
- * Gets the AutoConnect value from |properties| based on properties.Type. |
+ * Gets the Managed AutoConnect dictionary from |properties| based on |
+ * properties.Type. |
* @param {!CrOnc.NetworkProperties|undefined} |
* properties The ONC network properties or state properties. |
- * @return {boolean} The AutoConnect value if it exists or false. |
+ * @return {!chrome.networkingPrivate.ManagedBoolean|undefined} The AutoConnect |
+ * managed dictionary or undefined. |
*/ |
-CrOnc.getAutoConnect = function(properties) { |
+CrOnc.getManagedAutoConnect = function(properties) { |
var type = properties.Type; |
- /** @type {!chrome.networkingPrivate.ManagedBoolean|undefined} */ |
- var autoconnect; |
if (type == CrOnc.Type.CELLULAR && properties.Cellular) |
- autoconnect = properties.Cellular.AutoConnect; |
+ return properties.Cellular.AutoConnect; |
else if (type == CrOnc.Type.VPN && properties.VPN) |
- autoconnect = properties.VPN.AutoConnect; |
+ return properties.VPN.AutoConnect; |
else if (type == CrOnc.Type.WI_FI && properties.WiFi) |
- autoconnect = properties.WiFi.AutoConnect; |
+ return properties.WiFi.AutoConnect; |
else if (type == CrOnc.Type.WI_MAX && properties.WiMAX) |
- autoconnect = properties.WiMAX.AutoConnect; |
+ return properties.WiMAX.AutoConnect; |
+ return undefined; |
+} |
+ |
+/** |
+ * Gets the AutoConnect value from |properties| based on properties.Type. |
+ * @param {!CrOnc.NetworkProperties|undefined} |
+ * properties The ONC network properties or state properties. |
+ * @return {boolean} The AutoConnect value if it exists or false. |
+ */ |
+CrOnc.getAutoConnect = function(properties) { |
+ var autoconnect = CrOnc.getManagedAutoConnect(properties); |
return !!CrOnc.getActiveValue(autoconnect); |
} |