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

Unified Diff: components/policy/core/common/cloud/cloud_policy_constants.cc

Issue 742513006: Add ManagementMode enum and GetManagementMode(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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: components/policy/core/common/cloud/cloud_policy_constants.cc
diff --git a/components/policy/core/common/cloud/cloud_policy_constants.cc b/components/policy/core/common/cloud/cloud_policy_constants.cc
index 892deaa3ab61cd6587a6b340885c2544130cf773..e574dea6642c0edaf38460b8b6eeebaaa373394a 100644
--- a/components/policy/core/common/cloud/cloud_policy_constants.cc
+++ b/components/policy/core/common/cloud/cloud_policy_constants.cc
@@ -6,7 +6,11 @@
#include "base/basictypes.h"
#include "base/command_line.h"
+#include "base/logging.h"
#include "components/policy/core/common/policy_switches.h"
+#include "policy/proto/device_management_backend.pb.h"
+
+namespace em = enterprise_management;
namespace policy {
@@ -102,4 +106,26 @@ const char* GetChromeUserPolicyType() {
return dm_protocol::kChromeUserPolicyType;
}
+ManagementMode GetManagementMode(const em::PolicyData& policy_data) {
+ if (policy_data.has_management_mode()) {
+ switch (policy_data.management_mode()) {
+ case em::PolicyData::LOCAL_OWNER:
+ return MANAGEMENT_MODE_LOCAL;
+
+ case em::PolicyData::ENTERPRISE_MANAGED:
+ return MANAGEMENT_MODE_ENTERPRISE;
+
+ case em::PolicyData::CONSUMER_MANAGED:
+ return MANAGEMENT_MODE_CONSUMER;
+
+ default:
+ NOTREACHED();
+ return MANAGEMENT_MODE_LOCAL;
+ }
+ }
+
+ return policy_data.has_request_token() ?
+ MANAGEMENT_MODE_ENTERPRISE : MANAGEMENT_MODE_LOCAL;
+}
+
} // namespace policy

Powered by Google App Engine
This is Rietveld 408576698