| 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/screens/host_pairing_screen.h" | 5 #include "chrome/browser/chromeos/login/screens/host_pairing_screen.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/chromeos/login/startup_utils.h" | 9 #include "chrome/browser/chromeos/login/startup_utils.h" |
| 10 #include "chrome/browser/chromeos/login/wizard_controller.h" | 10 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 11 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 11 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 12 #include "chrome/browser/chromeos/policy/enrollment_status_chromeos.h" | 12 #include "chrome/browser/chromeos/policy/enrollment_status_chromeos.h" |
| 13 #include "components/pairing/host_pairing_controller.h" | 13 #include "components/pairing/host_pairing_controller.h" |
| 14 | 14 |
| 15 namespace chromeos { | 15 namespace chromeos { |
| 16 | 16 |
| 17 using namespace host_pairing; | 17 using namespace host_pairing; |
| 18 using namespace pairing_chromeos; | 18 using namespace pairing_chromeos; |
| 19 | 19 |
| 20 HostPairingScreen::HostPairingScreen( | 20 HostPairingScreen::HostPairingScreen( |
| 21 BaseScreenDelegate* base_screen_delegate, | 21 BaseScreenDelegate* base_screen_delegate, |
| 22 Delegate* delegate, | 22 Delegate* delegate, |
| 23 HostPairingScreenActor* actor, | 23 HostPairingScreenActor* actor, |
| 24 pairing_chromeos::HostPairingController* remora_controller) | 24 pairing_chromeos::HostPairingController* remora_controller) |
| 25 : BaseScreen(base_screen_delegate, OobeScreen::SCREEN_OOBE_HOST_PAIRING), | 25 : BaseScreen(base_screen_delegate, OobeScreen::SCREEN_OOBE_HOST_PAIRING), |
| 26 delegate_(delegate), | 26 delegate_(delegate), |
| 27 actor_(actor), | 27 actor_(actor), |
| 28 remora_controller_(remora_controller), | 28 remora_controller_(remora_controller), |
| 29 current_stage_(HostPairingController::STAGE_NONE), | |
| 30 weak_ptr_factory_(this) { | 29 weak_ptr_factory_(this) { |
| 31 actor_->SetDelegate(this); | 30 actor_->SetDelegate(this); |
| 32 remora_controller_->AddObserver(this); | 31 remora_controller_->AddObserver(this); |
| 33 } | 32 } |
| 34 | 33 |
| 35 HostPairingScreen::~HostPairingScreen() { | 34 HostPairingScreen::~HostPairingScreen() { |
| 36 if (actor_) | 35 if (actor_) |
| 37 actor_->SetDelegate(NULL); | 36 actor_->SetDelegate(NULL); |
| 38 remora_controller_->RemoveObserver(this); | 37 remora_controller_->RemoveObserver(this); |
| 39 } | 38 } |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 if (delegate_) | 138 if (delegate_) |
| 140 delegate_->AddNetworkRequested(onc_spec); | 139 delegate_->AddNetworkRequested(onc_spec); |
| 141 } | 140 } |
| 142 | 141 |
| 143 void HostPairingScreen::EnrollHostRequested(const std::string& auth_token) { | 142 void HostPairingScreen::EnrollHostRequested(const std::string& auth_token) { |
| 144 policy::EnrollmentConfig enrollment_config = | 143 policy::EnrollmentConfig enrollment_config = |
| 145 g_browser_process->platform_part() | 144 g_browser_process->platform_part() |
| 146 ->browser_policy_connector_chromeos() | 145 ->browser_policy_connector_chromeos() |
| 147 ->GetPrescribedEnrollmentConfig(); | 146 ->GetPrescribedEnrollmentConfig(); |
| 148 enrollment_helper_ = EnterpriseEnrollmentHelper::Create( | 147 enrollment_helper_ = EnterpriseEnrollmentHelper::Create( |
| 149 this, enrollment_config, std::string()); | 148 this, nullptr, enrollment_config, std::string()); |
| 150 enrollment_helper_->EnrollUsingToken(auth_token); | 149 enrollment_helper_->EnrollUsingToken(auth_token); |
| 151 remora_controller_->OnEnrollmentStatusChanged( | 150 remora_controller_->OnEnrollmentStatusChanged( |
| 152 HostPairingController::ENROLLMENT_STATUS_ENROLLING); | 151 HostPairingController::ENROLLMENT_STATUS_ENROLLING); |
| 153 } | 152 } |
| 154 | 153 |
| 155 void HostPairingScreen::OnActorDestroyed(HostPairingScreenActor* actor) { | 154 void HostPairingScreen::OnActorDestroyed(HostPairingScreenActor* actor) { |
| 156 if (actor_ == actor) | 155 if (actor_ == actor) |
| 157 actor_ = NULL; | 156 actor_ = NULL; |
| 158 } | 157 } |
| 159 | 158 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 } | 193 } |
| 195 | 194 |
| 196 void HostPairingScreen::OnAnyEnrollmentError() { | 195 void HostPairingScreen::OnAnyEnrollmentError() { |
| 197 enrollment_helper_->ClearAuth(base::Bind(&HostPairingScreen::OnAuthCleared, | 196 enrollment_helper_->ClearAuth(base::Bind(&HostPairingScreen::OnAuthCleared, |
| 198 weak_ptr_factory_.GetWeakPtr())); | 197 weak_ptr_factory_.GetWeakPtr())); |
| 199 remora_controller_->OnEnrollmentStatusChanged( | 198 remora_controller_->OnEnrollmentStatusChanged( |
| 200 HostPairingController::ENROLLMENT_STATUS_FAILURE); | 199 HostPairingController::ENROLLMENT_STATUS_FAILURE); |
| 201 } | 200 } |
| 202 | 201 |
| 203 } // namespace chromeos | 202 } // namespace chromeos |
| OLD | NEW |