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

Side by Side 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, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | net/base/cookie_monster.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 new_context_(new_context) {} 122 new_context_(new_context) {}
123 virtual ~TransferDefaultCookiesOnIOThreadTask() {} 123 virtual ~TransferDefaultCookiesOnIOThreadTask() {}
124 124
125 // Task override. 125 // Task override.
126 virtual void Run() { 126 virtual void Run() {
127 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 127 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
128 net::CookieStore* default_store = 128 net::CookieStore* default_store =
129 auth_context_->GetURLRequestContext()->cookie_store(); 129 auth_context_->GetURLRequestContext()->cookie_store();
130 net::CookieMonster* default_monster = default_store->GetCookieMonster(); 130 net::CookieMonster* default_monster = default_store->GetCookieMonster();
131 default_monster->SetKeepExpiredCookies(); 131 default_monster->SetKeepExpiredCookies();
132 default_monster->GetAllCookiesAsync(
133 base::Bind(
134 &TransferDefaultCookiesOnIOThreadTask::InitializeCookieMonster,
135 base::Unretained(this)));
136 }
137
138 void InitializeCookieMonster(const net::CookieList& cookies) {
139 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
132 net::CookieStore* new_store = 140 net::CookieStore* new_store =
133 new_context_->GetURLRequestContext()->cookie_store(); 141 new_context_->GetURLRequestContext()->cookie_store();
134 net::CookieMonster* new_monster = new_store->GetCookieMonster(); 142 net::CookieMonster* new_monster = new_store->GetCookieMonster();
135 143
136 if (!new_monster->InitializeFrom(default_monster)) { 144 if (!new_monster->InitializeFrom(cookies)) {
137 LOG(WARNING) << "Failed initial cookie transfer."; 145 LOG(WARNING) << "Failed initial cookie transfer.";
138 } 146 }
139 } 147 }
140 148
141 private: 149 private:
142 net::URLRequestContextGetter* auth_context_; 150 net::URLRequestContextGetter* auth_context_;
143 Profile* new_profile_; 151 Profile* new_profile_;
144 net::URLRequestContextGetter* new_context_; 152 net::URLRequestContextGetter* new_context_;
145 153
146 DISALLOW_COPY_AND_ASSIGN(TransferDefaultCookiesOnIOThreadTask); 154 DISALLOW_COPY_AND_ASSIGN(TransferDefaultCookiesOnIOThreadTask);
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after
955 // Mark login host for deletion after browser starts. This 963 // Mark login host for deletion after browser starts. This
956 // guarantees that the message loop will be referenced by the 964 // guarantees that the message loop will be referenced by the
957 // browser before it is dereferenced by the login host. 965 // browser before it is dereferenced by the login host.
958 if (login_host) { 966 if (login_host) {
959 login_host->OnSessionStart(); 967 login_host->OnSessionStart();
960 login_host = NULL; 968 login_host = NULL;
961 } 969 }
962 } 970 }
963 971
964 } // namespace chromeos 972 } // namespace chromeos
OLDNEW
« 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