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/chromeos/policy/enrollment_handler_chromeos.h" | 5 #include "chrome/browser/chromeos/policy/enrollment_handler_chromeos.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 | 29 |
30 } // namespace | 30 } // namespace |
31 | 31 |
32 EnrollmentHandlerChromeOS::EnrollmentHandlerChromeOS( | 32 EnrollmentHandlerChromeOS::EnrollmentHandlerChromeOS( |
33 DeviceCloudPolicyStoreChromeOS* store, | 33 DeviceCloudPolicyStoreChromeOS* store, |
34 EnterpriseInstallAttributes* install_attributes, | 34 EnterpriseInstallAttributes* install_attributes, |
35 scoped_ptr<CloudPolicyClient> client, | 35 scoped_ptr<CloudPolicyClient> client, |
36 const std::string& auth_token, | 36 const std::string& auth_token, |
37 const std::string& client_id, | 37 const std::string& client_id, |
38 bool is_auto_enrollment, | 38 bool is_auto_enrollment, |
| 39 const std::string& requisition, |
39 const AllowedDeviceModes& allowed_device_modes, | 40 const AllowedDeviceModes& allowed_device_modes, |
40 const EnrollmentCallback& completion_callback) | 41 const EnrollmentCallback& completion_callback) |
41 : store_(store), | 42 : store_(store), |
42 install_attributes_(install_attributes), | 43 install_attributes_(install_attributes), |
43 client_(client.Pass()), | 44 client_(client.Pass()), |
44 auth_token_(auth_token), | 45 auth_token_(auth_token), |
45 client_id_(client_id), | 46 client_id_(client_id), |
46 is_auto_enrollment_(is_auto_enrollment), | 47 is_auto_enrollment_(is_auto_enrollment), |
| 48 requisition_(requisition), |
47 allowed_device_modes_(allowed_device_modes), | 49 allowed_device_modes_(allowed_device_modes), |
48 completion_callback_(completion_callback), | 50 completion_callback_(completion_callback), |
49 device_mode_(DEVICE_MODE_NOT_SET), | 51 device_mode_(DEVICE_MODE_NOT_SET), |
50 enrollment_step_(STEP_PENDING), | 52 enrollment_step_(STEP_PENDING), |
51 lockbox_init_duration_(0), | 53 lockbox_init_duration_(0), |
52 weak_factory_(this) { | 54 weak_factory_(this) { |
53 CHECK(!client_->is_registered()); | 55 CHECK(!client_->is_registered()); |
54 CHECK_EQ(DM_STATUS_SUCCESS, client_->status()); | 56 CHECK_EQ(DM_STATUS_SUCCESS, client_->status()); |
55 store_->AddObserver(this); | 57 store_->AddObserver(this); |
56 client_->AddObserver(this); | 58 client_->AddObserver(this); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 DCHECK_EQ(store_, store); | 174 DCHECK_EQ(store_, store); |
173 ReportResult(EnrollmentStatus::ForStoreError(store_->status(), | 175 ReportResult(EnrollmentStatus::ForStoreError(store_->status(), |
174 store_->validation_status())); | 176 store_->validation_status())); |
175 } | 177 } |
176 | 178 |
177 void EnrollmentHandlerChromeOS::AttemptRegistration() { | 179 void EnrollmentHandlerChromeOS::AttemptRegistration() { |
178 CHECK_EQ(STEP_LOADING_STORE, enrollment_step_); | 180 CHECK_EQ(STEP_LOADING_STORE, enrollment_step_); |
179 if (store_->is_initialized()) { | 181 if (store_->is_initialized()) { |
180 enrollment_step_ = STEP_REGISTRATION; | 182 enrollment_step_ = STEP_REGISTRATION; |
181 client_->Register(em::DeviceRegisterRequest::DEVICE, | 183 client_->Register(em::DeviceRegisterRequest::DEVICE, |
182 auth_token_, client_id_, is_auto_enrollment_); | 184 auth_token_, client_id_, is_auto_enrollment_, |
| 185 requisition_); |
183 } | 186 } |
184 } | 187 } |
185 | 188 |
186 void EnrollmentHandlerChromeOS::PolicyValidated( | 189 void EnrollmentHandlerChromeOS::PolicyValidated( |
187 DeviceCloudPolicyValidator* validator) { | 190 DeviceCloudPolicyValidator* validator) { |
188 CHECK_EQ(STEP_VALIDATION, enrollment_step_); | 191 CHECK_EQ(STEP_VALIDATION, enrollment_step_); |
189 if (validator->success()) { | 192 if (validator->success()) { |
190 policy_ = validator->policy().Pass(); | 193 policy_ = validator->policy().Pass(); |
191 username_ = validator->policy_data()->username(); | 194 username_ = validator->policy_data()->username(); |
192 device_id_ = validator->policy_data()->device_id(); | 195 device_id_ = validator->policy_data()->device_id(); |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 << " " << status.client_status() | 344 << " " << status.client_status() |
342 << " " << status.validation_status() | 345 << " " << status.validation_status() |
343 << " " << status.store_status(); | 346 << " " << status.store_status(); |
344 } | 347 } |
345 | 348 |
346 if (!callback.is_null()) | 349 if (!callback.is_null()) |
347 callback.Run(status); | 350 callback.Run(status); |
348 } | 351 } |
349 | 352 |
350 } // namespace policy | 353 } // namespace policy |
OLD | NEW |