| 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), | 25 : BaseScreen(base_screen_delegate, |
| 26 WizardController::kHostPairingScreenName), |
| 26 delegate_(delegate), | 27 delegate_(delegate), |
| 27 actor_(actor), | 28 actor_(actor), |
| 28 remora_controller_(remora_controller), | 29 remora_controller_(remora_controller), |
| 29 current_stage_(HostPairingController::STAGE_NONE), | 30 current_stage_(HostPairingController::STAGE_NONE), |
| 30 weak_ptr_factory_(this) { | 31 weak_ptr_factory_(this) { |
| 31 actor_->SetDelegate(this); | 32 actor_->SetDelegate(this); |
| 32 remora_controller_->AddObserver(this); | 33 remora_controller_->AddObserver(this); |
| 33 } | 34 } |
| 34 | 35 |
| 35 HostPairingScreen::~HostPairingScreen() { | 36 HostPairingScreen::~HostPairingScreen() { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 51 if (actor_) | 52 if (actor_) |
| 52 actor_->Show(); | 53 actor_->Show(); |
| 53 PairingStageChanged(remora_controller_->GetCurrentStage()); | 54 PairingStageChanged(remora_controller_->GetCurrentStage()); |
| 54 } | 55 } |
| 55 | 56 |
| 56 void HostPairingScreen::Hide() { | 57 void HostPairingScreen::Hide() { |
| 57 if (actor_) | 58 if (actor_) |
| 58 actor_->Hide(); | 59 actor_->Hide(); |
| 59 } | 60 } |
| 60 | 61 |
| 61 std::string HostPairingScreen::GetName() const { | |
| 62 return WizardController::kHostPairingScreenName; | |
| 63 } | |
| 64 | |
| 65 void HostPairingScreen::PairingStageChanged(Stage new_stage) { | 62 void HostPairingScreen::PairingStageChanged(Stage new_stage) { |
| 66 std::string desired_page; | 63 std::string desired_page; |
| 67 switch (new_stage) { | 64 switch (new_stage) { |
| 68 case HostPairingController::STAGE_INITIALIZATION_ERROR: { | 65 case HostPairingController::STAGE_INITIALIZATION_ERROR: { |
| 69 desired_page = kPageIntializationError; | 66 desired_page = kPageIntializationError; |
| 70 break; | 67 break; |
| 71 } | 68 } |
| 72 case HostPairingController::STAGE_WAITING_FOR_CONTROLLER: | 69 case HostPairingController::STAGE_WAITING_FOR_CONTROLLER: |
| 73 case HostPairingController::STAGE_WAITING_FOR_CONTROLLER_AFTER_UPDATE: { | 70 case HostPairingController::STAGE_WAITING_FOR_CONTROLLER_AFTER_UPDATE: { |
| 74 desired_page = kPageWelcome; | 71 desired_page = kPageWelcome; |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 } | 195 } |
| 199 | 196 |
| 200 void HostPairingScreen::OnAnyEnrollmentError() { | 197 void HostPairingScreen::OnAnyEnrollmentError() { |
| 201 enrollment_helper_->ClearAuth(base::Bind(&HostPairingScreen::OnAuthCleared, | 198 enrollment_helper_->ClearAuth(base::Bind(&HostPairingScreen::OnAuthCleared, |
| 202 weak_ptr_factory_.GetWeakPtr())); | 199 weak_ptr_factory_.GetWeakPtr())); |
| 203 remora_controller_->OnEnrollmentStatusChanged( | 200 remora_controller_->OnEnrollmentStatusChanged( |
| 204 HostPairingController::ENROLLMENT_STATUS_FAILURE); | 201 HostPairingController::ENROLLMENT_STATUS_FAILURE); |
| 205 } | 202 } |
| 206 | 203 |
| 207 } // namespace chromeos | 204 } // namespace chromeos |
| OLD | NEW |