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/login/enrollment/enterprise_enrollment_helper_ impl.h" | 5 #include "chrome/browser/chromeos/login/enrollment/enterprise_enrollment_helper_ impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
150 connector->GetEnterpriseDomain() != enrolling_user_domain_) { | 150 connector->GetEnterpriseDomain() != enrolling_user_domain_) { |
151 LOG(ERROR) << "Trying to re-enroll to a different domain than " | 151 LOG(ERROR) << "Trying to re-enroll to a different domain than " |
152 << connector->GetEnterpriseDomain(); | 152 << connector->GetEnterpriseDomain(); |
153 UMA(policy::kMetricEnrollmentPrecheckDomainMismatch); | 153 UMA(policy::kMetricEnrollmentPrecheckDomainMismatch); |
154 if (oauth_status_ != OAUTH_NOT_STARTED) | 154 if (oauth_status_ != OAUTH_NOT_STARTED) |
155 oauth_status_ = OAUTH_FINISHED; | 155 oauth_status_ = OAUTH_FINISHED; |
156 status_consumer()->OnOtherError(OTHER_ERROR_DOMAIN_MISMATCH); | 156 status_consumer()->OnOtherError(OTHER_ERROR_DOMAIN_MISMATCH); |
157 return; | 157 return; |
158 } | 158 } |
159 | 159 |
160 policy::DeviceCloudPolicyInitializer::AllowedDeviceModes device_modes; | |
161 device_modes[policy::DEVICE_MODE_ENTERPRISE] = true; | |
162 connector->ScheduleServiceInitialization(0); | 160 connector->ScheduleServiceInitialization(0); |
163 | |
164 policy::DeviceCloudPolicyInitializer* dcp_initializer = | 161 policy::DeviceCloudPolicyInitializer* dcp_initializer = |
165 connector->GetDeviceCloudPolicyInitializer(); | 162 connector->GetDeviceCloudPolicyInitializer(); |
166 CHECK(dcp_initializer); | 163 CHECK(dcp_initializer); |
achuithb
2016/09/12 18:15:40
Curious: why do we have this CHECK? The next line
Thiemo Nagel
2016/09/12 18:23:56
Dereferencing a nullptr is undefined behavior. If
| |
167 dcp_initializer->StartEnrollment( | 164 dcp_initializer->StartEnrollment( |
168 connector->device_management_service(), enrollment_config_, token, | 165 connector->device_management_service(), enrollment_config_, token, |
169 device_modes, | |
170 base::Bind(&EnterpriseEnrollmentHelperImpl::OnEnrollmentFinished, | 166 base::Bind(&EnterpriseEnrollmentHelperImpl::OnEnrollmentFinished, |
171 weak_ptr_factory_.GetWeakPtr())); | 167 weak_ptr_factory_.GetWeakPtr())); |
172 } | 168 } |
173 | 169 |
174 void EnterpriseEnrollmentHelperImpl::GetDeviceAttributeUpdatePermission() { | 170 void EnterpriseEnrollmentHelperImpl::GetDeviceAttributeUpdatePermission() { |
175 // TODO(pbond): remove this LOG once http://crbug.com/586961 is fixed. | 171 // TODO(pbond): remove this LOG once http://crbug.com/586961 is fixed. |
176 LOG(WARNING) << "Get device attribute update permission"; | 172 LOG(WARNING) << "Get device attribute update permission"; |
177 policy::BrowserPolicyConnectorChromeOS* connector = | 173 policy::BrowserPolicyConnectorChromeOS* connector = |
178 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 174 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
179 policy::DeviceCloudPolicyManagerChromeOS* policy_manager = | 175 policy::DeviceCloudPolicyManagerChromeOS* policy_manager = |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
428 EnrollmentUMA(sample, enrollment_config_.mode); | 424 EnrollmentUMA(sample, enrollment_config_.mode); |
429 } | 425 } |
430 | 426 |
431 void EnterpriseEnrollmentHelperImpl::OnSigninProfileCleared( | 427 void EnterpriseEnrollmentHelperImpl::OnSigninProfileCleared( |
432 const base::Closure& callback) { | 428 const base::Closure& callback) { |
433 oauth_data_cleared_ = true; | 429 oauth_data_cleared_ = true; |
434 callback.Run(); | 430 callback.Run(); |
435 } | 431 } |
436 | 432 |
437 } // namespace chromeos | 433 } // namespace chromeos |
OLD | NEW |