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

Side by Side Diff: components/policy/core/common/cloud/cloud_policy_constants.cc

Issue 769703003: SetManagementSettings() is moved to OwnerSettingsServiceChromeOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Failing test fixed. Created 6 years 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 unified diff | Download patch
« no previous file with comments | « components/policy/core/common/cloud/cloud_policy_constants.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/policy/core/common/cloud/cloud_policy_constants.h" 5 #include "components/policy/core/common/cloud/cloud_policy_constants.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "components/policy/core/common/policy_switches.h" 10 #include "components/policy/core/common/policy_switches.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 99
100 const char* GetChromeUserPolicyType() { 100 const char* GetChromeUserPolicyType() {
101 #if defined(OS_ANDROID) || defined(OS_IOS) 101 #if defined(OS_ANDROID) || defined(OS_IOS)
102 CommandLine* command_line = CommandLine::ForCurrentProcess(); 102 CommandLine* command_line = CommandLine::ForCurrentProcess();
103 if (command_line->HasSwitch(switches::kFakeCloudPolicyType)) 103 if (command_line->HasSwitch(switches::kFakeCloudPolicyType))
104 return "google/chrome/user"; 104 return "google/chrome/user";
105 #endif 105 #endif
106 return dm_protocol::kChromeUserPolicyType; 106 return dm_protocol::kChromeUserPolicyType;
107 } 107 }
108 108
109 void SetManagementMode(em::PolicyData& policy_data, ManagementMode mode) {
110 switch (mode) {
111 case MANAGEMENT_MODE_LOCAL_OWNER:
112 policy_data.set_management_mode(em::PolicyData::LOCAL_OWNER);
113 return;
114
115 case MANAGEMENT_MODE_ENTERPRISE_MANAGED:
116 policy_data.set_management_mode(em::PolicyData::ENTERPRISE_MANAGED);
117 return;
118
119 case MANAGEMENT_MODE_CONSUMER_MANAGED:
120 policy_data.set_management_mode(em::PolicyData::CONSUMER_MANAGED);
121 return;
122 }
123 NOTREACHED();
124 }
125
109 ManagementMode GetManagementMode(const em::PolicyData& policy_data) { 126 ManagementMode GetManagementMode(const em::PolicyData& policy_data) {
110 if (policy_data.has_management_mode()) { 127 if (policy_data.has_management_mode()) {
111 switch (policy_data.management_mode()) { 128 switch (policy_data.management_mode()) {
112 case em::PolicyData::LOCAL_OWNER: 129 case em::PolicyData::LOCAL_OWNER:
113 return MANAGEMENT_MODE_LOCAL_OWNER; 130 return MANAGEMENT_MODE_LOCAL_OWNER;
114 131
115 case em::PolicyData::ENTERPRISE_MANAGED: 132 case em::PolicyData::ENTERPRISE_MANAGED:
116 return MANAGEMENT_MODE_ENTERPRISE_MANAGED; 133 return MANAGEMENT_MODE_ENTERPRISE_MANAGED;
117 134
118 case em::PolicyData::CONSUMER_MANAGED: 135 case em::PolicyData::CONSUMER_MANAGED:
119 return MANAGEMENT_MODE_CONSUMER_MANAGED; 136 return MANAGEMENT_MODE_CONSUMER_MANAGED;
120 137
121 default: 138 default:
122 NOTREACHED(); 139 NOTREACHED();
123 return MANAGEMENT_MODE_LOCAL_OWNER; 140 return MANAGEMENT_MODE_LOCAL_OWNER;
124 } 141 }
125 } 142 }
126 143
127 return policy_data.has_request_token() ? 144 return policy_data.has_request_token() ?
128 MANAGEMENT_MODE_ENTERPRISE_MANAGED : MANAGEMENT_MODE_LOCAL_OWNER; 145 MANAGEMENT_MODE_ENTERPRISE_MANAGED : MANAGEMENT_MODE_LOCAL_OWNER;
129 } 146 }
130 147
131 } // namespace policy 148 } // namespace policy
OLDNEW
« no previous file with comments | « components/policy/core/common/cloud/cloud_policy_constants.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698