| 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) { | |
| 137 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | |
| 138 net::CookieStore* new_store = | 132 net::CookieStore* new_store = |
| 139 new_context_->GetURLRequestContext()->cookie_store(); | 133 new_context_->GetURLRequestContext()->cookie_store(); |
| 140 net::CookieMonster* new_monster = new_store->GetCookieMonster(); | 134 net::CookieMonster* new_monster = new_store->GetCookieMonster(); |
| 141 | 135 |
| 142 if (!new_monster->InitializeFrom(cookies)) { | 136 if (!new_monster->InitializeFrom(default_monster)) { |
| 143 LOG(WARNING) << "Failed initial cookie transfer."; | 137 LOG(WARNING) << "Failed initial cookie transfer."; |
| 144 } | 138 } |
| 145 } | 139 } |
| 146 | 140 |
| 147 private: | 141 private: |
| 148 net::URLRequestContextGetter* auth_context_; | 142 net::URLRequestContextGetter* auth_context_; |
| 149 Profile* new_profile_; | 143 Profile* new_profile_; |
| 150 net::URLRequestContextGetter* new_context_; | 144 net::URLRequestContextGetter* new_context_; |
| 151 | 145 |
| 152 DISALLOW_COPY_AND_ASSIGN(TransferDefaultCookiesOnIOThreadTask); | 146 DISALLOW_COPY_AND_ASSIGN(TransferDefaultCookiesOnIOThreadTask); |
| (...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 961 // Mark login host for deletion after browser starts. This | 955 // Mark login host for deletion after browser starts. This |
| 962 // guarantees that the message loop will be referenced by the | 956 // guarantees that the message loop will be referenced by the |
| 963 // browser before it is dereferenced by the login host. | 957 // browser before it is dereferenced by the login host. |
| 964 if (login_host) { | 958 if (login_host) { |
| 965 login_host->OnSessionStart(); | 959 login_host->OnSessionStart(); |
| 966 login_host = NULL; | 960 login_host = NULL; |
| 967 } | 961 } |
| 968 } | 962 } |
| 969 | 963 |
| 970 } // namespace chromeos | 964 } // namespace chromeos |
| OLD | NEW |