Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(726)

Unified Diff: ui/webui/resources/cr_elements/v1_0/network/cr_onc_types.js

Issue 1369403006: Add cr-policy-network-indicator and add to internet settings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Separate policy indicator strings Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
}
« no previous file with comments | « extensions/common/api/networking_private.idl ('k') | ui/webui/resources/cr_elements/v1_0/policy/compiled_resources.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698