Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Unified Diff: chrome/browser/chromeos/login/login_utils.cc

Issue 7541021: Update asynchronous CookieMonster API to login_utils. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/base/cookie_monster.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_,
« no previous file with comments | « no previous file | net/base/cookie_monster.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698