OLD | NEW |
---|---|
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 Loading... | |
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 default: | |
Mattias Nissler (ping if slow)
2014/12/04 13:05:46
I would prefer moving the NOTREACHED after the swi
ygorshenin1
2014/12/05 09:31:48
Done.
| |
124 NOTREACHED(); | |
125 return; | |
126 } | |
127 } | |
128 | |
109 ManagementMode GetManagementMode(const em::PolicyData& policy_data) { | 129 ManagementMode GetManagementMode(const em::PolicyData& policy_data) { |
110 if (policy_data.has_management_mode()) { | 130 if (policy_data.has_management_mode()) { |
111 switch (policy_data.management_mode()) { | 131 switch (policy_data.management_mode()) { |
112 case em::PolicyData::LOCAL_OWNER: | 132 case em::PolicyData::LOCAL_OWNER: |
113 return MANAGEMENT_MODE_LOCAL_OWNER; | 133 return MANAGEMENT_MODE_LOCAL_OWNER; |
114 | 134 |
115 case em::PolicyData::ENTERPRISE_MANAGED: | 135 case em::PolicyData::ENTERPRISE_MANAGED: |
116 return MANAGEMENT_MODE_ENTERPRISE_MANAGED; | 136 return MANAGEMENT_MODE_ENTERPRISE_MANAGED; |
117 | 137 |
118 case em::PolicyData::CONSUMER_MANAGED: | 138 case em::PolicyData::CONSUMER_MANAGED: |
119 return MANAGEMENT_MODE_CONSUMER_MANAGED; | 139 return MANAGEMENT_MODE_CONSUMER_MANAGED; |
120 | 140 |
121 default: | 141 default: |
122 NOTREACHED(); | 142 NOTREACHED(); |
123 return MANAGEMENT_MODE_LOCAL_OWNER; | 143 return MANAGEMENT_MODE_LOCAL_OWNER; |
124 } | 144 } |
125 } | 145 } |
126 | 146 |
127 return policy_data.has_request_token() ? | 147 return policy_data.has_request_token() ? |
128 MANAGEMENT_MODE_ENTERPRISE_MANAGED : MANAGEMENT_MODE_LOCAL_OWNER; | 148 MANAGEMENT_MODE_ENTERPRISE_MANAGED : MANAGEMENT_MODE_LOCAL_OWNER; |
129 } | 149 } |
130 | 150 |
131 } // namespace policy | 151 } // namespace policy |
OLD | NEW |