| 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 policy::DeviceCloudPolicyInitializer* dcp_initializer = | 162 policy::DeviceCloudPolicyInitializer* dcp_initializer = |
| 163 connector->GetDeviceCloudPolicyInitializer(); | 163 connector->GetDeviceCloudPolicyInitializer(); |
| 164 CHECK(dcp_initializer); | 164 CHECK(dcp_initializer); |
| 165 dcp_initializer->StartEnrollment( | 165 dcp_initializer->StartEnrollment( |
| 166 connector->device_management_service(), enrollment_config_, token, | 166 connector->device_management_service(), enrollment_config_, token, |
| 167 base::Bind(&EnterpriseEnrollmentHelperImpl::OnEnrollmentFinished, | 167 base::Bind(&EnterpriseEnrollmentHelperImpl::OnEnrollmentFinished, |
| 168 weak_ptr_factory_.GetWeakPtr())); | 168 weak_ptr_factory_.GetWeakPtr())); |
| 169 } | 169 } |
| 170 | 170 |
| 171 void EnterpriseEnrollmentHelperImpl::GetDeviceAttributeUpdatePermission() { | 171 void EnterpriseEnrollmentHelperImpl::GetDeviceAttributeUpdatePermission() { |
| 172 // Don't update device attributes for Active Directory management. | |
| 173 if (!enrollment_config_.management_realm.empty()) { | |
| 174 OnDeviceAttributeUpdatePermission(false); | |
| 175 return; | |
| 176 } | |
| 177 | |
| 178 // TODO(pbond): remove this LOG once http://crbug.com/586961 is fixed. | 172 // TODO(pbond): remove this LOG once http://crbug.com/586961 is fixed. |
| 179 LOG(WARNING) << "Get device attribute update permission"; | 173 LOG(WARNING) << "Get device attribute update permission"; |
| 180 policy::BrowserPolicyConnectorChromeOS* connector = | 174 policy::BrowserPolicyConnectorChromeOS* connector = |
| 181 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 175 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
| 176 // Don't update device attributes for Active Directory management. |
| 177 if (connector->IsActiveDirectoryManaged()) { |
| 178 OnDeviceAttributeUpdatePermission(false); |
| 179 return; |
| 180 } |
| 182 policy::DeviceCloudPolicyManagerChromeOS* policy_manager = | 181 policy::DeviceCloudPolicyManagerChromeOS* policy_manager = |
| 183 connector->GetDeviceCloudPolicyManager(); | 182 connector->GetDeviceCloudPolicyManager(); |
| 184 policy::CloudPolicyClient* client = policy_manager->core()->client(); | 183 policy::CloudPolicyClient* client = policy_manager->core()->client(); |
| 185 | 184 |
| 186 client->GetDeviceAttributeUpdatePermission( | 185 client->GetDeviceAttributeUpdatePermission( |
| 187 oauth_token_, | 186 oauth_token_, |
| 188 base::Bind( | 187 base::Bind( |
| 189 &EnterpriseEnrollmentHelperImpl::OnDeviceAttributeUpdatePermission, | 188 &EnterpriseEnrollmentHelperImpl::OnDeviceAttributeUpdatePermission, |
| 190 weak_ptr_factory_.GetWeakPtr())); | 189 weak_ptr_factory_.GetWeakPtr())); |
| 191 } | 190 } |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 EnrollmentUMA(sample, enrollment_config_.mode); | 433 EnrollmentUMA(sample, enrollment_config_.mode); |
| 435 } | 434 } |
| 436 | 435 |
| 437 void EnterpriseEnrollmentHelperImpl::OnSigninProfileCleared( | 436 void EnterpriseEnrollmentHelperImpl::OnSigninProfileCleared( |
| 438 const base::Closure& callback) { | 437 const base::Closure& callback) { |
| 439 oauth_data_cleared_ = true; | 438 oauth_data_cleared_ = true; |
| 440 callback.Run(); | 439 callback.Run(); |
| 441 } | 440 } |
| 442 | 441 |
| 443 } // namespace chromeos | 442 } // namespace chromeos |
| OLD | NEW |