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

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

Issue 324463003: ChromeOS login webui refactoring : Simplify login methods. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge with ToT Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 } 374 }
375 375
376 base::string16 ExistingUserController::GetConnectedNetworkName() { 376 base::string16 ExistingUserController::GetConnectedNetworkName() {
377 return network_state_helper_->GetCurrentNetworkName(); 377 return network_state_helper_->GetCurrentNetworkName();
378 } 378 }
379 379
380 bool ExistingUserController::IsSigninInProgress() const { 380 bool ExistingUserController::IsSigninInProgress() const {
381 return is_login_in_progress_; 381 return is_login_in_progress_;
382 } 382 }
383 383
384 void ExistingUserController::Login(const UserContext& user_context) { 384 void ExistingUserController::Login(const UserContext& user_context,
385 const SigninSpecifics& specifics) {
386 if (user_context.GetUserType() == User::USER_TYPE_GUEST) {
387 if (!specifics.guest_mode_url.empty()) {
388 guest_mode_url_ = GURL(specifics.guest_mode_url);
389 if (specifics.guest_mode_url_append_locale)
390 guest_mode_url_ = google_util::AppendGoogleLocaleParam(
391 guest_mode_url_, g_browser_process->GetApplicationLocale());
392 }
393 LoginAsGuest();
394 return;
395 } else if (user_context.GetUserType() == User::USER_TYPE_PUBLIC_ACCOUNT) {
396 LoginAsPublicAccount(user_context.GetUserID());
397 return;
398 } else if (user_context.GetUserType() == User::USER_TYPE_RETAIL_MODE) {
399 LoginAsRetailModeUser();
400 return;
401 } else if (user_context.GetUserType() == User::USER_TYPE_KIOSK_APP) {
402 LoginAsKioskApp(user_context.GetUserID(), specifics.kiosk_diagnostic_mode);
403 return;
404 }
405
385 if (!user_context.HasCredentials()) 406 if (!user_context.HasCredentials())
386 return; 407 return;
387 408
388 // Stop the auto-login timer when attempting login. 409 // Stop the auto-login timer when attempting login.
389 StopPublicSessionAutoLoginTimer(); 410 StopPublicSessionAutoLoginTimer();
390 411
391 // Disable clicking on other windows. 412 // Disable clicking on other windows.
392 login_display_->SetUIEnabled(false); 413 login_display_->SetUIEnabled(false);
393 414
394 if (last_login_attempt_username_ != user_context.GetUserID()) { 415 if (last_login_attempt_username_ != user_context.GetUserID()) {
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 void ExistingUserController::LoginAsKioskApp(const std::string& app_id, 586 void ExistingUserController::LoginAsKioskApp(const std::string& app_id,
566 bool diagnostic_mode) { 587 bool diagnostic_mode) {
567 host_->StartAppLaunch(app_id, diagnostic_mode); 588 host_->StartAppLaunch(app_id, diagnostic_mode);
568 } 589 }
569 590
570 void ExistingUserController::OnSigninScreenReady() { 591 void ExistingUserController::OnSigninScreenReady() {
571 signin_screen_ready_ = true; 592 signin_screen_ready_ = true;
572 StartPublicSessionAutoLoginTimer(); 593 StartPublicSessionAutoLoginTimer();
573 } 594 }
574 595
575 void ExistingUserController::OnUserSelected(const std::string& username) {
576 login_performer_.reset(NULL);
577 num_login_attempts_ = 0;
578 }
579
580 void ExistingUserController::OnStartEnterpriseEnrollment() { 596 void ExistingUserController::OnStartEnterpriseEnrollment() {
581 if (KioskAppManager::Get()->IsConsumerKioskDeviceWithAutoLaunch()) { 597 if (KioskAppManager::Get()->IsConsumerKioskDeviceWithAutoLaunch()) {
582 LOG(WARNING) << "Enterprise enrollment is not available after kiosk auto " 598 LOG(WARNING) << "Enterprise enrollment is not available after kiosk auto "
583 "launch is set."; 599 "launch is set.";
584 return; 600 return;
585 } 601 }
586 602
587 DeviceSettingsService::Get()->GetOwnershipStatusAsync( 603 DeviceSettingsService::Get()->GetOwnershipStatusAsync(
588 base::Bind(&ExistingUserController::OnEnrollmentOwnershipCheckCompleted, 604 base::Bind(&ExistingUserController::OnEnrollmentOwnershipCheckCompleted,
589 weak_factory_.GetWeakPtr())); 605 weak_factory_.GetWeakPtr()));
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
1117 } 1133 }
1118 1134
1119 void ExistingUserController::SendAccessibilityAlert( 1135 void ExistingUserController::SendAccessibilityAlert(
1120 const std::string& alert_text) { 1136 const std::string& alert_text) {
1121 AccessibilityAlertInfo event(ProfileHelper::GetSigninProfile(), alert_text); 1137 AccessibilityAlertInfo event(ProfileHelper::GetSigninProfile(), alert_text);
1122 SendControlAccessibilityNotification( 1138 SendControlAccessibilityNotification(
1123 ui::AX_EVENT_VALUE_CHANGED, &event); 1139 ui::AX_EVENT_VALUE_CHANGED, &event);
1124 } 1140 }
1125 1141
1126 } // namespace chromeos 1142 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698