| Index: chrome/browser/chromeos/login/enrollment/enterprise_enrollment_helper_impl.cc
|
| diff --git a/chrome/browser/chromeos/login/enrollment/enterprise_enrollment_helper_impl.cc b/chrome/browser/chromeos/login/enrollment/enterprise_enrollment_helper_impl.cc
|
| index ad710bf0babdacff670bb06734dff41d0928aad0..ce77bf3221801919900c5c76567af930d714a06f 100644
|
| --- a/chrome/browser/chromeos/login/enrollment/enterprise_enrollment_helper_impl.cc
|
| +++ b/chrome/browser/chromeos/login/enrollment/enterprise_enrollment_helper_impl.cc
|
| @@ -187,6 +187,36 @@ void EnterpriseEnrollmentHelperImpl::DoEnrollUsingToken(
|
| weak_ptr_factory_.GetWeakPtr()));
|
| }
|
|
|
| +void EnterpriseEnrollmentHelperImpl::GetDeviceAttributeUpdatePermission() {
|
| + policy::BrowserPolicyConnectorChromeOS* connector =
|
| + g_browser_process->platform_part()->browser_policy_connector_chromeos();
|
| + policy::DeviceCloudPolicyManagerChromeOS* policy_manager =
|
| + connector->GetDeviceCloudPolicyManager();
|
| + policy::CloudPolicyClient* client = policy_manager->core()->client();
|
| +
|
| + client->GetDeviceAttributeUpdatePermission(
|
| + GetOAuthToken(),
|
| + base::Bind(
|
| + &EnterpriseEnrollmentHelperImpl::OnDeviceAttributeUpdatePermission,
|
| + weak_ptr_factory_.GetWeakPtr()));
|
| +}
|
| +
|
| +void EnterpriseEnrollmentHelperImpl::UpdateDeviceAttributes(
|
| + const std::string& asset_id,
|
| + const std::string& location) {
|
| + policy::BrowserPolicyConnectorChromeOS* connector =
|
| + g_browser_process->platform_part()->browser_policy_connector_chromeos();
|
| + policy::DeviceCloudPolicyManagerChromeOS* policy_manager =
|
| + connector->GetDeviceCloudPolicyManager();
|
| + policy::CloudPolicyClient* client = policy_manager->core()->client();
|
| +
|
| + client->UpdateDeviceAttributes(
|
| + GetOAuthToken(), asset_id, location,
|
| + base::Bind(
|
| + &EnterpriseEnrollmentHelperImpl::OnDeviceAttributeUploadCompleted,
|
| + weak_ptr_factory_.GetWeakPtr()));
|
| +}
|
| +
|
| void EnterpriseEnrollmentHelperImpl::OnTokenFetched(
|
| size_t fetcher_index,
|
| const std::string& token,
|
| @@ -225,6 +255,16 @@ void EnterpriseEnrollmentHelperImpl::OnEnrollmentFinished(
|
| }
|
| }
|
|
|
| +void EnterpriseEnrollmentHelperImpl::OnDeviceAttributeUpdatePermission(
|
| + bool granted) {
|
| + status_consumer()->OnDeviceAttributeUpdatePermission(granted);
|
| +}
|
| +
|
| +void EnterpriseEnrollmentHelperImpl::OnDeviceAttributeUploadCompleted(
|
| + bool success) {
|
| + status_consumer()->OnDeviceAttributeUploadCompleted(success);
|
| +}
|
| +
|
| void EnterpriseEnrollmentHelperImpl::ReportAuthStatus(
|
| const GoogleServiceAuthError& error) {
|
| switch (error.state()) {
|
| @@ -378,6 +418,9 @@ void EnterpriseEnrollmentHelperImpl::ReportEnrollmentStatus(
|
| UMA(policy::kMetricEnrollmentStoreTokenAndIdFailed);
|
| NOTREACHED();
|
| break;
|
| + case policy::EnrollmentStatus::STATUS_ATTRIBUTE_UPDATE_FAILED:
|
| + UMA(policy::kMetricEnrollmentAttributeUpdateFailed);
|
| + break;
|
| }
|
| }
|
|
|
| @@ -402,4 +445,9 @@ void EnterpriseEnrollmentHelperImpl::OnBrowsingDataRemoverDone() {
|
| }
|
| }
|
|
|
| +const std::string& EnterpriseEnrollmentHelperImpl::GetOAuthToken() {
|
| + DCHECK(oauth_fetchers_.size() > 0);
|
| + return oauth_fetchers_[0]->oauth2_access_token();
|
| +}
|
| +
|
| } // namespace chromeos
|
|
|