Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1045)

Side by Side Diff: chrome/browser/chromeos/login/screens/host_pairing_screen.cc

Issue 2700303002: cros: Unify oobe View/Actor naming to just View. (Closed)
Patch Set: Rebase Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 HostPairingScreenView* view,
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 view_(view),
28 remora_controller_(remora_controller), 28 remora_controller_(remora_controller),
29 weak_ptr_factory_(this) { 29 weak_ptr_factory_(this) {
30 actor_->SetDelegate(this); 30 view_->SetDelegate(this);
31 remora_controller_->AddObserver(this); 31 remora_controller_->AddObserver(this);
32 } 32 }
33 33
34 HostPairingScreen::~HostPairingScreen() { 34 HostPairingScreen::~HostPairingScreen() {
35 if (actor_) 35 if (view_)
36 actor_->SetDelegate(NULL); 36 view_->SetDelegate(NULL);
37 remora_controller_->RemoveObserver(this); 37 remora_controller_->RemoveObserver(this);
38 } 38 }
39 39
40 void HostPairingScreen::CommitContextChanges() { 40 void HostPairingScreen::CommitContextChanges() {
41 if (!context_.HasChanges()) 41 if (!context_.HasChanges())
42 return; 42 return;
43 base::DictionaryValue diff; 43 base::DictionaryValue diff;
44 context_.GetChangesAndReset(&diff); 44 context_.GetChangesAndReset(&diff);
45 if (actor_) 45 if (view_)
46 actor_->OnContextChanged(diff); 46 view_->OnContextChanged(diff);
47 } 47 }
48 48
49 void HostPairingScreen::Show() { 49 void HostPairingScreen::Show() {
50 if (actor_) 50 if (view_)
51 actor_->Show(); 51 view_->Show();
52 PairingStageChanged(remora_controller_->GetCurrentStage()); 52 PairingStageChanged(remora_controller_->GetCurrentStage());
53 } 53 }
54 54
55 void HostPairingScreen::Hide() { 55 void HostPairingScreen::Hide() {
56 if (actor_) 56 if (view_)
57 actor_->Hide(); 57 view_->Hide();
58 } 58 }
59 59
60 void HostPairingScreen::PairingStageChanged(Stage new_stage) { 60 void HostPairingScreen::PairingStageChanged(Stage new_stage) {
61 std::string desired_page; 61 std::string desired_page;
62 switch (new_stage) { 62 switch (new_stage) {
63 case HostPairingController::STAGE_INITIALIZATION_ERROR: { 63 case HostPairingController::STAGE_INITIALIZATION_ERROR: {
64 desired_page = kPageIntializationError; 64 desired_page = kPageIntializationError;
65 break; 65 break;
66 } 66 }
67 case HostPairingController::STAGE_WAITING_FOR_CONTROLLER: 67 case HostPairingController::STAGE_WAITING_FOR_CONTROLLER:
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 g_browser_process->platform_part() 144 g_browser_process->platform_part()
145 ->browser_policy_connector_chromeos() 145 ->browser_policy_connector_chromeos()
146 ->GetPrescribedEnrollmentConfig(); 146 ->GetPrescribedEnrollmentConfig();
147 enrollment_helper_ = EnterpriseEnrollmentHelper::Create( 147 enrollment_helper_ = EnterpriseEnrollmentHelper::Create(
148 this, nullptr, enrollment_config, std::string()); 148 this, nullptr, enrollment_config, std::string());
149 enrollment_helper_->EnrollUsingToken(auth_token); 149 enrollment_helper_->EnrollUsingToken(auth_token);
150 remora_controller_->OnEnrollmentStatusChanged( 150 remora_controller_->OnEnrollmentStatusChanged(
151 HostPairingController::ENROLLMENT_STATUS_ENROLLING); 151 HostPairingController::ENROLLMENT_STATUS_ENROLLING);
152 } 152 }
153 153
154 void HostPairingScreen::OnActorDestroyed(HostPairingScreenActor* actor) { 154 void HostPairingScreen::OnViewDestroyed(HostPairingScreenView* view) {
155 if (actor_ == actor) 155 if (view_ == view)
156 actor_ = NULL; 156 view_ = NULL;
157 } 157 }
158 158
159 void HostPairingScreen::OnAuthError(const GoogleServiceAuthError& error) { 159 void HostPairingScreen::OnAuthError(const GoogleServiceAuthError& error) {
160 OnAnyEnrollmentError(); 160 OnAnyEnrollmentError();
161 } 161 }
162 162
163 void HostPairingScreen::OnEnrollmentError(policy::EnrollmentStatus status) { 163 void HostPairingScreen::OnEnrollmentError(policy::EnrollmentStatus status) {
164 OnAnyEnrollmentError(); 164 OnAnyEnrollmentError();
165 } 165 }
166 166
(...skipping 26 matching lines...) Expand all
193 } 193 }
194 194
195 void HostPairingScreen::OnAnyEnrollmentError() { 195 void HostPairingScreen::OnAnyEnrollmentError() {
196 enrollment_helper_->ClearAuth(base::Bind(&HostPairingScreen::OnAuthCleared, 196 enrollment_helper_->ClearAuth(base::Bind(&HostPairingScreen::OnAuthCleared,
197 weak_ptr_factory_.GetWeakPtr())); 197 weak_ptr_factory_.GetWeakPtr()));
198 remora_controller_->OnEnrollmentStatusChanged( 198 remora_controller_->OnEnrollmentStatusChanged(
199 HostPairingController::ENROLLMENT_STATUS_FAILURE); 199 HostPairingController::ENROLLMENT_STATUS_FAILURE);
200 } 200 }
201 201
202 } // namespace chromeos 202 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698