| 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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 weak_ptr_factory_.GetWeakPtr())); | 191 weak_ptr_factory_.GetWeakPtr())); |
| 192 } | 192 } |
| 193 | 193 |
| 194 void EnrollmentHandlerChromeOS::OnRegistrationStateChanged( | 194 void EnrollmentHandlerChromeOS::OnRegistrationStateChanged( |
| 195 CloudPolicyClient* client) { | 195 CloudPolicyClient* client) { |
| 196 DCHECK_EQ(client_.get(), client); | 196 DCHECK_EQ(client_.get(), client); |
| 197 | 197 |
| 198 if (enrollment_step_ == STEP_REGISTRATION && client_->is_registered()) { | 198 if (enrollment_step_ == STEP_REGISTRATION && client_->is_registered()) { |
| 199 SetStep(STEP_POLICY_FETCH); | 199 SetStep(STEP_POLICY_FETCH); |
| 200 device_mode_ = client_->device_mode(); | 200 device_mode_ = client_->device_mode(); |
| 201 // TODO(rsorokin): remove after have proper test server. | |
| 202 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | |
| 203 chromeos::switches::kEnableAd)) { | |
| 204 device_mode_ = DEVICE_MODE_ENTERPRISE_AD; | |
| 205 } | |
| 206 if (device_mode_ != DEVICE_MODE_ENTERPRISE && | 201 if (device_mode_ != DEVICE_MODE_ENTERPRISE && |
| 207 device_mode_ != DEVICE_MODE_ENTERPRISE_AD) { | 202 device_mode_ != DEVICE_MODE_ENTERPRISE_AD) { |
| 208 LOG(ERROR) << "Bad device mode " << device_mode_; | 203 LOG(ERROR) << "Bad device mode " << device_mode_; |
| 209 ReportResult(EnrollmentStatus::ForStatus( | 204 ReportResult(EnrollmentStatus::ForStatus( |
| 210 EnrollmentStatus::STATUS_REGISTRATION_BAD_MODE)); | 205 EnrollmentStatus::STATUS_REGISTRATION_BAD_MODE)); |
| 211 return; | 206 return; |
| 212 } | 207 } |
| 213 client_->FetchPolicy(); | 208 client_->FetchPolicy(); |
| 214 } else { | 209 } else { |
| 215 LOG(FATAL) << "Registration state changed to " << client_->is_registered() | 210 LOG(FATAL) << "Registration state changed to " << client_->is_registered() |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 callback.Run(status); | 519 callback.Run(status); |
| 525 } | 520 } |
| 526 | 521 |
| 527 void EnrollmentHandlerChromeOS::SetStep(EnrollmentStep step) { | 522 void EnrollmentHandlerChromeOS::SetStep(EnrollmentStep step) { |
| 528 DCHECK_LE(enrollment_step_, step); | 523 DCHECK_LE(enrollment_step_, step); |
| 529 VLOG(1) << "Step: " << step; | 524 VLOG(1) << "Step: " << step; |
| 530 enrollment_step_ = step; | 525 enrollment_step_ = step; |
| 531 } | 526 } |
| 532 | 527 |
| 533 } // namespace policy | 528 } // namespace policy |
| OLD | NEW |