OLD | NEW |
---|---|
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 Loading... | |
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(base::Bind(&InitializeCookieMonster, | |
133 base::Unretained(this))); | |
134 } | |
135 | |
136 void InitializeCookieMonster(const net::CookieList& cookies) { | |
zel
2011/08/04 16:01:07
put assert there that shows which thread is expect
ycxiao
2011/08/04 17:00:50
Done.
| |
132 net::CookieStore* new_store = | 137 net::CookieStore* new_store = |
133 new_context_->GetURLRequestContext()->cookie_store(); | 138 new_context_->GetURLRequestContext()->cookie_store(); |
134 net::CookieMonster* new_monster = new_store->GetCookieMonster(); | 139 net::CookieMonster* new_monster = new_store->GetCookieMonster(); |
135 | 140 |
136 if (!new_monster->InitializeFrom(default_monster)) { | 141 if (!new_monster->InitializeFrom(cookies)) { |
137 LOG(WARNING) << "Failed initial cookie transfer."; | 142 LOG(WARNING) << "Failed initial cookie transfer."; |
138 } | 143 } |
139 } | 144 } |
140 | 145 |
141 private: | 146 private: |
142 net::URLRequestContextGetter* auth_context_; | 147 net::URLRequestContextGetter* auth_context_; |
143 Profile* new_profile_; | 148 Profile* new_profile_; |
144 net::URLRequestContextGetter* new_context_; | 149 net::URLRequestContextGetter* new_context_; |
145 | 150 |
146 DISALLOW_COPY_AND_ASSIGN(TransferDefaultCookiesOnIOThreadTask); | 151 DISALLOW_COPY_AND_ASSIGN(TransferDefaultCookiesOnIOThreadTask); |
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
957 // Mark login host for deletion after browser starts. This | 962 // Mark login host for deletion after browser starts. This |
958 // guarantees that the message loop will be referenced by the | 963 // guarantees that the message loop will be referenced by the |
959 // browser before it is dereferenced by the login host. | 964 // browser before it is dereferenced by the login host. |
960 if (login_host) { | 965 if (login_host) { |
961 login_host->OnSessionStart(); | 966 login_host->OnSessionStart(); |
962 login_host = NULL; | 967 login_host = NULL; |
963 } | 968 } |
964 } | 969 } |
965 | 970 |
966 } // namespace chromeos | 971 } // namespace chromeos |
OLD | NEW |