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

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

Issue 547503002: Redirect to the enterprise enrollment screen during remora and shark pairing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review fix. Created 6 years, 3 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/controller_pairing_screen.h" 5 #include "chrome/browser/chromeos/login/screens/controller_pairing_screen.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/chromeos/login/wizard_controller.h" 9 #include "chrome/browser/chromeos/login/wizard_controller.h"
10 #include "google_apis/gaia/gaia_auth_util.h" 10 #include "google_apis/gaia/gaia_auth_util.h"
11 11
12 using namespace chromeos::controller_pairing; 12 using namespace chromeos::controller_pairing;
13 using namespace pairing_chromeos; 13 using namespace pairing_chromeos;
14 14
15 namespace {
16 const char* kTestAuthToken = "TestAuthToken";
17 };
18
19 namespace chromeos { 15 namespace chromeos {
20 16
21 ControllerPairingScreen::ControllerPairingScreen( 17 ControllerPairingScreen::ControllerPairingScreen(
22 ScreenObserver* observer, 18 ScreenObserver* observer,
23 ControllerPairingScreenActor* actor, 19 ControllerPairingScreenActor* actor,
24 ControllerPairingController* controller) 20 ControllerPairingController* controller)
25 : WizardScreen(observer), 21 : WizardScreen(observer),
26 actor_(actor), 22 actor_(actor),
27 controller_(controller), 23 controller_(controller),
28 current_stage_(ControllerPairingController::STAGE_NONE), 24 current_stage_(ControllerPairingController::STAGE_NONE),
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 break; 100 break;
105 } 101 }
106 case ControllerPairingController::STAGE_HOST_UPDATE_IN_PROGRESS: { 102 case ControllerPairingController::STAGE_HOST_UPDATE_IN_PROGRESS: {
107 desired_page = kPageHostUpdate; 103 desired_page = kPageHostUpdate;
108 break; 104 break;
109 } 105 }
110 case ControllerPairingController::STAGE_HOST_CONNECTION_LOST: { 106 case ControllerPairingController::STAGE_HOST_CONNECTION_LOST: {
111 desired_page = kPageHostConnectionLost; 107 desired_page = kPageHostConnectionLost;
112 break; 108 break;
113 } 109 }
114 case ControllerPairingController::STAGE_WAITING_FOR_CREDENTIALS: { 110 case ControllerPairingController::STAGE_WAITING_FOR_CREDENTIALS: {
dzhioev (left Google) 2014/09/09 01:35:41 You need to remove |this| from |controller_|'s obs
Zachary Kuznia 2014/09/09 02:17:51 Done.
111 get_screen_observer()->OnExit(
112 WizardController::CONTROLLER_PAIRING_FINISHED);
113 // TODO: Move the rest of the stages to the proper location.
115 desired_page = kPageEnrollmentIntroduction; 114 desired_page = kPageEnrollmentIntroduction;
116 break; 115 break;
117 } 116 }
118 case ControllerPairingController::STAGE_HOST_ENROLLMENT_IN_PROGRESS: { 117 case ControllerPairingController::STAGE_HOST_ENROLLMENT_IN_PROGRESS: {
119 desired_page = kPageHostEnrollment; 118 desired_page = kPageHostEnrollment;
120 break; 119 break;
121 } 120 }
122 case ControllerPairingController::STAGE_HOST_ENROLLMENT_ERROR: { 121 case ControllerPairingController::STAGE_HOST_ENROLLMENT_ERROR: {
123 desired_page = kPageHostEnrollmentError; 122 desired_page = kPageHostEnrollmentError;
124 break; 123 break;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 } else if (action == kActionRejectCode) { 192 } else if (action == kActionRejectCode) {
194 controller_->SetConfirmationCodeIsCorrect(false); 193 controller_->SetConfirmationCodeIsCorrect(false);
195 } else if (action == kActionProceedToAuthentication) { 194 } else if (action == kActionProceedToAuthentication) {
196 context_.SetString(kContextKeyPage, kPageAuthentication); 195 context_.SetString(kContextKeyPage, kPageAuthentication);
197 disable_controls = false; 196 disable_controls = false;
198 } else if (action == kActionEnroll) { 197 } else if (action == kActionEnroll) {
199 const std::string account_id = 198 const std::string account_id =
200 gaia::SanitizeEmail(context_.GetString(kContextKeyAccountId)); 199 gaia::SanitizeEmail(context_.GetString(kContextKeyAccountId));
201 const std::string domain(gaia::ExtractDomainName(account_id)); 200 const std::string domain(gaia::ExtractDomainName(account_id));
202 context_.SetString(kContextKeyEnrollmentDomain, domain); 201 context_.SetString(kContextKeyEnrollmentDomain, domain);
203 // TODO(zork): Get proper credentials. (http://crbug.com/405744)
204 controller_->OnAuthenticationDone(domain, kTestAuthToken);
205 } else if (action == kActionStartSession) { 202 } else if (action == kActionStartSession) {
206 controller_->StartSession(); 203 controller_->StartSession();
207 } 204 }
208 context_.SetBoolean(kContextKeyControlsDisabled, disable_controls); 205 context_.SetBoolean(kContextKeyControlsDisabled, disable_controls);
209 CommitContextChanges(); 206 CommitContextChanges();
210 } 207 }
211 208
212 void ControllerPairingScreen::OnScreenContextChanged( 209 void ControllerPairingScreen::OnScreenContextChanged(
213 const base::DictionaryValue& diff) { 210 const base::DictionaryValue& diff) {
214 std::vector<std::string> changedKeys; 211 std::vector<std::string> changedKeys;
215 context_.ApplyChanges(diff, &changedKeys); 212 context_.ApplyChanges(diff, &changedKeys);
216 for (std::vector<std::string>::const_iterator key = changedKeys.begin(); 213 for (std::vector<std::string>::const_iterator key = changedKeys.begin();
217 key != changedKeys.end(); 214 key != changedKeys.end();
218 ++key) { 215 ++key) {
219 if (*key == kContextKeySelectedDevice) { 216 if (*key == kContextKeySelectedDevice) {
220 context_.SetBoolean(kContextKeyControlsDisabled, 217 context_.SetBoolean(kContextKeyControlsDisabled,
221 context_.GetString(*key).empty()); 218 context_.GetString(*key).empty());
222 CommitContextChanges(); 219 CommitContextChanges();
223 } 220 }
224 } 221 }
225 } 222 }
226 223
227 } // namespace chromeos 224 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698