| 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/auto_enrollment_controller.h" | 5 #include "chrome/browser/chromeos/login/enrollment/auto_enrollment_controller.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 "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 LOG(ERROR) << "Initial auto-enrollment modulus is larger than the limit, " | 134 LOG(ERROR) << "Initial auto-enrollment modulus is larger than the limit, " |
| 135 << "clamping to the limit."; | 135 << "clamping to the limit."; |
| 136 power_initial = power_limit; | 136 power_initial = power_limit; |
| 137 } | 137 } |
| 138 | 138 |
| 139 bool retrieve_device_state = false; | 139 bool retrieve_device_state = false; |
| 140 std::string device_id; | 140 std::string device_id; |
| 141 if (CommandLine::ForCurrentProcess()->HasSwitch( | 141 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 142 chromeos::switches::kEnterpriseEnableForcedReEnrollment)) { | 142 chromeos::switches::kEnterpriseEnableForcedReEnrollment)) { |
| 143 retrieve_device_state = true; | 143 retrieve_device_state = true; |
| 144 device_id = policy::DeviceCloudPolicyManagerChromeOS::GetDeviceStateKey(); | 144 device_id = |
| 145 policy::DeviceCloudPolicyManagerChromeOS::GetCurrentDeviceStateKey(); |
| 145 } else { | 146 } else { |
| 146 device_id = policy::DeviceCloudPolicyManagerChromeOS::GetMachineID(); | 147 device_id = policy::DeviceCloudPolicyManagerChromeOS::GetMachineID(); |
| 147 } | 148 } |
| 148 | 149 |
| 149 client_.reset(new policy::AutoEnrollmentClient( | 150 client_.reset(new policy::AutoEnrollmentClient( |
| 150 base::Bind(&AutoEnrollmentController::UpdateState, | 151 base::Bind(&AutoEnrollmentController::UpdateState, |
| 151 base::Unretained(this)), | 152 base::Unretained(this)), |
| 152 service, | 153 service, |
| 153 g_browser_process->local_state(), | 154 g_browser_process->local_state(), |
| 154 g_browser_process->system_request_context(), | 155 g_browser_process->system_request_context(), |
| 155 device_id, | 156 device_id, |
| 156 retrieve_device_state, | 157 retrieve_device_state, |
| 157 power_initial, | 158 power_initial, |
| 158 power_limit)); | 159 power_limit)); |
| 159 | 160 |
| 160 VLOG(1) << "Starting auto-enrollment client."; | 161 VLOG(1) << "Starting auto-enrollment client."; |
| 161 client_->Start(); | 162 client_->Start(); |
| 162 } | 163 } |
| 163 | 164 |
| 164 void AutoEnrollmentController::UpdateState( | 165 void AutoEnrollmentController::UpdateState( |
| 165 policy::AutoEnrollmentState new_state) { | 166 policy::AutoEnrollmentState new_state) { |
| 166 state_ = new_state; | 167 state_ = new_state; |
| 167 progress_callbacks_.Notify(state_); | 168 progress_callbacks_.Notify(state_); |
| 168 } | 169 } |
| 169 | 170 |
| 170 } // namespace chromeos | 171 } // namespace chromeos |
| OLD | NEW |