| 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/browser_process.h" | 22 #include "chrome/browser/browser_process.h" |
| 23 #include "chrome/browser/browser_process_platform_part.h" | 23 #include "chrome/browser/browser_process_platform_part.h" |
| 24 #include "chrome/browser/chrome_notification_types.h" | 24 #include "chrome/browser/chrome_notification_types.h" |
| 25 #include "chrome/browser/chromeos/boot_times_recorder.h" | 25 #include "chrome/browser/chromeos/boot_times_recorder.h" |
| 26 #include "chrome/browser/chromeos/customization/customization_document.h" | 26 #include "chrome/browser/chromeos/customization/customization_document.h" |
| 27 #include "chrome/browser/chromeos/login/auth/chrome_login_performer.h" | 27 #include "chrome/browser/chromeos/login/auth/chrome_login_performer.h" |
| 28 #include "chrome/browser/chromeos/login/helper.h" | 28 #include "chrome/browser/chromeos/login/helper.h" |
| 29 #include "chrome/browser/chromeos/login/login_utils.h" | |
| 30 #include "chrome/browser/chromeos/login/session/user_session_manager.h" | 29 #include "chrome/browser/chromeos/login/session/user_session_manager.h" |
| 31 #include "chrome/browser/chromeos/login/signin_specifics.h" | 30 #include "chrome/browser/chromeos/login/signin_specifics.h" |
| 32 #include "chrome/browser/chromeos/login/startup_utils.h" | 31 #include "chrome/browser/chromeos/login/startup_utils.h" |
| 33 #include "chrome/browser/chromeos/login/ui/login_display_host.h" | 32 #include "chrome/browser/chromeos/login/ui/login_display_host.h" |
| 33 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" |
| 34 #include "chrome/browser/chromeos/login/user_flow.h" | 34 #include "chrome/browser/chromeos/login/user_flow.h" |
| 35 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" | 35 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" |
| 36 #include "chrome/browser/chromeos/login/wizard_controller.h" | 36 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 37 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 37 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 38 #include "chrome/browser/chromeos/policy/device_local_account.h" | 38 #include "chrome/browser/chromeos/policy/device_local_account.h" |
| 39 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" | 39 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" |
| 40 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 40 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 41 #include "chrome/browser/chromeos/settings/cros_settings.h" | 41 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 42 #include "chrome/browser/chromeos/system/device_disabling_manager.h" | 42 #include "chrome/browser/chromeos/system/device_disabling_manager.h" |
| 43 #include "chrome/browser/signin/easy_unlock_service.h" | 43 #include "chrome/browser/signin/easy_unlock_service.h" |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 cros_settings_->GetBoolean(kAccountsPrefShowUserNamesOnSignIn, | 217 cros_settings_->GetBoolean(kAccountsPrefShowUserNamesOnSignIn, |
| 218 &show_users_on_signin); | 218 &show_users_on_signin); |
| 219 for (user_manager::UserList::const_iterator it = users.begin(); | 219 for (user_manager::UserList::const_iterator it = users.begin(); |
| 220 it != users.end(); | 220 it != users.end(); |
| 221 ++it) { | 221 ++it) { |
| 222 // TODO(xiyuan): Clean user profile whose email is not in whitelist. | 222 // TODO(xiyuan): Clean user profile whose email is not in whitelist. |
| 223 bool meets_supervised_requirements = | 223 bool meets_supervised_requirements = |
| 224 (*it)->GetType() != user_manager::USER_TYPE_SUPERVISED || | 224 (*it)->GetType() != user_manager::USER_TYPE_SUPERVISED || |
| 225 user_manager::UserManager::Get()->AreSupervisedUsersAllowed(); | 225 user_manager::UserManager::Get()->AreSupervisedUsersAllowed(); |
| 226 bool meets_whitelist_requirements = | 226 bool meets_whitelist_requirements = |
| 227 LoginUtils::IsWhitelisted((*it)->email(), NULL) || | 227 CrosSettings::IsWhitelisted((*it)->email(), NULL) || |
| 228 !(*it)->HasGaiaAccount(); | 228 !(*it)->HasGaiaAccount(); |
| 229 | 229 |
| 230 // Public session accounts are always shown on login screen. | 230 // Public session accounts are always shown on login screen. |
| 231 bool meets_show_users_requirements = | 231 bool meets_show_users_requirements = |
| 232 show_users_on_signin || | 232 show_users_on_signin || |
| 233 (*it)->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT; | 233 (*it)->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT; |
| 234 if (meets_supervised_requirements && | 234 if (meets_supervised_requirements && |
| 235 meets_whitelist_requirements && | 235 meets_whitelist_requirements && |
| 236 meets_show_users_requirements) { | 236 meets_show_users_requirements) { |
| 237 filtered_users.push_back(*it); | 237 filtered_users.push_back(*it); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 signin_profile_context_getter, | 295 signin_profile_context_getter, |
| 296 browser_process_context_getter), | 296 browser_process_context_getter), |
| 297 base::TimeDelta::FromMilliseconds(kAuthCacheTransferDelayMs)); | 297 base::TimeDelta::FromMilliseconds(kAuthCacheTransferDelayMs)); |
| 298 } | 298 } |
| 299 } | 299 } |
| 300 | 300 |
| 301 //////////////////////////////////////////////////////////////////////////////// | 301 //////////////////////////////////////////////////////////////////////////////// |
| 302 // ExistingUserController, private: | 302 // ExistingUserController, private: |
| 303 | 303 |
| 304 ExistingUserController::~ExistingUserController() { | 304 ExistingUserController::~ExistingUserController() { |
| 305 LoginUtils::Get()->DelegateDeleted(this); | 305 UserSessionManager::GetInstance()->DelegateDeleted(this); |
| 306 | 306 |
| 307 if (current_controller_ == this) { | 307 if (current_controller_ == this) { |
| 308 current_controller_ = NULL; | 308 current_controller_ = NULL; |
| 309 } else { | 309 } else { |
| 310 NOTREACHED() << "More than one controller are alive."; | 310 NOTREACHED() << "More than one controller are alive."; |
| 311 } | 311 } |
| 312 DCHECK(login_display_.get()); | 312 DCHECK(login_display_.get()); |
| 313 } | 313 } |
| 314 | 314 |
| 315 //////////////////////////////////////////////////////////////////////////////// | 315 //////////////////////////////////////////////////////////////////////////////// |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 679 StopPublicSessionAutoLoginTimer(); | 679 StopPublicSessionAutoLoginTimer(); |
| 680 | 680 |
| 681 const bool has_auth_cookies = | 681 const bool has_auth_cookies = |
| 682 login_performer_->auth_mode() == LoginPerformer::AUTH_MODE_EXTENSION && | 682 login_performer_->auth_mode() == LoginPerformer::AUTH_MODE_EXTENSION && |
| 683 user_context.GetAuthCode().empty(); | 683 user_context.GetAuthCode().empty(); |
| 684 | 684 |
| 685 // LoginPerformer instance will delete itself in case of successful auth. | 685 // LoginPerformer instance will delete itself in case of successful auth. |
| 686 login_performer_->set_delegate(NULL); | 686 login_performer_->set_delegate(NULL); |
| 687 ignore_result(login_performer_.release()); | 687 ignore_result(login_performer_.release()); |
| 688 | 688 |
| 689 // Will call OnProfilePrepared() in the end. | 689 UserSessionManager::StartSessionType start_session_type = |
| 690 LoginUtils::Get()->PrepareProfile(user_context, | 690 UserAddingScreen::Get()->IsRunning() |
| 691 has_auth_cookies, | 691 ? UserSessionManager::SECONDARY_USER_SESSION |
| 692 false, // Start session for user. | 692 : UserSessionManager::PRIMARY_USER_SESSION; |
| 693 this); | 693 UserSessionManager::GetInstance()->StartSession( |
| 694 user_context, start_session_type, has_auth_cookies, |
| 695 false, // Start session for user. |
| 696 this); |
| 694 | 697 |
| 695 // Update user's displayed email. | 698 // Update user's displayed email. |
| 696 if (!display_email_.empty()) { | 699 if (!display_email_.empty()) { |
| 697 user_manager::UserManager::Get()->SaveUserDisplayEmail( | 700 user_manager::UserManager::Get()->SaveUserDisplayEmail( |
| 698 user_context.GetUserID(), display_email_); | 701 user_context.GetUserID(), display_email_); |
| 699 display_email_.clear(); | 702 display_email_.clear(); |
| 700 } | 703 } |
| 701 } | 704 } |
| 702 | 705 |
| 703 void ExistingUserController::OnProfilePrepared(Profile* profile, | 706 void ExistingUserController::OnProfilePrepared(Profile* profile, |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1118 is_login_in_progress_ = false; | 1121 is_login_in_progress_ = false; |
| 1119 | 1122 |
| 1120 // Reenable clicking on other windows and status area. | 1123 // Reenable clicking on other windows and status area. |
| 1121 login_display_->SetUIEnabled(true); | 1124 login_display_->SetUIEnabled(true); |
| 1122 | 1125 |
| 1123 if (start_public_session_timer) | 1126 if (start_public_session_timer) |
| 1124 StartPublicSessionAutoLoginTimer(); | 1127 StartPublicSessionAutoLoginTimer(); |
| 1125 } | 1128 } |
| 1126 | 1129 |
| 1127 } // namespace chromeos | 1130 } // namespace chromeos |
| OLD | NEW |