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

Side by Side Diff: chrome/browser/chromeos/login/existing_user_controller.cc

Issue 8773046: [cros] Display emails of users are stored in a separate dictionary in Local State. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fixes. Created 9 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/existing_user_controller.h" 5 #include "chrome/browser/chromeos/login/existing_user_controller.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 166
167 string16 ExistingUserController::GetConnectedNetworkName() { 167 string16 ExistingUserController::GetConnectedNetworkName() {
168 return GetCurrentNetworkName(CrosLibrary::Get()->GetNetworkLibrary()); 168 return GetCurrentNetworkName(CrosLibrary::Get()->GetNetworkLibrary());
169 } 169 }
170 170
171 void ExistingUserController::FixCaptivePortal() { 171 void ExistingUserController::FixCaptivePortal() {
172 guest_mode_url_ = GURL(kCaptivePortalLaunchURL); 172 guest_mode_url_ = GURL(kCaptivePortalLaunchURL);
173 LoginAsGuest(); 173 LoginAsGuest();
174 } 174 }
175 175
176 void ExistingUserController::SetDisplayEmail(const std::string& email) {
177 next_login_display_email_ = email;
178 }
179
176 void ExistingUserController::CompleteLogin(const std::string& username, 180 void ExistingUserController::CompleteLogin(const std::string& username,
177 const std::string& password) { 181 const std::string& password) {
178 SetOwnerUserInCryptohome(); 182 SetOwnerUserInCryptohome();
179 183
180 GaiaAuthConsumer::ClientLoginResult credentials; 184 GaiaAuthConsumer::ClientLoginResult credentials;
181 if (!login_performer_.get()) { 185 if (!login_performer_.get()) {
182 LoginPerformer::Delegate* delegate = this; 186 LoginPerformer::Delegate* delegate = this;
183 if (login_performer_delegate_.get()) 187 if (login_performer_delegate_.get())
184 delegate = login_performer_delegate_.get(); 188 delegate = login_performer_delegate_.get();
185 // Only one instance of LoginPerformer should exist at a time. 189 // Only one instance of LoginPerformer should exist at a time.
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING, error); 359 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING, error);
356 } 360 }
357 } 361 }
358 362
359 // Reenable clicking on other windows and status area. 363 // Reenable clicking on other windows and status area.
360 login_display_->SetUIEnabled(true); 364 login_display_->SetUIEnabled(true);
361 SetStatusAreaEnabled(true); 365 SetStatusAreaEnabled(true);
362 366
363 if (login_status_consumer_) 367 if (login_status_consumer_)
364 login_status_consumer_->OnLoginFailure(failure); 368 login_status_consumer_->OnLoginFailure(failure);
369
370 // Clear the recorded displayed email so it won't affect any future attempts.
371 next_login_display_email_.clear();
365 } 372 }
366 373
367 void ExistingUserController::OnLoginSuccess( 374 void ExistingUserController::OnLoginSuccess(
368 const std::string& username, 375 const std::string& username,
369 const std::string& password, 376 const std::string& password,
370 const GaiaAuthConsumer::ClientLoginResult& credentials, 377 const GaiaAuthConsumer::ClientLoginResult& credentials,
371 bool pending_requests, 378 bool pending_requests,
372 bool using_oauth) { 379 bool using_oauth) {
373 bool known_user = UserManager::Get()->IsKnownUser(username); 380 bool known_user = UserManager::Get()->IsKnownUser(username);
374 bool login_only = 381 bool login_only =
375 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 382 CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
376 switches::kLoginScreen) == WizardController::kLoginScreenName; 383 switches::kLoginScreen) == WizardController::kLoginScreenName;
377 ready_for_browser_launch_ = known_user || login_only; 384 ready_for_browser_launch_ = known_user || login_only;
378 385
379 two_factor_credentials_ = credentials.two_factor; 386 two_factor_credentials_ = credentials.two_factor;
380 387
381 bool has_cookies = 388 bool has_cookies =
382 login_performer_->auth_mode() == LoginPerformer::AUTH_MODE_EXTENSION; 389 login_performer_->auth_mode() == LoginPerformer::AUTH_MODE_EXTENSION;
383 390
384 // LoginPerformer instance will delete itself once online auth result is OK. 391 // LoginPerformer instance will delete itself once online auth result is OK.
385 // In case of failure it'll bring up ScreenLock and ask for 392 // In case of failure it'll bring up ScreenLock and ask for
386 // correct password/display error message. 393 // correct password/display error message.
387 // Even in case when following online,offline protocol and returning 394 // Even in case when following online,offline protocol and returning
388 // requests_pending = false, let LoginPerformer delete itself. 395 // requests_pending = false, let LoginPerformer delete itself.
389 login_performer_->set_delegate(NULL); 396 login_performer_->set_delegate(NULL);
390 ignore_result(login_performer_.release()); 397 ignore_result(login_performer_.release());
391 398
392 // Will call OnProfilePrepared() in the end. 399 // Will call OnProfilePrepared() in the end.
393 LoginUtils::Get()->PrepareProfile(username, 400 LoginUtils::Get()->PrepareProfile(username,
401 next_login_display_email_,
394 password, 402 password,
395 credentials, 403 credentials,
396 pending_requests, 404 pending_requests,
397 using_oauth, 405 using_oauth,
398 has_cookies, 406 has_cookies,
399 this); 407 this);
400 408
409 next_login_display_email_.clear();
401 410
402 // Notifiy LoginDisplay to allow it provide visual feedback to user. 411 // Notifiy LoginDisplay to allow it provide visual feedback to user.
403 login_display_->OnLoginSuccess(username); 412 login_display_->OnLoginSuccess(username);
404 } 413 }
405 414
406 void ExistingUserController::OnProfilePrepared(Profile* profile) { 415 void ExistingUserController::OnProfilePrepared(Profile* profile) {
407 // TODO(nkostylev): May add login UI implementation callback call. 416 // TODO(nkostylev): May add login UI implementation callback call.
408 if (!ready_for_browser_launch_) { 417 if (!ready_for_browser_launch_) {
409 // Add the appropriate first-login URL. 418 // Add the appropriate first-login URL.
410 PrefService* prefs = g_browser_process->local_state(); 419 PrefService* prefs = g_browser_process->local_state();
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 std::string owner; 618 std::string owner;
610 cros_settings_->GetString(kDeviceOwner, &owner); 619 cros_settings_->GetString(kDeviceOwner, &owner);
611 cryptohomed->AsyncSetOwnerUser(owner, NULL); 620 cryptohomed->AsyncSetOwnerUser(owner, NULL);
612 621
613 // Do not invoke AsyncDoAutomaticFreeDiskSpaceControl(NULL) here 622 // Do not invoke AsyncDoAutomaticFreeDiskSpaceControl(NULL) here
614 // so it does not delay the following mount. Cleanup will be 623 // so it does not delay the following mount. Cleanup will be
615 // started in Cryptohomed by timer. 624 // started in Cryptohomed by timer.
616 } 625 }
617 626
618 } // namespace chromeos 627 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698