| 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 <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/chromeos/chromeos_version.h" | 10 #include "base/chromeos/chromeos_version.h" |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 } | 139 } |
| 140 | 140 |
| 141 // LoginUtils implementation: | 141 // LoginUtils implementation: |
| 142 virtual void DoBrowserLaunch(Profile* profile, | 142 virtual void DoBrowserLaunch(Profile* profile, |
| 143 LoginDisplayHost* login_host) OVERRIDE; | 143 LoginDisplayHost* login_host) OVERRIDE; |
| 144 virtual void PrepareProfile( | 144 virtual void PrepareProfile( |
| 145 const UserContext& user_context, | 145 const UserContext& user_context, |
| 146 const std::string& display_email, | 146 const std::string& display_email, |
| 147 bool using_oauth, | 147 bool using_oauth, |
| 148 bool has_cookies, | 148 bool has_cookies, |
| 149 bool has_active_session, |
| 149 LoginUtils::Delegate* delegate) OVERRIDE; | 150 LoginUtils::Delegate* delegate) OVERRIDE; |
| 150 virtual void DelegateDeleted(LoginUtils::Delegate* delegate) OVERRIDE; | 151 virtual void DelegateDeleted(LoginUtils::Delegate* delegate) OVERRIDE; |
| 151 virtual void CompleteOffTheRecordLogin(const GURL& start_url) OVERRIDE; | 152 virtual void CompleteOffTheRecordLogin(const GURL& start_url) OVERRIDE; |
| 152 virtual void SetFirstLoginPrefs(PrefService* prefs) OVERRIDE; | 153 virtual void SetFirstLoginPrefs(PrefService* prefs) OVERRIDE; |
| 153 virtual scoped_refptr<Authenticator> CreateAuthenticator( | 154 virtual scoped_refptr<Authenticator> CreateAuthenticator( |
| 154 LoginStatusConsumer* consumer) OVERRIDE; | 155 LoginStatusConsumer* consumer) OVERRIDE; |
| 155 virtual void PrewarmAuthentication() OVERRIDE; | 156 virtual void PrewarmAuthentication() OVERRIDE; |
| 156 virtual void RestoreAuthenticationSession(Profile* profile) OVERRIDE; | 157 virtual void RestoreAuthenticationSession(Profile* profile) OVERRIDE; |
| 157 virtual void StopBackgroundFetchers() OVERRIDE; | 158 virtual void StopBackgroundFetchers() OVERRIDE; |
| 158 virtual void InitRlzDelayed(Profile* user_profile) OVERRIDE; | 159 virtual void InitRlzDelayed(Profile* user_profile) OVERRIDE; |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 if (login_host) | 314 if (login_host) |
| 314 login_host->OnSessionStart(); | 315 login_host->OnSessionStart(); |
| 315 UserManager::Get()->SessionStarted(); | 316 UserManager::Get()->SessionStarted(); |
| 316 } | 317 } |
| 317 | 318 |
| 318 void LoginUtilsImpl::PrepareProfile( | 319 void LoginUtilsImpl::PrepareProfile( |
| 319 const UserContext& user_context, | 320 const UserContext& user_context, |
| 320 const std::string& display_email, | 321 const std::string& display_email, |
| 321 bool using_oauth, | 322 bool using_oauth, |
| 322 bool has_cookies, | 323 bool has_cookies, |
| 324 bool has_active_session, |
| 323 LoginUtils::Delegate* delegate) { | 325 LoginUtils::Delegate* delegate) { |
| 324 BootTimesLoader* btl = BootTimesLoader::Get(); | 326 BootTimesLoader* btl = BootTimesLoader::Get(); |
| 325 | 327 |
| 326 VLOG(1) << "Completing login for " << user_context.username; | 328 VLOG(1) << "Completing login for " << user_context.username; |
| 327 | 329 |
| 328 btl->AddLoginTimeMarker("StartSession-Start", false); | 330 if (!has_active_session) { |
| 329 DBusThreadManager::Get()->GetSessionManagerClient()->StartSession( | 331 btl->AddLoginTimeMarker("StartSession-Start", false); |
| 330 user_context.username); | 332 DBusThreadManager::Get()->GetSessionManagerClient()->StartSession( |
| 331 btl->AddLoginTimeMarker("StartSession-End", false); | 333 user_context.username); |
| 334 btl->AddLoginTimeMarker("StartSession-End", false); |
| 335 } |
| 332 | 336 |
| 333 btl->AddLoginTimeMarker("UserLoggedIn-Start", false); | 337 btl->AddLoginTimeMarker("UserLoggedIn-Start", false); |
| 334 UserManager* user_manager = UserManager::Get(); | 338 UserManager* user_manager = UserManager::Get(); |
| 335 user_manager->UserLoggedIn(user_context.username, | 339 user_manager->UserLoggedIn(user_context.username, |
| 336 user_context.username_hash, | 340 user_context.username_hash, |
| 337 false); | 341 false); |
| 338 btl->AddLoginTimeMarker("UserLoggedIn-End", false); | 342 btl->AddLoginTimeMarker("UserLoggedIn-End", false); |
| 339 | 343 |
| 340 // Switch log file as soon as possible. | 344 // Switch log file as soon as possible. |
| 341 if (base::chromeos::IsRunningOnChromeOS()) | 345 if (base::chromeos::IsRunningOnChromeOS()) |
| (...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 912 bool LoginUtils::IsWhitelisted(const std::string& username) { | 916 bool LoginUtils::IsWhitelisted(const std::string& username) { |
| 913 CrosSettings* cros_settings = CrosSettings::Get(); | 917 CrosSettings* cros_settings = CrosSettings::Get(); |
| 914 bool allow_new_user = false; | 918 bool allow_new_user = false; |
| 915 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); | 919 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); |
| 916 if (allow_new_user) | 920 if (allow_new_user) |
| 917 return true; | 921 return true; |
| 918 return cros_settings->FindEmailInList(kAccountsPrefUsers, username); | 922 return cros_settings->FindEmailInList(kAccountsPrefUsers, username); |
| 919 } | 923 } |
| 920 | 924 |
| 921 } // namespace chromeos | 925 } // namespace chromeos |
| OLD | NEW |