Chromium Code Reviews| 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" |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 21 #include "base/values.h" | 21 #include "base/values.h" |
| 22 #include "base/version.h" | 22 #include "base/version.h" |
| 23 #include "chrome/browser/accessibility/accessibility_events.h" | 23 #include "chrome/browser/accessibility/accessibility_events.h" |
| 24 #include "chrome/browser/browser_process.h" | 24 #include "chrome/browser/browser_process.h" |
| 25 #include "chrome/browser/browser_process_platform_part.h" | 25 #include "chrome/browser/browser_process_platform_part.h" |
| 26 #include "chrome/browser/chrome_notification_types.h" | 26 #include "chrome/browser/chrome_notification_types.h" |
| 27 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 27 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
| 28 #include "chrome/browser/chromeos/boot_times_loader.h" | 28 #include "chrome/browser/chromeos/boot_times_loader.h" |
| 29 #include "chrome/browser/chromeos/customization_document.h" | 29 #include "chrome/browser/chromeos/customization_document.h" |
| 30 #include "chrome/browser/chromeos/first_run/first_run.h" | 30 #include "chrome/browser/chromeos/first_run/first_run.h" |
| 31 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" | |
| 32 #include "chrome/browser/chromeos/login/helper.h" | 31 #include "chrome/browser/chromeos/login/helper.h" |
| 33 #include "chrome/browser/chromeos/login/login_utils.h" | 32 #include "chrome/browser/chromeos/login/login_utils.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" |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 407 if (specifics.guest_mode_url_append_locale) | 406 if (specifics.guest_mode_url_append_locale) |
| 408 guest_mode_url_ = google_util::AppendGoogleLocaleParam( | 407 guest_mode_url_ = google_util::AppendGoogleLocaleParam( |
| 409 guest_mode_url_, g_browser_process->GetApplicationLocale()); | 408 guest_mode_url_, g_browser_process->GetApplicationLocale()); |
| 410 } | 409 } |
| 411 LoginAsGuest(); | 410 LoginAsGuest(); |
| 412 return; | 411 return; |
| 413 } else if (user_context.GetUserType() == | 412 } else if (user_context.GetUserType() == |
| 414 user_manager::USER_TYPE_PUBLIC_ACCOUNT) { | 413 user_manager::USER_TYPE_PUBLIC_ACCOUNT) { |
| 415 LoginAsPublicSession(user_context); | 414 LoginAsPublicSession(user_context); |
| 416 return; | 415 return; |
| 417 } else if (user_context.GetUserType() == | |
| 418 user_manager::USER_TYPE_RETAIL_MODE) { | |
| 419 LoginAsRetailModeUser(); | |
| 420 return; | |
| 421 } else if (user_context.GetUserType() == user_manager::USER_TYPE_KIOSK_APP) { | 416 } else if (user_context.GetUserType() == user_manager::USER_TYPE_KIOSK_APP) { |
| 422 LoginAsKioskApp(user_context.GetUserID(), specifics.kiosk_diagnostic_mode); | 417 LoginAsKioskApp(user_context.GetUserID(), specifics.kiosk_diagnostic_mode); |
| 423 return; | 418 return; |
| 424 } | 419 } |
| 425 | 420 |
| 426 if (!user_context.HasCredentials()) | 421 if (!user_context.HasCredentials()) |
| 427 return; | 422 return; |
| 428 | 423 |
| 429 // Stop the auto-login timer when attempting login. | 424 // Stop the auto-login timer when attempting login. |
| 430 StopPublicSessionAutoLoginTimer(); | 425 StopPublicSessionAutoLoginTimer(); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 466 if (gaia::ExtractDomainName(user_context.GetUserID()) == | 461 if (gaia::ExtractDomainName(user_context.GetUserID()) == |
| 467 chromeos::login::kSupervisedUserDomain) { | 462 chromeos::login::kSupervisedUserDomain) { |
| 468 login_performer_->LoginAsSupervisedUser(user_context); | 463 login_performer_->LoginAsSupervisedUser(user_context); |
| 469 } else { | 464 } else { |
| 470 login_performer_->PerformLogin(user_context, auth_mode); | 465 login_performer_->PerformLogin(user_context, auth_mode); |
| 471 } | 466 } |
| 472 SendAccessibilityAlert( | 467 SendAccessibilityAlert( |
| 473 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_LOGIN_SIGNING_IN)); | 468 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_LOGIN_SIGNING_IN)); |
| 474 } | 469 } |
| 475 | 470 |
| 476 void ExistingUserController::LoginAsRetailModeUser() { | |
| 477 // Stop the auto-login timer when attempting login. | |
| 478 StopPublicSessionAutoLoginTimer(); | |
| 479 | |
| 480 // Disable clicking on other windows. | |
| 481 login_display_->SetUIEnabled(false); | |
| 482 // TODO(rkc): Add a CHECK to make sure retail mode logins are allowed once | |
| 483 // the enterprise policy wiring is done for retail mode. | |
| 484 | |
| 485 // Only one instance of LoginPerformer should exist at a time. | |
| 486 login_performer_.reset(NULL); | |
| 487 login_performer_.reset(new LoginPerformer(this)); | |
| 488 is_login_in_progress_ = true; | |
| 489 login_performer_->LoginRetailMode(); | |
| 490 SendAccessibilityAlert( | |
| 491 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_LOGIN_SIGNIN_DEMOUSER)); | |
| 492 } | |
| 493 | |
| 494 void ExistingUserController::LoginAsGuest() { | 471 void ExistingUserController::LoginAsGuest() { |
| 495 if (is_login_in_progress_ || | 472 if (is_login_in_progress_ || |
| 496 user_manager::UserManager::Get()->IsUserLoggedIn()) { | 473 user_manager::UserManager::Get()->IsUserLoggedIn()) { |
| 497 return; | 474 return; |
| 498 } | 475 } |
| 499 | 476 |
| 500 // Stop the auto-login timer when attempting login. | 477 // Stop the auto-login timer when attempting login. |
| 501 StopPublicSessionAutoLoginTimer(); | 478 StopPublicSessionAutoLoginTimer(); |
| 502 | 479 |
| 503 // Disable clicking on other windows. | 480 // Disable clicking on other windows. |
| (...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1117 weak_factory_.GetWeakPtr())); | 1094 weak_factory_.GetWeakPtr())); |
| 1118 } | 1095 } |
| 1119 | 1096 |
| 1120 gfx::NativeWindow ExistingUserController::GetNativeWindow() const { | 1097 gfx::NativeWindow ExistingUserController::GetNativeWindow() const { |
| 1121 return host_->GetNativeWindow(); | 1098 return host_->GetNativeWindow(); |
| 1122 } | 1099 } |
| 1123 | 1100 |
| 1124 void ExistingUserController::InitializeStartUrls() const { | 1101 void ExistingUserController::InitializeStartUrls() const { |
| 1125 std::vector<std::string> start_urls; | 1102 std::vector<std::string> start_urls; |
| 1126 | 1103 |
| 1127 const base::ListValue *urls; | |
| 1128 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); | 1104 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); |
| 1129 bool can_show_getstarted_guide = | 1105 bool can_show_getstarted_guide = |
| 1130 user_manager->GetActiveUser()->GetType() == | 1106 user_manager->GetActiveUser()->GetType() == |
| 1131 user_manager::USER_TYPE_REGULAR && | 1107 user_manager::USER_TYPE_REGULAR && |
| 1132 !user_manager->IsCurrentUserNonCryptohomeDataEphemeral(); | 1108 !user_manager->IsCurrentUserNonCryptohomeDataEphemeral(); |
| 1133 if (user_manager->IsLoggedInAsDemoUser()) { | 1109 if (!user_manager->IsLoggedInAsPublicAccount()) { |
| 1134 if (CrosSettings::Get()->GetList(kStartUpUrls, &urls)) { | |
| 1135 // The retail mode user will get start URLs from a special policy if it is | |
| 1136 // set. | |
| 1137 for (base::ListValue::const_iterator it = urls->begin(); | |
| 1138 it != urls->end(); ++it) { | |
| 1139 std::string url; | |
| 1140 if ((*it)->GetAsString(&url)) | |
| 1141 start_urls.push_back(url); | |
| 1142 } | |
| 1143 } | |
| 1144 can_show_getstarted_guide = false; | |
| 1145 // Skip the default first-run behavior for public accounts. | |
|
Nikita (slow)
2014/10/01 07:13:01
nit: Please leave public session comment.
rkc
2014/10/01 17:29:52
Done.
| |
| 1146 } else if (!user_manager->IsLoggedInAsPublicAccount()) { | |
| 1147 if (AccessibilityManager::Get()->IsSpokenFeedbackEnabled()) { | 1110 if (AccessibilityManager::Get()->IsSpokenFeedbackEnabled()) { |
| 1148 const char* url = kChromeVoxTutorialURLPattern; | 1111 const char* url = kChromeVoxTutorialURLPattern; |
| 1149 PrefService* prefs = g_browser_process->local_state(); | 1112 PrefService* prefs = g_browser_process->local_state(); |
| 1150 const std::string current_locale = | 1113 const std::string current_locale = |
| 1151 base::StringToLowerASCII(prefs->GetString(prefs::kApplicationLocale)); | 1114 base::StringToLowerASCII(prefs->GetString(prefs::kApplicationLocale)); |
| 1152 std::string vox_url = base::StringPrintf(url, current_locale.c_str()); | 1115 std::string vox_url = base::StringPrintf(url, current_locale.c_str()); |
| 1153 start_urls.push_back(vox_url); | 1116 start_urls.push_back(vox_url); |
| 1154 can_show_getstarted_guide = false; | 1117 can_show_getstarted_guide = false; |
| 1155 } | 1118 } |
| 1156 } | 1119 } |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1254 // Only one instance of LoginPerformer should exist at a time. | 1217 // Only one instance of LoginPerformer should exist at a time. |
| 1255 login_performer_.reset(NULL); | 1218 login_performer_.reset(NULL); |
| 1256 login_performer_.reset(new LoginPerformer(this)); | 1219 login_performer_.reset(new LoginPerformer(this)); |
| 1257 is_login_in_progress_ = true; | 1220 is_login_in_progress_ = true; |
| 1258 login_performer_->LoginAsPublicSession(user_context); | 1221 login_performer_->LoginAsPublicSession(user_context); |
| 1259 SendAccessibilityAlert( | 1222 SendAccessibilityAlert( |
| 1260 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_LOGIN_SIGNIN_PUBLIC_ACCOUNT)); | 1223 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_LOGIN_SIGNIN_PUBLIC_ACCOUNT)); |
| 1261 } | 1224 } |
| 1262 | 1225 |
| 1263 } // namespace chromeos | 1226 } // namespace chromeos |
| OLD | NEW |