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/login_utils.h" | 5 #include "chrome/browser/chromeos/login/login_utils.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
192 void UserProfileInitialized(Profile* user_profile); | 192 void UserProfileInitialized(Profile* user_profile); |
193 | 193 |
194 // Callback for Profile::CREATE_STATUS_INITIALIZED profile state for an OTR | 194 // Callback for Profile::CREATE_STATUS_INITIALIZED profile state for an OTR |
195 // login. | 195 // login. |
196 void OTRProfileInitialized(Profile* user_profile); | 196 void OTRProfileInitialized(Profile* user_profile); |
197 | 197 |
198 // Callback to resume profile creation after transferring auth data from | 198 // Callback to resume profile creation after transferring auth data from |
199 // the authentication profile. | 199 // the authentication profile. |
200 void CompleteProfileCreate(Profile* user_profile); | 200 void CompleteProfileCreate(Profile* user_profile); |
201 | 201 |
202 // Callback to resume profile preparing after start session | |
203 void onSessionStarted(const UserContext& user_context, | |
ygorshenin1
2014/04/10 15:39:22
Functions should start with a capital letter (http
Roman Sorokin (ftl)
2014/04/11 07:38:13
Done.
| |
204 const std::string& display_email, | |
205 bool has_cookies, | |
206 LoginUtils::Delegate* delegate, | |
207 bool success); | |
208 | |
209 // Complete profile preparation with having active session | |
210 void CompletePrepareProfileWithActiveSession( | |
211 const UserContext& user_context, | |
212 const std::string& display_email, | |
213 bool has_cookies, | |
214 LoginUtils::Delegate* delegate); | |
215 | |
202 // Finalized profile preparation. | 216 // Finalized profile preparation. |
203 void FinalizePrepareProfile(Profile* user_profile); | 217 void FinalizePrepareProfile(Profile* user_profile); |
204 | 218 |
205 // Initializes member variables needed for session restore process via | 219 // Initializes member variables needed for session restore process via |
206 // OAuthLoginManager. | 220 // OAuthLoginManager. |
207 void InitSessionRestoreStrategy(); | 221 void InitSessionRestoreStrategy(); |
208 | 222 |
209 // Restores GAIA auth cookies for the created user profile from OAuth2 token. | 223 // Restores GAIA auth cookies for the created user profile from OAuth2 token. |
210 void RestoreAuthSession(Profile* user_profile, | 224 void RestoreAuthSession(Profile* user_profile, |
211 bool restore_from_auth_cookies); | 225 bool restore_from_auth_cookies); |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
384 bool has_cookies, | 398 bool has_cookies, |
385 bool has_active_session, | 399 bool has_active_session, |
386 LoginUtils::Delegate* delegate) { | 400 LoginUtils::Delegate* delegate) { |
387 BootTimesLoader* btl = BootTimesLoader::Get(); | 401 BootTimesLoader* btl = BootTimesLoader::Get(); |
388 | 402 |
389 VLOG(1) << "Completing login for " << user_context.username; | 403 VLOG(1) << "Completing login for " << user_context.username; |
390 | 404 |
391 if (!has_active_session) { | 405 if (!has_active_session) { |
392 btl->AddLoginTimeMarker("StartSession-Start", false); | 406 btl->AddLoginTimeMarker("StartSession-Start", false); |
393 DBusThreadManager::Get()->GetSessionManagerClient()->StartSession( | 407 DBusThreadManager::Get()->GetSessionManagerClient()->StartSession( |
394 user_context.username); | 408 user_context.username, |
395 btl->AddLoginTimeMarker("StartSession-End", false); | 409 base::Bind(&LoginUtilsImpl::onSessionStarted, |
410 AsWeakPtr(), | |
411 user_context, | |
412 display_email, | |
413 has_cookies, | |
414 delegate)); | |
415 return; | |
396 } | 416 } |
417 CompletePrepareProfileWithActiveSession(user_context, | |
418 display_email, | |
419 has_cookies, | |
420 delegate); | |
421 } | |
397 | 422 |
423 void LoginUtilsImpl::onSessionStarted(const UserContext& user_context, | |
424 const std::string& display_email, | |
Nikita (slow)
2014/04/10 15:41:13
nit: Alignment should be fixed.
Roman Sorokin (ftl)
2014/04/11 07:38:13
Done.
| |
425 bool has_cookies, | |
426 LoginUtils::Delegate* delegate, | |
427 bool success) { | |
428 BootTimesLoader* btl = BootTimesLoader::Get(); | |
429 btl->AddLoginTimeMarker("StartSession-End", false); | |
430 | |
431 if (!success) { | |
432 LOG(ERROR) << "StartSession failed"; | |
433 chrome::AttemptUserExit(); | |
434 return; | |
435 } | |
436 CompletePrepareProfileWithActiveSession(user_context, | |
437 display_email, | |
438 has_cookies, | |
439 delegate); | |
440 } | |
441 | |
442 void LoginUtilsImpl::CompletePrepareProfileWithActiveSession( | |
443 const UserContext& user_context, | |
444 const std::string& display_email, | |
445 bool has_cookies, | |
446 LoginUtils::Delegate* delegate) { | |
447 BootTimesLoader* btl = BootTimesLoader::Get(); | |
398 btl->AddLoginTimeMarker("UserLoggedIn-Start", false); | 448 btl->AddLoginTimeMarker("UserLoggedIn-Start", false); |
399 UserManager* user_manager = UserManager::Get(); | 449 UserManager* user_manager = UserManager::Get(); |
400 user_manager->UserLoggedIn(user_context.username, | 450 user_manager->UserLoggedIn(user_context.username, |
401 user_context.username_hash, | 451 user_context.username_hash, |
402 false); | 452 false); |
403 btl->AddLoginTimeMarker("UserLoggedIn-End", false); | 453 btl->AddLoginTimeMarker("UserLoggedIn-End", false); |
404 | 454 |
405 // Switch log file as soon as possible. | 455 // Switch log file as soon as possible. |
406 if (base::SysInfo::IsRunningOnChromeOS()) | 456 if (base::SysInfo::IsRunningOnChromeOS()) |
407 logging::RedirectChromeLogging(*(CommandLine::ForCurrentProcess())); | 457 logging::RedirectChromeLogging(*(CommandLine::ForCurrentProcess())); |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
948 CrosSettings* cros_settings = CrosSettings::Get(); | 998 CrosSettings* cros_settings = CrosSettings::Get(); |
949 bool allow_new_user = false; | 999 bool allow_new_user = false; |
950 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); | 1000 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); |
951 if (allow_new_user) | 1001 if (allow_new_user) |
952 return true; | 1002 return true; |
953 return cros_settings->FindEmailInList( | 1003 return cros_settings->FindEmailInList( |
954 kAccountsPrefUsers, username, wildcard_match); | 1004 kAccountsPrefUsers, username, wildcard_match); |
955 } | 1005 } |
956 | 1006 |
957 } // namespace chromeos | 1007 } // namespace chromeos |
OLD | NEW |