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 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 StopPublicSessionAutoLoginTimer(); | 683 StopPublicSessionAutoLoginTimer(); |
684 | 684 |
685 const bool has_auth_cookies = | 685 const bool has_auth_cookies = |
686 login_performer_->auth_mode() == LoginPerformer::AUTH_MODE_EXTENSION && | 686 login_performer_->auth_mode() == LoginPerformer::AUTH_MODE_EXTENSION && |
687 user_context.GetAuthCode().empty(); | 687 user_context.GetAuthCode().empty(); |
688 | 688 |
689 // LoginPerformer instance will delete itself in case of successful auth. | 689 // LoginPerformer instance will delete itself in case of successful auth. |
690 login_performer_->set_delegate(NULL); | 690 login_performer_->set_delegate(NULL); |
691 ignore_result(login_performer_.release()); | 691 ignore_result(login_performer_.release()); |
692 | 692 |
693 // Will call OnProfilePrepared() in the end. | 693 UserSessionManager::StartSessionType start_session_type = |
694 LoginUtils::Get()->PrepareProfile(user_context, | 694 UserAddingScreen::Get()->IsRunning() |
695 has_auth_cookies, | 695 ? UserSessionManager::SECONDARY_USER_SESSION |
696 false, // Start session for user. | 696 : UserSessionManager::PRIMARY_USER_SESSION; |
697 this); | 697 UserSessionManager::GetInstance()->StartSession( |
| 698 user_context, start_session_type, has_auth_cookies, |
| 699 false, // Start session for user. |
| 700 this); |
698 | 701 |
699 // Update user's displayed email. | 702 // Update user's displayed email. |
700 if (!display_email_.empty()) { | 703 if (!display_email_.empty()) { |
701 user_manager::UserManager::Get()->SaveUserDisplayEmail( | 704 user_manager::UserManager::Get()->SaveUserDisplayEmail( |
702 user_context.GetUserID(), display_email_); | 705 user_context.GetUserID(), display_email_); |
703 display_email_.clear(); | 706 display_email_.clear(); |
704 } | 707 } |
705 } | 708 } |
706 | 709 |
707 void ExistingUserController::OnProfilePrepared(Profile* profile, | 710 void ExistingUserController::OnProfilePrepared(Profile* profile, |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1122 is_login_in_progress_ = false; | 1125 is_login_in_progress_ = false; |
1123 | 1126 |
1124 // Reenable clicking on other windows and status area. | 1127 // Reenable clicking on other windows and status area. |
1125 login_display_->SetUIEnabled(true); | 1128 login_display_->SetUIEnabled(true); |
1126 | 1129 |
1127 if (start_public_session_timer) | 1130 if (start_public_session_timer) |
1128 StartPublicSessionAutoLoginTimer(); | 1131 StartPublicSessionAutoLoginTimer(); |
1129 } | 1132 } |
1130 | 1133 |
1131 } // namespace chromeos | 1134 } // namespace chromeos |
OLD | NEW |