Chromium Code Reviews| 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 "chrome/browser/chromeos/policy/fake_active_directory_join_delegate.h" | |
| 13 #include "components/pairing/host_pairing_controller.h" | 14 #include "components/pairing/host_pairing_controller.h" |
| 14 | 15 |
| 15 namespace chromeos { | 16 namespace chromeos { |
| 16 | 17 |
| 17 using namespace host_pairing; | 18 using namespace host_pairing; |
| 18 using namespace pairing_chromeos; | 19 using namespace pairing_chromeos; |
| 19 | 20 |
| 20 HostPairingScreen::HostPairingScreen( | 21 HostPairingScreen::HostPairingScreen( |
| 21 BaseScreenDelegate* base_screen_delegate, | 22 BaseScreenDelegate* base_screen_delegate, |
| 22 Delegate* delegate, | 23 Delegate* delegate, |
| 23 HostPairingScreenActor* actor, | 24 HostPairingScreenActor* actor, |
| 24 pairing_chromeos::HostPairingController* remora_controller) | 25 pairing_chromeos::HostPairingController* remora_controller) |
| 25 : BaseScreen(base_screen_delegate, OobeScreen::SCREEN_OOBE_HOST_PAIRING), | 26 : BaseScreen(base_screen_delegate, OobeScreen::SCREEN_OOBE_HOST_PAIRING), |
| 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 weak_ptr_factory_(this) { | 30 weak_ptr_factory_(this) { |
| 31 actor_->SetDelegate(this); | 31 actor_->SetDelegate(this); |
| 32 remora_controller_->AddObserver(this); | 32 remora_controller_->AddObserver(this); |
| 33 } | 33 } |
| 34 | 34 |
| 35 HostPairingScreen::~HostPairingScreen() { | 35 HostPairingScreen::~HostPairingScreen() { |
| 36 if (actor_) | 36 if (actor_) |
| 37 actor_->SetDelegate(NULL); | 37 actor_->SetDelegate(NULL); |
| 38 remora_controller_->RemoveObserver(this); | 38 remora_controller_->RemoveObserver(this); |
| 39 } | 39 } |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 138 void HostPairingScreen::AddNetworkRequested(const std::string& onc_spec) { | 138 void HostPairingScreen::AddNetworkRequested(const std::string& onc_spec) { |
| 139 if (delegate_) | 139 if (delegate_) |
| 140 delegate_->AddNetworkRequested(onc_spec); | 140 delegate_->AddNetworkRequested(onc_spec); |
| 141 } | 141 } |
| 142 | 142 |
| 143 void HostPairingScreen::EnrollHostRequested(const std::string& auth_token) { | 143 void HostPairingScreen::EnrollHostRequested(const std::string& auth_token) { |
| 144 policy::EnrollmentConfig enrollment_config = | 144 policy::EnrollmentConfig enrollment_config = |
| 145 g_browser_process->platform_part() | 145 g_browser_process->platform_part() |
| 146 ->browser_policy_connector_chromeos() | 146 ->browser_policy_connector_chromeos() |
| 147 ->GetPrescribedEnrollmentConfig(); | 147 ->GetPrescribedEnrollmentConfig(); |
| 148 fake_ad_join_delegate_ = base::MakeUnique<FakeActiveDirectoryJoinDelegate>(); | |
| 148 enrollment_helper_ = EnterpriseEnrollmentHelper::Create( | 149 enrollment_helper_ = EnterpriseEnrollmentHelper::Create( |
| 149 this, enrollment_config, std::string()); | 150 this, fake_ad_join_delegate_.get(), enrollment_config, std::string()); |
|
Thiemo Nagel
2017/02/14 16:43:06
Maybe I'm missing something, but couldn't you just
Roman Sorokin (ftl)
2017/02/15 14:01:44
Done.
| |
| 150 enrollment_helper_->EnrollUsingToken(auth_token); | 151 enrollment_helper_->EnrollUsingToken(auth_token); |
| 151 remora_controller_->OnEnrollmentStatusChanged( | 152 remora_controller_->OnEnrollmentStatusChanged( |
| 152 HostPairingController::ENROLLMENT_STATUS_ENROLLING); | 153 HostPairingController::ENROLLMENT_STATUS_ENROLLING); |
| 153 } | 154 } |
| 154 | 155 |
| 155 void HostPairingScreen::OnActorDestroyed(HostPairingScreenActor* actor) { | 156 void HostPairingScreen::OnActorDestroyed(HostPairingScreenActor* actor) { |
| 156 if (actor_ == actor) | 157 if (actor_ == actor) |
| 157 actor_ = NULL; | 158 actor_ = NULL; |
| 158 } | 159 } |
| 159 | 160 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 194 } | 195 } |
| 195 | 196 |
| 196 void HostPairingScreen::OnAnyEnrollmentError() { | 197 void HostPairingScreen::OnAnyEnrollmentError() { |
| 197 enrollment_helper_->ClearAuth(base::Bind(&HostPairingScreen::OnAuthCleared, | 198 enrollment_helper_->ClearAuth(base::Bind(&HostPairingScreen::OnAuthCleared, |
| 198 weak_ptr_factory_.GetWeakPtr())); | 199 weak_ptr_factory_.GetWeakPtr())); |
| 199 remora_controller_->OnEnrollmentStatusChanged( | 200 remora_controller_->OnEnrollmentStatusChanged( |
| 200 HostPairingController::ENROLLMENT_STATUS_FAILURE); | 201 HostPairingController::ENROLLMENT_STATUS_FAILURE); |
| 201 } | 202 } |
| 202 | 203 |
| 203 } // namespace chromeos | 204 } // namespace chromeos |
| OLD | NEW |