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

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

Issue 2230533002: Delete dead consumer enrollment code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 4 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 unified diff | Download patch
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 <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 std::string GetPolicyVerificationKey() { 95 std::string GetPolicyVerificationKey() {
96 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 96 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
97 if (command_line->HasSwitch(switches::kDisablePolicyKeyVerification)) { 97 if (command_line->HasSwitch(switches::kDisablePolicyKeyVerification)) {
98 return std::string(); 98 return std::string();
99 } else { 99 } else {
100 return std::string(reinterpret_cast<const char*>(kPolicyVerificationKey), 100 return std::string(reinterpret_cast<const char*>(kPolicyVerificationKey),
101 sizeof(kPolicyVerificationKey)); 101 sizeof(kPolicyVerificationKey));
102 } 102 }
103 } 103 }
104 104
105 void SetManagementMode(em::PolicyData& policy_data, ManagementMode mode) {
106 switch (mode) {
107 case MANAGEMENT_MODE_LOCAL_OWNER:
108 policy_data.set_management_mode(em::PolicyData::LOCAL_OWNER);
109 return;
110
111 case MANAGEMENT_MODE_ENTERPRISE_MANAGED:
112 policy_data.set_management_mode(em::PolicyData::ENTERPRISE_MANAGED);
113 return;
114
115 case MANAGEMENT_MODE_CONSUMER_MANAGED:
116 policy_data.set_management_mode(em::PolicyData::CONSUMER_MANAGED);
117 return;
118 }
119 NOTREACHED();
120 }
121
122 ManagementMode GetManagementMode(const em::PolicyData& policy_data) {
123 if (policy_data.has_management_mode()) {
124 switch (policy_data.management_mode()) {
125 case em::PolicyData::LOCAL_OWNER:
126 return MANAGEMENT_MODE_LOCAL_OWNER;
127
128 case em::PolicyData::ENTERPRISE_MANAGED:
129 return MANAGEMENT_MODE_ENTERPRISE_MANAGED;
130
131 case em::PolicyData::CONSUMER_MANAGED:
132 return MANAGEMENT_MODE_CONSUMER_MANAGED;
133
134 default:
135 NOTREACHED();
136 return MANAGEMENT_MODE_LOCAL_OWNER;
137 }
138 }
139
140 return policy_data.has_request_token() ?
141 MANAGEMENT_MODE_ENTERPRISE_MANAGED : MANAGEMENT_MODE_LOCAL_OWNER;
142 }
143
144 } // namespace policy 105 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698