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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 else | 317 else |
318 ReportResult(EnrollmentStatus::ForStatus( | 318 ReportResult(EnrollmentStatus::ForStatus( |
319 EnrollmentStatus::REGISTRATION_CERT_FETCH_FAILED)); | 319 EnrollmentStatus::REGISTRATION_CERT_FETCH_FAILED)); |
320 } | 320 } |
321 | 321 |
322 void EnrollmentHandlerChromeOS::HandlePolicyValidationResult( | 322 void EnrollmentHandlerChromeOS::HandlePolicyValidationResult( |
323 DeviceCloudPolicyValidator* validator) { | 323 DeviceCloudPolicyValidator* validator) { |
324 DCHECK_EQ(STEP_VALIDATION, enrollment_step_); | 324 DCHECK_EQ(STEP_VALIDATION, enrollment_step_); |
325 if (validator->success()) { | 325 if (validator->success()) { |
326 std::string username = validator->policy_data()->username(); | 326 std::string username = validator->policy_data()->username(); |
327 // TODO(rsorokin): remove device_mode_ check when device is locked | |
328 // with both realm and domain. | |
329 if (device_mode_ != DEVICE_MODE_ENTERPRISE_AD) | |
330 domain_ = gaia::ExtractDomainName(gaia::CanonicalizeEmail(username)); | |
331 device_id_ = validator->policy_data()->device_id(); | 327 device_id_ = validator->policy_data()->device_id(); |
332 policy_ = std::move(validator->policy()); | 328 policy_ = std::move(validator->policy()); |
333 SetStep(STEP_ROBOT_AUTH_FETCH); | 329 if (device_mode_ == DEVICE_MODE_ENTERPRISE_AD) { |
334 client_->FetchRobotAuthCodes(auth_token_); | 330 // Don't use robot account for the Active Directory managed devices. |
| 331 skip_robot_auth_ = true; |
| 332 SetStep(STEP_LOCK_DEVICE); |
| 333 StartLockDevice(); |
| 334 } else { |
| 335 domain_ = gaia::ExtractDomainName(gaia::CanonicalizeEmail(username)); |
| 336 SetStep(STEP_ROBOT_AUTH_FETCH); |
| 337 client_->FetchRobotAuthCodes(auth_token_); |
| 338 } |
335 } else { | 339 } else { |
336 ReportResult(EnrollmentStatus::ForValidationError(validator->status())); | 340 ReportResult(EnrollmentStatus::ForValidationError(validator->status())); |
337 } | 341 } |
338 } | 342 } |
339 | 343 |
340 void EnrollmentHandlerChromeOS::OnRobotAuthCodesFetched( | 344 void EnrollmentHandlerChromeOS::OnRobotAuthCodesFetched( |
341 CloudPolicyClient* client) { | 345 CloudPolicyClient* client) { |
342 DCHECK_EQ(client_.get(), client); | 346 DCHECK_EQ(client_.get(), client); |
343 CHECK_EQ(STEP_ROBOT_AUTH_FETCH, enrollment_step_); | 347 CHECK_EQ(STEP_ROBOT_AUTH_FETCH, enrollment_step_); |
344 | 348 |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 callback.Run(status); | 540 callback.Run(status); |
537 } | 541 } |
538 | 542 |
539 void EnrollmentHandlerChromeOS::SetStep(EnrollmentStep step) { | 543 void EnrollmentHandlerChromeOS::SetStep(EnrollmentStep step) { |
540 DCHECK_LE(enrollment_step_, step); | 544 DCHECK_LE(enrollment_step_, step); |
541 VLOG(1) << "Step: " << step; | 545 VLOG(1) << "Step: " << step; |
542 enrollment_step_ = step; | 546 enrollment_step_ = step; |
543 } | 547 } |
544 | 548 |
545 } // namespace policy | 549 } // namespace policy |
OLD | NEW |