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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 // Supply credentials for sync and others to use. Load tokens from disk. | 174 // Supply credentials for sync and others to use. Load tokens from disk. |
175 TokenService* token_service = profile->GetTokenService(); | 175 TokenService* token_service = profile->GetTokenService(); |
176 token_service->Initialize(GaiaConstants::kChromeOSSource, | 176 token_service->Initialize(GaiaConstants::kChromeOSSource, |
177 profile); | 177 profile); |
178 token_service->LoadTokensFromDB(); | 178 token_service->LoadTokensFromDB(); |
179 token_service->UpdateCredentials(credentials); | 179 token_service->UpdateCredentials(credentials); |
180 if (token_service->AreCredentialsValid()) { | 180 if (token_service->AreCredentialsValid()) { |
181 token_service->StartFetchingTokens(); | 181 token_service->StartFetchingTokens(); |
182 } | 182 } |
183 | 183 |
| 184 // Set the CrOS user by getting this constructor run with the |
| 185 // user's email on first retrieval. |
| 186 profile->GetProfileSyncService(username); |
| 187 |
184 // Attempt to take ownership; this will fail if device is already owned. | 188 // Attempt to take ownership; this will fail if device is already owned. |
185 OwnershipService::GetSharedInstance()->StartTakeOwnershipAttempt(); | 189 OwnershipService::GetSharedInstance()->StartTakeOwnershipAttempt(); |
186 | 190 |
187 // Take the credentials passed in and try to exchange them for | 191 // Take the credentials passed in and try to exchange them for |
188 // full-fledged Google authentication cookies. This is | 192 // full-fledged Google authentication cookies. This is |
189 // best-effort; it's possible that we'll fail due to network | 193 // best-effort; it's possible that we'll fail due to network |
190 // troubles or some such. Either way, |cf| will call | 194 // troubles or some such. Either way, |cf| will call |
191 // DoBrowserLaunch on the UI thread when it's done, and then | 195 // DoBrowserLaunch on the UI thread when it's done, and then |
192 // delete itself. | 196 // delete itself. |
193 CookieFetcher* cf = new CookieFetcher(profile); | 197 CookieFetcher* cf = new CookieFetcher(profile); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 BrowserInit browser_init; | 316 BrowserInit browser_init; |
313 int return_code; | 317 int return_code; |
314 browser_init.LaunchBrowser(*CommandLine::ForCurrentProcess(), | 318 browser_init.LaunchBrowser(*CommandLine::ForCurrentProcess(), |
315 profile, | 319 profile, |
316 FilePath(), | 320 FilePath(), |
317 true, | 321 true, |
318 &return_code); | 322 &return_code); |
319 } | 323 } |
320 | 324 |
321 } // namespace chromeos | 325 } // namespace chromeos |
OLD | NEW |