| OLD | NEW |
| 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" |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
| 16 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
| 17 #include "base/prefs/pref_service.h" | 17 #include "base/prefs/pref_service.h" |
| 18 #include "base/strings/string_util.h" | 18 #include "base/strings/string_util.h" |
| 19 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
| 20 #include "base/values.h" | 20 #include "base/values.h" |
| 21 #include "base/version.h" | 21 #include "base/version.h" |
| 22 #include "chrome/browser/accessibility/accessibility_events.h" | 22 #include "chrome/browser/accessibility/accessibility_events.h" |
| 23 #include "chrome/browser/browser_process.h" | 23 #include "chrome/browser/browser_process.h" |
| 24 #include "chrome/browser/browser_process_platform_part.h" | 24 #include "chrome/browser/browser_process_platform_part.h" |
| 25 #include "chrome/browser/chrome_notification_types.h" | 25 #include "chrome/browser/chrome_notification_types.h" |
| 26 #include "chrome/browser/chromeos/boot_times_loader.h" | 26 #include "chrome/browser/chromeos/boot_times_loader.h" |
| 27 #include "chrome/browser/chromeos/customization/customization_document.h" | 27 #include "chrome/browser/chromeos/customization/customization_document.h" |
| 28 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" | |
| 29 #include "chrome/browser/chromeos/login/auth/chrome_login_performer.h" | 28 #include "chrome/browser/chromeos/login/auth/chrome_login_performer.h" |
| 30 #include "chrome/browser/chromeos/login/helper.h" | 29 #include "chrome/browser/chromeos/login/helper.h" |
| 31 #include "chrome/browser/chromeos/login/login_utils.h" | 30 #include "chrome/browser/chromeos/login/login_utils.h" |
| 32 #include "chrome/browser/chromeos/login/session/user_session_manager.h" | 31 #include "chrome/browser/chromeos/login/session/user_session_manager.h" |
| 33 #include "chrome/browser/chromeos/login/signin_specifics.h" | 32 #include "chrome/browser/chromeos/login/signin_specifics.h" |
| 34 #include "chrome/browser/chromeos/login/startup_utils.h" | 33 #include "chrome/browser/chromeos/login/startup_utils.h" |
| 35 #include "chrome/browser/chromeos/login/ui/login_display_host.h" | 34 #include "chrome/browser/chromeos/login/ui/login_display_host.h" |
| 36 #include "chrome/browser/chromeos/login/user_flow.h" | 35 #include "chrome/browser/chromeos/login/user_flow.h" |
| 37 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" | 36 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" |
| 38 #include "chrome/browser/chromeos/login/wizard_controller.h" | 37 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 } | 428 } |
| 430 LoginAsGuest(); | 429 LoginAsGuest(); |
| 431 return; | 430 return; |
| 432 } | 431 } |
| 433 | 432 |
| 434 if (user_context.GetUserType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT) { | 433 if (user_context.GetUserType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT) { |
| 435 LoginAsPublicSession(user_context); | 434 LoginAsPublicSession(user_context); |
| 436 return; | 435 return; |
| 437 } | 436 } |
| 438 | 437 |
| 439 if (user_context.GetUserType() == user_manager::USER_TYPE_RETAIL_MODE) { | |
| 440 LoginAsRetailModeUser(); | |
| 441 return; | |
| 442 } | |
| 443 | |
| 444 if (user_context.GetUserType() == user_manager::USER_TYPE_KIOSK_APP) { | 438 if (user_context.GetUserType() == user_manager::USER_TYPE_KIOSK_APP) { |
| 445 LoginAsKioskApp(user_context.GetUserID(), specifics.kiosk_diagnostic_mode); | 439 LoginAsKioskApp(user_context.GetUserID(), specifics.kiosk_diagnostic_mode); |
| 446 return; | 440 return; |
| 447 } | 441 } |
| 448 | 442 |
| 449 // Regular user or supervised user login. | 443 // Regular user or supervised user login. |
| 450 | 444 |
| 451 if (!user_context.HasCredentials()) { | 445 if (!user_context.HasCredentials()) { |
| 452 // If credentials are missing, refuse to log in. | 446 // If credentials are missing, refuse to log in. |
| 453 | 447 |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 826 return auth_mode_; | 820 return auth_mode_; |
| 827 } | 821 } |
| 828 | 822 |
| 829 bool ExistingUserController::password_changed() const { | 823 bool ExistingUserController::password_changed() const { |
| 830 if (login_performer_) | 824 if (login_performer_) |
| 831 return login_performer_->password_changed(); | 825 return login_performer_->password_changed(); |
| 832 | 826 |
| 833 return password_changed_; | 827 return password_changed_; |
| 834 } | 828 } |
| 835 | 829 |
| 836 void ExistingUserController::LoginAsRetailModeUser() { | |
| 837 PerformPreLoginActions(UserContext(user_manager::USER_TYPE_RETAIL_MODE, | |
| 838 chromeos::login::kRetailModeUserName)); | |
| 839 | |
| 840 // TODO(rkc): Add a CHECK to make sure retail mode logins are allowed once | |
| 841 // the enterprise policy wiring is done for retail mode. | |
| 842 | |
| 843 // Only one instance of LoginPerformer should exist at a time. | |
| 844 login_performer_.reset(NULL); | |
| 845 login_performer_.reset(new ChromeLoginPerformer(this)); | |
| 846 login_performer_->LoginRetailMode(); | |
| 847 SendAccessibilityAlert( | |
| 848 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_LOGIN_SIGNIN_DEMOUSER)); | |
| 849 } | |
| 850 | |
| 851 void ExistingUserController::LoginAsGuest() { | 830 void ExistingUserController::LoginAsGuest() { |
| 852 PerformPreLoginActions(UserContext(user_manager::USER_TYPE_GUEST, | 831 PerformPreLoginActions(UserContext(user_manager::USER_TYPE_GUEST, |
| 853 chromeos::login::kGuestUserName)); | 832 chromeos::login::kGuestUserName)); |
| 854 | 833 |
| 855 bool allow_guest; | 834 bool allow_guest; |
| 856 cros_settings_->GetBoolean(kAccountsPrefAllowGuest, &allow_guest); | 835 cros_settings_->GetBoolean(kAccountsPrefAllowGuest, &allow_guest); |
| 857 if (!allow_guest) { | 836 if (!allow_guest) { |
| 858 // Disallowed. The UI should normally not show the guest pod but if for some | 837 // Disallowed. The UI should normally not show the guest pod but if for some |
| 859 // reason this has been made available to the user here is the time to tell | 838 // reason this has been made available to the user here is the time to tell |
| 860 // this nicely. | 839 // this nicely. |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1144 is_login_in_progress_ = false; | 1123 is_login_in_progress_ = false; |
| 1145 | 1124 |
| 1146 // Reenable clicking on other windows and status area. | 1125 // Reenable clicking on other windows and status area. |
| 1147 login_display_->SetUIEnabled(true); | 1126 login_display_->SetUIEnabled(true); |
| 1148 | 1127 |
| 1149 if (start_public_session_timer) | 1128 if (start_public_session_timer) |
| 1150 StartPublicSessionAutoLoginTimer(); | 1129 StartPublicSessionAutoLoginTimer(); |
| 1151 } | 1130 } |
| 1152 | 1131 |
| 1153 } // namespace chromeos | 1132 } // namespace chromeos |
| OLD | NEW |