| 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_document.h" | 27 #include "chrome/browser/chromeos/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" |
| 39 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 38 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 40 #include "chrome/browser/chromeos/policy/device_local_account.h" | 39 #include "chrome/browser/chromeos/policy/device_local_account.h" |
| 41 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" | 40 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" |
| 42 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 41 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 43 #include "chrome/browser/chromeos/settings/cros_settings.h" | 42 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 44 #include "chrome/browser/chromeos/system/device_disabling_manager.h" | 43 #include "chrome/browser/chromeos/system/device_disabling_manager.h" |
| 45 #include "chrome/browser/signin/easy_unlock_service.h" | 44 #include "chrome/browser/signin/easy_unlock_service.h" |
| 46 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" | 45 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" |
| 47 #include "chrome/common/chrome_switches.h" | 46 #include "chrome/common/chrome_switches.h" |
| 48 #include "chrome/common/chrome_version_info.h" | 47 #include "chrome/common/chrome_version_info.h" |
| 49 #include "chrome/common/url_constants.h" | 48 #include "chrome/common/url_constants.h" |
| 50 #include "chrome/grit/generated_resources.h" | 49 #include "chrome/grit/generated_resources.h" |
| 51 #include "chromeos/chromeos_switches.h" | 50 #include "chromeos/chromeos_switches.h" |
| 52 #include "chromeos/dbus/dbus_thread_manager.h" | 51 #include "chromeos/dbus/dbus_thread_manager.h" |
| 53 #include "chromeos/dbus/power_manager_client.h" | 52 #include "chromeos/dbus/power_manager_client.h" |
| 54 #include "chromeos/dbus/session_manager_client.h" | 53 #include "chromeos/dbus/session_manager_client.h" |
| 55 #include "chromeos/login/user_names.h" | 54 #include "chromeos/login/user_names.h" |
| 56 #include "chromeos/settings/cros_settings_names.h" | |
| 57 #include "components/google/core/browser/google_util.h" | 55 #include "components/google/core/browser/google_util.h" |
| 58 #include "components/policy/core/common/cloud/cloud_policy_core.h" | 56 #include "components/policy/core/common/cloud/cloud_policy_core.h" |
| 59 #include "components/policy/core/common/cloud/cloud_policy_store.h" | 57 #include "components/policy/core/common/cloud/cloud_policy_store.h" |
| 60 #include "components/policy/core/common/policy_map.h" | 58 #include "components/policy/core/common/policy_map.h" |
| 61 #include "components/policy/core/common/policy_service.h" | 59 #include "components/policy/core/common/policy_service.h" |
| 62 #include "components/policy/core/common/policy_types.h" | 60 #include "components/policy/core/common/policy_types.h" |
| 63 #include "components/user_manager/user_manager.h" | 61 #include "components/user_manager/user_manager.h" |
| 64 #include "components/user_manager/user_type.h" | 62 #include "components/user_manager/user_type.h" |
| 65 #include "content/public/browser/browser_thread.h" | 63 #include "content/public/browser/browser_thread.h" |
| 66 #include "content/public/browser/notification_service.h" | 64 #include "content/public/browser/notification_service.h" |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 } | 481 } |
| 484 LoginAsGuest(); | 482 LoginAsGuest(); |
| 485 return; | 483 return; |
| 486 } | 484 } |
| 487 | 485 |
| 488 if (user_context.GetUserType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT) { | 486 if (user_context.GetUserType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT) { |
| 489 LoginAsPublicSession(user_context); | 487 LoginAsPublicSession(user_context); |
| 490 return; | 488 return; |
| 491 } | 489 } |
| 492 | 490 |
| 493 if (user_context.GetUserType() == user_manager::USER_TYPE_RETAIL_MODE) { | |
| 494 LoginAsRetailModeUser(); | |
| 495 return; | |
| 496 } | |
| 497 | |
| 498 if (user_context.GetUserType() == user_manager::USER_TYPE_KIOSK_APP) { | 491 if (user_context.GetUserType() == user_manager::USER_TYPE_KIOSK_APP) { |
| 499 LoginAsKioskApp(user_context.GetUserID(), specifics.kiosk_diagnostic_mode); | 492 LoginAsKioskApp(user_context.GetUserID(), specifics.kiosk_diagnostic_mode); |
| 500 return; | 493 return; |
| 501 } | 494 } |
| 502 | 495 |
| 503 // Regular user or supervised user login. | 496 // Regular user or supervised user login. |
| 504 | 497 |
| 505 if (!user_context.HasCredentials()) { | 498 if (!user_context.HasCredentials()) { |
| 506 // If credentials are missing, refuse to log in. | 499 // If credentials are missing, refuse to log in. |
| 507 | 500 |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 908 return auth_mode_; | 901 return auth_mode_; |
| 909 } | 902 } |
| 910 | 903 |
| 911 bool ExistingUserController::password_changed() const { | 904 bool ExistingUserController::password_changed() const { |
| 912 if (login_performer_) | 905 if (login_performer_) |
| 913 return login_performer_->password_changed(); | 906 return login_performer_->password_changed(); |
| 914 | 907 |
| 915 return password_changed_; | 908 return password_changed_; |
| 916 } | 909 } |
| 917 | 910 |
| 918 void ExistingUserController::LoginAsRetailModeUser() { | |
| 919 PerformPreLoginActions(UserContext(user_manager::USER_TYPE_RETAIL_MODE, | |
| 920 chromeos::login::kRetailModeUserName)); | |
| 921 | |
| 922 // TODO(rkc): Add a CHECK to make sure retail mode logins are allowed once | |
| 923 // the enterprise policy wiring is done for retail mode. | |
| 924 | |
| 925 // Only one instance of LoginPerformer should exist at a time. | |
| 926 login_performer_.reset(NULL); | |
| 927 login_performer_.reset(new ChromeLoginPerformer(this)); | |
| 928 login_performer_->LoginRetailMode(); | |
| 929 SendAccessibilityAlert( | |
| 930 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_LOGIN_SIGNIN_DEMOUSER)); | |
| 931 } | |
| 932 | |
| 933 void ExistingUserController::LoginAsGuest() { | 911 void ExistingUserController::LoginAsGuest() { |
| 934 PerformPreLoginActions(UserContext(user_manager::USER_TYPE_GUEST, | 912 PerformPreLoginActions(UserContext(user_manager::USER_TYPE_GUEST, |
| 935 chromeos::login::kGuestUserName)); | 913 chromeos::login::kGuestUserName)); |
| 936 | 914 |
| 937 bool allow_guest; | 915 bool allow_guest; |
| 938 cros_settings_->GetBoolean(kAccountsPrefAllowGuest, &allow_guest); | 916 cros_settings_->GetBoolean(kAccountsPrefAllowGuest, &allow_guest); |
| 939 if (!allow_guest) { | 917 if (!allow_guest) { |
| 940 // Disallowed. The UI should normally not show the guest pod but if for some | 918 // Disallowed. The UI should normally not show the guest pod but if for some |
| 941 // reason this has been made available to the user here is the time to tell | 919 // reason this has been made available to the user here is the time to tell |
| 942 // this nicely. | 920 // this nicely. |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1223 is_login_in_progress_ = false; | 1201 is_login_in_progress_ = false; |
| 1224 | 1202 |
| 1225 // Reenable clicking on other windows and status area. | 1203 // Reenable clicking on other windows and status area. |
| 1226 login_display_->SetUIEnabled(true); | 1204 login_display_->SetUIEnabled(true); |
| 1227 | 1205 |
| 1228 if (start_public_session_timer) | 1206 if (start_public_session_timer) |
| 1229 StartPublicSessionAutoLoginTimer(); | 1207 StartPublicSessionAutoLoginTimer(); |
| 1230 } | 1208 } |
| 1231 | 1209 |
| 1232 } // namespace chromeos | 1210 } // namespace chromeos |
| OLD | NEW |