Index: chrome/browser/chromeos/login/login_utils.cc |
=================================================================== |
--- chrome/browser/chromeos/login/login_utils.cc (revision 94320) |
+++ chrome/browser/chromeos/login/login_utils.cc (working copy) |
@@ -123,30 +123,42 @@ |
// Task override. |
virtual void Run() { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
- net::CookieStore* default_store = |
- auth_context_->GetURLRequestContext()->cookie_store(); |
- net::CookieMonster* default_monster = default_store->GetCookieMonster(); |
- default_monster->SetKeepExpiredCookies(); |
net::CookieStore* new_store = |
new_context_->GetURLRequestContext()->cookie_store(); |
net::CookieMonster* new_monster = new_store->GetCookieMonster(); |
+ new_monster->GetAllCookiesAsync(base::Bind(&HasCookie, |
+ base::Unretained(this))); |
+ } |
+ |
+ void HasCookie(const net::CookieList& existing_cookies) { |
zel
2011/08/03 21:44:04
the code changed here, we don't fetch two cookie l
|
// Check that existing store does not already have some cookies. |
// If it does, we are probably dealing with previously created profile |
// and no transfer will be necessary. |
// TOOD(zelidrag): Investigate perf impact of the next operation |
// in case when we have a profile with bunch of cookies. |
- net::CookieList existing_cookies = new_monster->GetAllCookies(); |
if (existing_cookies.size()) |
return; |
- if (!new_monster->InitializeFrom(default_monster)) { |
+ net::CookieStore* default_store = |
+ auth_context_->GetURLRequestContext()->cookie_store(); |
+ net::CookieMonster* default_monster = default_store->GetCookieMonster(); |
+ default_monster->GetAllCookiesAsync(base::Bind(&InitializeCookieMonster, |
+ base::Unretained(this))); |
+ } |
+ |
+ void InitializeCookieMonster(const net::CookieList& cookies) { |
+ net::CookieStore* new_store = |
+ new_context_->GetURLRequestContext()->cookie_store(); |
+ net::CookieMonster* new_monster = new_store->GetCookieMonster(); |
+ |
+ if (!new_monster->InitializeFrom(cookies)) { |
LOG(WARNING) << "Failed initial cookie transfer."; |
} |
// TODO(zelidrag): Once sync is OAuth happy, remove this part. |
GaiaAuthConsumer::ClientLoginResult credentials; |
- GetCredentialsFromCookieJar(default_monster->GetAllCookies(), &credentials); |
+ GetCredentialsFromCookieJar(cookies, &credentials); |
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
new FetchTokensOnUIThreadTask( |
new_profile_, |