Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Side by Side Diff: chrome/browser/chromeos/login/users/user_manager_impl.cc

Issue 318853004: Introduce SessionManager that will contain code to start user session on Chrome OS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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"
38 #include "chrome/browser/chromeos/login/signin/auth_sync_observer.h" 39 #include "chrome/browser/chromeos/login/signin/auth_sync_observer.h"
39 #include "chrome/browser/chromeos/login/signin/auth_sync_observer_factory.h" 40 #include "chrome/browser/chromeos/login/signin/auth_sync_observer_factory.h"
40 #include "chrome/browser/chromeos/login/ui/login_display.h" 41 #include "chrome/browser/chromeos/login/ui/login_display.h"
41 #include "chrome/browser/chromeos/login/users/avatar/user_image_manager_impl.h" 42 #include "chrome/browser/chromeos/login/users/avatar/user_image_manager_impl.h"
42 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" 43 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h"
43 #include "chrome/browser/chromeos/login/users/remove_user_delegate.h" 44 #include "chrome/browser/chromeos/login/users/remove_user_delegate.h"
44 #include "chrome/browser/chromeos/login/users/supervised_user_manager_impl.h" 45 #include "chrome/browser/chromeos/login/users/supervised_user_manager_impl.h"
45 #include "chrome/browser/chromeos/login/wizard_controller.h" 46 #include "chrome/browser/chromeos/login/wizard_controller.h"
46 #include "chrome/browser/chromeos/net/network_portal_detector.h" 47 #include "chrome/browser/chromeos/net/network_portal_detector.h"
47 #include "chrome/browser/chromeos/net/network_portal_detector_strategy.h" 48 #include "chrome/browser/chromeos/net/network_portal_detector_strategy.h"
(...skipping 1145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1193 void UserManagerImpl::OnProfilePrepared(Profile* profile) { 1194 void UserManagerImpl::OnProfilePrepared(Profile* profile) {
1194 LoginUtils::Get()->DoBrowserLaunch(profile, 1195 LoginUtils::Get()->DoBrowserLaunch(profile,
1195 NULL); // host_, not needed here 1196 NULL); // host_, not needed here
1196 1197
1197 if (!CommandLine::ForCurrentProcess()->HasSwitch(::switches::kTestName)) { 1198 if (!CommandLine::ForCurrentProcess()->HasSwitch(::switches::kTestName)) {
1198 // Did not log in (we crashed or are debugging), need to restore Sync. 1199 // Did not log in (we crashed or are debugging), need to restore Sync.
1199 // TODO(nkostylev): Make sure that OAuth state is restored correctly for all 1200 // TODO(nkostylev): Make sure that OAuth state is restored correctly for all
1200 // users once it is fully multi-profile aware. http://crbug.com/238987 1201 // users once it is fully multi-profile aware. http://crbug.com/238987
1201 // For now if we have other user pending sessions they'll override OAuth 1202 // For now if we have other user pending sessions they'll override OAuth
1202 // session restore for previous users. 1203 // session restore for previous users.
1203 LoginUtils::Get()->RestoreAuthenticationSession(profile); 1204 SessionManager::GetInstance()->RestoreAuthenticationSession(profile);
1204 } 1205 }
1205 1206
1206 // Restore other user sessions if any. 1207 // Restore other user sessions if any.
1207 RestorePendingUserSessions(); 1208 RestorePendingUserSessions();
1208 } 1209 }
1209 1210
1210 void UserManagerImpl::EnsureUsersLoaded() { 1211 void UserManagerImpl::EnsureUsersLoaded() {
1211 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1212 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1212 if (!g_browser_process || !g_browser_process->local_state()) 1213 if (!g_browser_process || !g_browser_process->local_state())
1213 return; 1214 return;
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after
2026 } 2027 }
2027 } 2028 }
2028 DCHECK(!user_already_logged_in); 2029 DCHECK(!user_already_logged_in);
2029 2030
2030 if (!user_already_logged_in) { 2031 if (!user_already_logged_in) {
2031 UserContext user_context(user_id); 2032 UserContext user_context(user_id);
2032 user_context.SetUserIDHash(user_id_hash); 2033 user_context.SetUserIDHash(user_id_hash);
2033 user_context.SetIsUsingOAuth(false); 2034 user_context.SetIsUsingOAuth(false);
2034 // Will call OnProfilePrepared() once profile has been loaded. 2035 // Will call OnProfilePrepared() once profile has been loaded.
2035 LoginUtils::Get()->PrepareProfile(user_context, 2036 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
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
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/test_login_utils.cc ('k') | chrome/browser/chromeos/preferences.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698