| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/lock.h" | 10 #include "base/lock.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 }; | 132 }; |
| 133 | 133 |
| 134 void LoginUtilsImpl::CompleteLogin(const std::string& username, | 134 void LoginUtilsImpl::CompleteLogin(const std::string& username, |
| 135 const GaiaAuthConsumer::ClientLoginResult& credentials) { | 135 const GaiaAuthConsumer::ClientLoginResult& credentials) { |
| 136 | 136 |
| 137 LOG(INFO) << "Completing login for " << username; | 137 LOG(INFO) << "Completing login for " << username; |
| 138 | 138 |
| 139 if (CrosLibrary::Get()->EnsureLoaded()) | 139 if (CrosLibrary::Get()->EnsureLoaded()) |
| 140 CrosLibrary::Get()->GetLoginLibrary()->StartSession(username, ""); | 140 CrosLibrary::Get()->GetLoginLibrary()->StartSession(username, ""); |
| 141 | 141 |
| 142 const std::vector<UserManager::User>& users = UserManager::Get()->GetUsers(); | 142 bool first_login = !UserManager::Get()->IsKnownUser(username); |
| 143 | |
| 144 bool first_login = true; | |
| 145 for (std::vector<UserManager::User>::const_iterator it = users.begin(); | |
| 146 it < users.end(); ++it) { | |
| 147 std::string user_email = it->email(); | |
| 148 if (username == user_email) { | |
| 149 first_login = false; | |
| 150 break; | |
| 151 } | |
| 152 } | |
| 153 | |
| 154 UserManager::Get()->UserLoggedIn(username); | 143 UserManager::Get()->UserLoggedIn(username); |
| 155 | 144 |
| 156 // Now launch the initial browser window. | 145 // Now launch the initial browser window. |
| 157 FilePath user_data_dir; | 146 FilePath user_data_dir; |
| 158 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); | 147 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); |
| 159 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 148 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
| 160 // The default profile will have been changed because the ProfileManager | 149 // The default profile will have been changed because the ProfileManager |
| 161 // will process the notification that the UserManager sends out. | 150 // will process the notification that the UserManager sends out. |
| 162 Profile* profile = profile_manager->GetDefaultProfile(user_data_dir); | 151 Profile* profile = profile_manager->GetDefaultProfile(user_data_dir); |
| 163 | 152 |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 BrowserInit browser_init; | 296 BrowserInit browser_init; |
| 308 int return_code; | 297 int return_code; |
| 309 browser_init.LaunchBrowser(*CommandLine::ForCurrentProcess(), | 298 browser_init.LaunchBrowser(*CommandLine::ForCurrentProcess(), |
| 310 profile, | 299 profile, |
| 311 FilePath(), | 300 FilePath(), |
| 312 true, | 301 true, |
| 313 &return_code); | 302 &return_code); |
| 314 } | 303 } |
| 315 | 304 |
| 316 } // namespace chromeos | 305 } // namespace chromeos |
| OLD | NEW |