OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/users/user_manager_impl.h" | 5 #include "chrome/browser/chromeos/login/users/user_manager_impl.h" |
6 | 6 |
7 #include <cstddef> | 7 #include <cstddef> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "ash/multi_profile_uma.h" | 10 #include "ash/multi_profile_uma.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 #include "base/sys_info.h" | 28 #include "base/sys_info.h" |
29 #include "base/threading/worker_pool.h" | 29 #include "base/threading/worker_pool.h" |
30 #include "base/values.h" | 30 #include "base/values.h" |
31 #include "chrome/browser/app_mode/app_mode_utils.h" | 31 #include "chrome/browser/app_mode/app_mode_utils.h" |
32 #include "chrome/browser/browser_process.h" | 32 #include "chrome/browser/browser_process.h" |
33 #include "chrome/browser/chrome_notification_types.h" | 33 #include "chrome/browser/chrome_notification_types.h" |
34 #include "chrome/browser/chromeos/base/locale_util.h" | 34 #include "chrome/browser/chromeos/base/locale_util.h" |
35 #include "chrome/browser/chromeos/login/auth/user_context.h" | 35 #include "chrome/browser/chromeos/login/auth/user_context.h" |
36 #include "chrome/browser/chromeos/login/demo_mode/demo_app_launcher.h" | 36 #include "chrome/browser/chromeos/login/demo_mode/demo_app_launcher.h" |
37 #include "chrome/browser/chromeos/login/login_utils.h" | 37 #include "chrome/browser/chromeos/login/login_utils.h" |
38 #include "chrome/browser/chromeos/login/session/session_manager.h" | |
39 #include "chrome/browser/chromeos/login/signin/auth_sync_observer.h" | 38 #include "chrome/browser/chromeos/login/signin/auth_sync_observer.h" |
40 #include "chrome/browser/chromeos/login/signin/auth_sync_observer_factory.h" | 39 #include "chrome/browser/chromeos/login/signin/auth_sync_observer_factory.h" |
41 #include "chrome/browser/chromeos/login/ui/login_display.h" | 40 #include "chrome/browser/chromeos/login/ui/login_display.h" |
42 #include "chrome/browser/chromeos/login/users/avatar/user_image_manager_impl.h" | 41 #include "chrome/browser/chromeos/login/users/avatar/user_image_manager_impl.h" |
43 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" | 42 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" |
44 #include "chrome/browser/chromeos/login/users/remove_user_delegate.h" | 43 #include "chrome/browser/chromeos/login/users/remove_user_delegate.h" |
45 #include "chrome/browser/chromeos/login/users/supervised_user_manager_impl.h" | 44 #include "chrome/browser/chromeos/login/users/supervised_user_manager_impl.h" |
46 #include "chrome/browser/chromeos/login/wizard_controller.h" | 45 #include "chrome/browser/chromeos/login/wizard_controller.h" |
47 #include "chrome/browser/chromeos/net/network_portal_detector.h" | 46 #include "chrome/browser/chromeos/net/network_portal_detector.h" |
48 #include "chrome/browser/chromeos/net/network_portal_detector_strategy.h" | 47 #include "chrome/browser/chromeos/net/network_portal_detector_strategy.h" |
(...skipping 1145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1194 void UserManagerImpl::OnProfilePrepared(Profile* profile) { | 1193 void UserManagerImpl::OnProfilePrepared(Profile* profile) { |
1195 LoginUtils::Get()->DoBrowserLaunch(profile, | 1194 LoginUtils::Get()->DoBrowserLaunch(profile, |
1196 NULL); // host_, not needed here | 1195 NULL); // host_, not needed here |
1197 | 1196 |
1198 if (!CommandLine::ForCurrentProcess()->HasSwitch(::switches::kTestName)) { | 1197 if (!CommandLine::ForCurrentProcess()->HasSwitch(::switches::kTestName)) { |
1199 // Did not log in (we crashed or are debugging), need to restore Sync. | 1198 // Did not log in (we crashed or are debugging), need to restore Sync. |
1200 // TODO(nkostylev): Make sure that OAuth state is restored correctly for all | 1199 // TODO(nkostylev): Make sure that OAuth state is restored correctly for all |
1201 // users once it is fully multi-profile aware. http://crbug.com/238987 | 1200 // users once it is fully multi-profile aware. http://crbug.com/238987 |
1202 // For now if we have other user pending sessions they'll override OAuth | 1201 // For now if we have other user pending sessions they'll override OAuth |
1203 // session restore for previous users. | 1202 // session restore for previous users. |
1204 SessionManager::GetInstance()->RestoreAuthenticationSession(profile); | 1203 LoginUtils::Get()->RestoreAuthenticationSession(profile); |
1205 } | 1204 } |
1206 | 1205 |
1207 // Restore other user sessions if any. | 1206 // Restore other user sessions if any. |
1208 RestorePendingUserSessions(); | 1207 RestorePendingUserSessions(); |
1209 } | 1208 } |
1210 | 1209 |
1211 void UserManagerImpl::EnsureUsersLoaded() { | 1210 void UserManagerImpl::EnsureUsersLoaded() { |
1212 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1211 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
1213 if (!g_browser_process || !g_browser_process->local_state()) | 1212 if (!g_browser_process || !g_browser_process->local_state()) |
1214 return; | 1213 return; |
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2027 } | 2026 } |
2028 } | 2027 } |
2029 DCHECK(!user_already_logged_in); | 2028 DCHECK(!user_already_logged_in); |
2030 | 2029 |
2031 if (!user_already_logged_in) { | 2030 if (!user_already_logged_in) { |
2032 UserContext user_context(user_id); | 2031 UserContext user_context(user_id); |
2033 user_context.SetUserIDHash(user_id_hash); | 2032 user_context.SetUserIDHash(user_id_hash); |
2034 user_context.SetIsUsingOAuth(false); | 2033 user_context.SetIsUsingOAuth(false); |
2035 // Will call OnProfilePrepared() once profile has been loaded. | 2034 // Will call OnProfilePrepared() once profile has been loaded. |
2036 LoginUtils::Get()->PrepareProfile(user_context, | 2035 LoginUtils::Get()->PrepareProfile(user_context, |
| 2036 std::string(), // display_email |
2037 false, // has_cookies | 2037 false, // has_cookies |
2038 true, // has_active_session | 2038 true, // has_active_session |
2039 this); | 2039 this); |
2040 } else { | 2040 } else { |
2041 RestorePendingUserSessions(); | 2041 RestorePendingUserSessions(); |
2042 } | 2042 } |
2043 } | 2043 } |
2044 | 2044 |
2045 void UserManagerImpl::SendRegularUserLoginMetrics(const std::string& user_id) { | 2045 void UserManagerImpl::SendRegularUserLoginMetrics(const std::string& user_id) { |
2046 // If this isn't the first time Chrome was run after the system booted, | 2046 // If this isn't the first time Chrome was run after the system booted, |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2100 } | 2100 } |
2101 | 2101 |
2102 void UserManagerImpl::DeleteUser(User* user) { | 2102 void UserManagerImpl::DeleteUser(User* user) { |
2103 const bool is_active_user = (user == active_user_); | 2103 const bool is_active_user = (user == active_user_); |
2104 delete user; | 2104 delete user; |
2105 if (is_active_user) | 2105 if (is_active_user) |
2106 active_user_ = NULL; | 2106 active_user_ = NULL; |
2107 } | 2107 } |
2108 | 2108 |
2109 } // namespace chromeos | 2109 } // namespace chromeos |
OLD | NEW |