}
bool DeviceCloudPolicyInitializer::ShouldAutoStartEnrollment() const {
- std::string restore_mode = GetRestoreMode();
- if (restore_mode == kDeviceStateRestoreModeReEnrollmentRequested ||
- restore_mode == kDeviceStateRestoreModeReEnrollmentEnforced) {
+ const RestoreMode restore_mode = GetRestoreMode();
+ if (restore_mode == RESTORE_MODE_REENROLLMENT_REQUESTED ||
+ restore_mode == RESTORE_MODE_REENROLLMENT_ENFORCED) {
return true;
}
}
bool DeviceCloudPolicyInitializer::CanExitEnrollment() const {
- if (GetRestoreMode() == kDeviceStateRestoreModeReEnrollmentEnforced)
+ if (GetRestoreMode() == RESTORE_MODE_REENROLLMENT_ENFORCED)
return false;
if (local_state_->HasPrefPath(prefs::kDeviceEnrollmentCanExit))
!device_store_->policy()->request_token().empty() &&
!state_keys_broker_->pending() &&
!enrollment_handler_) {
- DeviceManagementService* service;
+ DeviceManagementService* service = NULL;
if (device_store_->policy()->management_mode() ==
em::PolicyData::CONSUMER_MANAGED) {
service = consumer_service_;
} else {
service = enterprise_service_;
}
- StartConnection(CreateClient(service));
+ if (service)
+ StartConnection(CreateClient(service));
}
}
}
}
-std::string DeviceCloudPolicyInitializer::GetRestoreMode() const {
- const base::DictionaryValue* device_state_dict =
- local_state_->GetDictionary(prefs::kServerBackedDeviceState);
- std::string restore_mode;
- device_state_dict->GetString(kDeviceStateRestoreMode, &restore_mode);
- return restore_mode;
-}
-
} // namespace policy