| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/policy/device_cloud_policy_manager_chromeos.h" | 5 #include "chrome/browser/policy/device_cloud_policy_manager_chromeos.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 "chrome/browser/chromeos/system/statistics_provider.h" | 9 #include "chrome/browser/chromeos/system/statistics_provider.h" |
| 10 #include "chrome/browser/policy/cloud_policy_client.h" | 10 #include "chrome/browser/policy/cloud_policy_client.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 chromeos::system::StatisticsProvider::GetInstance(); | 126 chromeos::system::StatisticsProvider::GetInstance(); |
| 127 if (!provider->GetMachineStatistic(kMachineInfoSystemHwqual, &machine_model)) | 127 if (!provider->GetMachineStatistic(kMachineInfoSystemHwqual, &machine_model)) |
| 128 LOG(WARNING) << "Failed to get machine model."; | 128 LOG(WARNING) << "Failed to get machine model."; |
| 129 | 129 |
| 130 return machine_model; | 130 return machine_model; |
| 131 } | 131 } |
| 132 | 132 |
| 133 scoped_ptr<CloudPolicyClient> DeviceCloudPolicyManagerChromeOS::CreateClient() { | 133 scoped_ptr<CloudPolicyClient> DeviceCloudPolicyManagerChromeOS::CreateClient() { |
| 134 return make_scoped_ptr( | 134 return make_scoped_ptr( |
| 135 new CloudPolicyClient(GetMachineID(), GetMachineModel(), | 135 new CloudPolicyClient(GetMachineID(), GetMachineModel(), |
| 136 USER_AFFILIATION_NONE, POLICY_SCOPE_MACHINE, NULL, | 136 USER_AFFILIATION_NONE, |
| 137 CloudPolicyClient::POLICY_TYPE_DEVICE, NULL, |
| 137 device_management_service_)); | 138 device_management_service_)); |
| 138 } | 139 } |
| 139 | 140 |
| 140 void DeviceCloudPolicyManagerChromeOS::EnrollmentCompleted( | 141 void DeviceCloudPolicyManagerChromeOS::EnrollmentCompleted( |
| 141 const EnrollmentCallback& callback, | 142 const EnrollmentCallback& callback, |
| 142 EnrollmentStatus status) { | 143 EnrollmentStatus status) { |
| 143 if (status.status() == EnrollmentStatus::STATUS_SUCCESS) { | 144 if (status.status() == EnrollmentStatus::STATUS_SUCCESS) { |
| 144 InitializeService(enrollment_handler_->ReleaseClient()); | 145 InitializeService(enrollment_handler_->ReleaseClient()); |
| 145 StartRefreshScheduler(local_state_, prefs::kDevicePolicyRefreshRate); | 146 StartRefreshScheduler(local_state_, prefs::kDevicePolicyRefreshRate); |
| 146 } else { | 147 } else { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 157 local_state_ && | 158 local_state_ && |
| 158 cloud_policy_store()->is_initialized() && | 159 cloud_policy_store()->is_initialized() && |
| 159 cloud_policy_store()->is_managed() && | 160 cloud_policy_store()->is_managed() && |
| 160 !cloud_policy_service()) { | 161 !cloud_policy_service()) { |
| 161 InitializeService(CreateClient()); | 162 InitializeService(CreateClient()); |
| 162 StartRefreshScheduler(local_state_, prefs::kDevicePolicyRefreshRate); | 163 StartRefreshScheduler(local_state_, prefs::kDevicePolicyRefreshRate); |
| 163 } | 164 } |
| 164 } | 165 } |
| 165 | 166 |
| 166 } // namespace policy | 167 } // namespace policy |
| OLD | NEW |