| 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 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 } | 488 } |
| 491 LoginAsGuest(); | 489 LoginAsGuest(); |
| 492 return; | 490 return; |
| 493 } | 491 } |
| 494 | 492 |
| 495 if (user_context.GetUserType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT) { | 493 if (user_context.GetUserType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT) { |
| 496 LoginAsPublicSession(user_context); | 494 LoginAsPublicSession(user_context); |
| 497 return; | 495 return; |
| 498 } | 496 } |
| 499 | 497 |
| 500 if (user_context.GetUserType() == user_manager::USER_TYPE_RETAIL_MODE) { | |
| 501 LoginAsRetailModeUser(); | |
| 502 return; | |
| 503 } | |
| 504 | |
| 505 if (user_context.GetUserType() == user_manager::USER_TYPE_KIOSK_APP) { | 498 if (user_context.GetUserType() == user_manager::USER_TYPE_KIOSK_APP) { |
| 506 LoginAsKioskApp(user_context.GetUserID(), specifics.kiosk_diagnostic_mode); | 499 LoginAsKioskApp(user_context.GetUserID(), specifics.kiosk_diagnostic_mode); |
| 507 return; | 500 return; |
| 508 } | 501 } |
| 509 | 502 |
| 510 // Regular user or supervised user login. | 503 // Regular user or supervised user login. |
| 511 | 504 |
| 512 if (!user_context.HasCredentials()) { | 505 if (!user_context.HasCredentials()) { |
| 513 // If credentials are missing, refuse to log in. | 506 // If credentials are missing, refuse to log in. |
| 514 | 507 |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 915 return auth_mode_; | 908 return auth_mode_; |
| 916 } | 909 } |
| 917 | 910 |
| 918 bool ExistingUserController::password_changed() const { | 911 bool ExistingUserController::password_changed() const { |
| 919 if (login_performer_) | 912 if (login_performer_) |
| 920 return login_performer_->password_changed(); | 913 return login_performer_->password_changed(); |
| 921 | 914 |
| 922 return password_changed_; | 915 return password_changed_; |
| 923 } | 916 } |
| 924 | 917 |
| 925 void ExistingUserController::LoginAsRetailModeUser() { | |
| 926 PerformPreLoginActions(UserContext(user_manager::USER_TYPE_RETAIL_MODE, | |
| 927 chromeos::login::kRetailModeUserName)); | |
| 928 | |
| 929 // TODO(rkc): Add a CHECK to make sure retail mode logins are allowed once | |
| 930 // the enterprise policy wiring is done for retail mode. | |
| 931 | |
| 932 // Only one instance of LoginPerformer should exist at a time. | |
| 933 login_performer_.reset(NULL); | |
| 934 login_performer_.reset(new ChromeLoginPerformer(this)); | |
| 935 login_performer_->LoginRetailMode(); | |
| 936 SendAccessibilityAlert( | |
| 937 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_LOGIN_SIGNIN_DEMOUSER)); | |
| 938 } | |
| 939 | |
| 940 void ExistingUserController::LoginAsGuest() { | 918 void ExistingUserController::LoginAsGuest() { |
| 941 PerformPreLoginActions(UserContext(user_manager::USER_TYPE_GUEST, | 919 PerformPreLoginActions(UserContext(user_manager::USER_TYPE_GUEST, |
| 942 chromeos::login::kGuestUserName)); | 920 chromeos::login::kGuestUserName)); |
| 943 | 921 |
| 944 bool allow_guest; | 922 bool allow_guest; |
| 945 cros_settings_->GetBoolean(kAccountsPrefAllowGuest, &allow_guest); | 923 cros_settings_->GetBoolean(kAccountsPrefAllowGuest, &allow_guest); |
| 946 if (!allow_guest) { | 924 if (!allow_guest) { |
| 947 // Disallowed. The UI should normally not show the guest pod but if for some | 925 // Disallowed. The UI should normally not show the guest pod but if for some |
| 948 // reason this has been made available to the user here is the time to tell | 926 // reason this has been made available to the user here is the time to tell |
| 949 // this nicely. | 927 // this nicely. |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1230 is_login_in_progress_ = false; | 1208 is_login_in_progress_ = false; |
| 1231 | 1209 |
| 1232 // Reenable clicking on other windows and status area. | 1210 // Reenable clicking on other windows and status area. |
| 1233 login_display_->SetUIEnabled(true); | 1211 login_display_->SetUIEnabled(true); |
| 1234 | 1212 |
| 1235 if (start_public_session_timer) | 1213 if (start_public_session_timer) |
| 1236 StartPublicSessionAutoLoginTimer(); | 1214 StartPublicSessionAutoLoginTimer(); |
| 1237 } | 1215 } |
| 1238 | 1216 |
| 1239 } // namespace chromeos | 1217 } // namespace chromeos |
| OLD | NEW |