OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/chromeos/policy/device_cloud_policy_initializer.h" | 5 #include "chrome/browser/chromeos/policy/device_cloud_policy_initializer.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 if (install_attributes_->IsEnterpriseDevice() && | 133 if (install_attributes_->IsEnterpriseDevice() && |
134 chromeos::StartupUtils::IsEnrollmentRecoveryRequired()) { | 134 chromeos::StartupUtils::IsEnrollmentRecoveryRequired()) { |
135 LOG(WARNING) << "Enrollment recovery required according to pref."; | 135 LOG(WARNING) << "Enrollment recovery required according to pref."; |
136 if (!DeviceCloudPolicyManagerChromeOS::GetMachineID().empty()) | 136 if (!DeviceCloudPolicyManagerChromeOS::GetMachineID().empty()) |
137 return true; | 137 return true; |
138 LOG(WARNING) << "Postponing recovery because machine id is missing."; | 138 LOG(WARNING) << "Postponing recovery because machine id is missing."; |
139 } | 139 } |
140 return false; | 140 return false; |
141 } | 141 } |
142 | 142 |
| 143 std::string DeviceCloudPolicyInitializer::GetEnrollmentRecoveryDomain() const { |
| 144 return install_attributes_->GetDomain(); |
| 145 } |
| 146 |
143 bool DeviceCloudPolicyInitializer::CanExitEnrollment() const { | 147 bool DeviceCloudPolicyInitializer::CanExitEnrollment() const { |
144 if (GetRestoreMode() == kDeviceStateRestoreModeReEnrollmentEnforced) | 148 if (GetRestoreMode() == kDeviceStateRestoreModeReEnrollmentEnforced) |
145 return false; | 149 return false; |
146 | 150 |
147 if (local_state_->HasPrefPath(prefs::kDeviceEnrollmentCanExit)) | 151 if (local_state_->HasPrefPath(prefs::kDeviceEnrollmentCanExit)) |
148 return local_state_->GetBoolean(prefs::kDeviceEnrollmentCanExit); | 152 return local_state_->GetBoolean(prefs::kDeviceEnrollmentCanExit); |
149 | 153 |
150 return GetMachineFlag(chromeos::system::kOemCanExitEnterpriseEnrollmentKey, | 154 return GetMachineFlag(chromeos::system::kOemCanExitEnterpriseEnrollmentKey, |
151 true); | 155 true); |
152 } | 156 } |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 | 237 |
234 std::string DeviceCloudPolicyInitializer::GetRestoreMode() const { | 238 std::string DeviceCloudPolicyInitializer::GetRestoreMode() const { |
235 const base::DictionaryValue* device_state_dict = | 239 const base::DictionaryValue* device_state_dict = |
236 local_state_->GetDictionary(prefs::kServerBackedDeviceState); | 240 local_state_->GetDictionary(prefs::kServerBackedDeviceState); |
237 std::string restore_mode; | 241 std::string restore_mode; |
238 device_state_dict->GetString(kDeviceStateRestoreMode, &restore_mode); | 242 device_state_dict->GetString(kDeviceStateRestoreMode, &restore_mode); |
239 return restore_mode; | 243 return restore_mode; |
240 } | 244 } |
241 | 245 |
242 } // namespace policy | 246 } // namespace policy |
OLD | NEW |