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

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

Issue 652743003: Fix update and enrollment flow (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: indent Created 6 years, 2 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/chromeos/login/wizard_controller.h" 8 #include "chrome/browser/chromeos/login/wizard_controller.h"
9 #include "components/pairing/host_pairing_controller.h" 9 #include "components/pairing/host_pairing_controller.h"
10 10
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 actor_->Hide(); 54 actor_->Hide();
55 } 55 }
56 56
57 std::string HostPairingScreen::GetName() const { 57 std::string HostPairingScreen::GetName() const {
58 return WizardController::kHostPairingScreenName; 58 return WizardController::kHostPairingScreenName;
59 } 59 }
60 60
61 void HostPairingScreen::PairingStageChanged(Stage new_stage) { 61 void HostPairingScreen::PairingStageChanged(Stage new_stage) {
62 std::string desired_page; 62 std::string desired_page;
63 switch (new_stage) { 63 switch (new_stage) {
64 case HostPairingController::STAGE_NONE:
65 case HostPairingController::STAGE_INITIALIZATION_ERROR: {
66 break;
67 }
68 case HostPairingController::STAGE_WAITING_FOR_CONTROLLER: 64 case HostPairingController::STAGE_WAITING_FOR_CONTROLLER:
69 case HostPairingController::STAGE_WAITING_FOR_CONTROLLER_AFTER_UPDATE: { 65 case HostPairingController::STAGE_WAITING_FOR_CONTROLLER_AFTER_UPDATE: {
70 desired_page = kPageWelcome; 66 desired_page = kPageWelcome;
71 break; 67 break;
72 } 68 }
73 case HostPairingController::STAGE_WAITING_FOR_CODE_CONFIRMATION: { 69 case HostPairingController::STAGE_WAITING_FOR_CODE_CONFIRMATION: {
74 desired_page = kPageCodeConfirmation; 70 desired_page = kPageCodeConfirmation;
75 context_.SetString(kContextKeyConfirmationCode, 71 context_.SetString(kContextKeyConfirmationCode,
76 controller_->GetConfirmationCode()); 72 controller_->GetConfirmationCode());
77 break; 73 break;
78 } 74 }
79 case HostPairingController::STAGE_UPDATING: {
80 desired_page = kPageUpdate;
81 context_.SetDouble(kContextKeyUpdateProgress, 0.0);
82 break;
83 }
84 case HostPairingController::STAGE_WAITING_FOR_CREDENTIALS: {
85 controller_->RemoveObserver(this);
86 get_screen_observer()->OnExit(
87 WizardController::HOST_PAIRING_FINISHED);
88 // TODO(achuith, zork): Remove the rest of the stages.
89 break;
90 }
91 case HostPairingController::STAGE_ENROLLING: {
92 desired_page = kPageEnrollment;
93 context_.SetString(kContextKeyEnrollmentDomain,
94 controller_->GetEnrollmentDomain());
95 break;
96 }
97 case HostPairingController::STAGE_ENROLLMENT_ERROR: {
98 desired_page = kPageEnrollmentError;
99 break;
100 }
101 case HostPairingController::STAGE_PAIRING_DONE: { 75 case HostPairingController::STAGE_PAIRING_DONE: {
102 desired_page = kPagePairingDone; 76 desired_page = kPagePairingDone;
103 break; 77 break;
104 } 78 }
105 case HostPairingController::STAGE_FINISHED: { 79 case HostPairingController::STAGE_UPDATING: {
106 // This page is closed in EnrollHost. 80 controller_->RemoveObserver(this);
81 get_screen_observer()->OnExit(WizardController::HOST_PAIRING_FINISHED);
107 break; 82 break;
108 } 83 }
84 default:
85 break;
109 } 86 }
110 current_stage_ = new_stage; 87 current_stage_ = new_stage;
111 context_.SetString(kContextKeyDeviceName, controller_->GetDeviceName()); 88 context_.SetString(kContextKeyDeviceName, controller_->GetDeviceName());
112 context_.SetString(kContextKeyPage, desired_page); 89 context_.SetString(kContextKeyPage, desired_page);
113 CommitContextChanges(); 90 CommitContextChanges();
114 } 91 }
115 92
116 void HostPairingScreen::ConfigureHost(bool accepted_eula, 93 void HostPairingScreen::ConfigureHost(bool accepted_eula,
117 const std::string& lang, 94 const std::string& lang,
118 const std::string& timezone, 95 const std::string& timezone,
119 bool send_reports, 96 bool send_reports,
120 const std::string& keyboard_layout) { 97 const std::string& keyboard_layout) {
121 // TODO(zork): Get configuration from UI and send to Host. 98 // TODO(zork): Get configuration from UI and send to Host.
122 // (http://crbug.com/405744) 99 // (http://crbug.com/405744)
123 } 100 }
124 101
125 void HostPairingScreen::EnrollHost(const std::string& auth_token) { 102 void HostPairingScreen::EnrollHost(const std::string& auth_token) {
126 NOTREACHED(); 103 NOTREACHED();
127 } 104 }
128 105
129 void HostPairingScreen::OnActorDestroyed(HostPairingScreenActor* actor) { 106 void HostPairingScreen::OnActorDestroyed(HostPairingScreenActor* actor) {
130 if (actor_ == actor) 107 if (actor_ == actor)
131 actor_ = NULL; 108 actor_ = NULL;
132 } 109 }
133 110
134 } // namespace chromeos 111 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698