OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/signin/signin_manager_cookie_helper.h" | 5 #include "chrome/browser/signin/signin_manager_cookie_helper.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
10 #include "google_apis/gaia/gaia_urls.h" | 10 #include "google_apis/gaia/gaia_urls.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 BrowserThread::IO, FROM_HERE, | 33 BrowserThread::IO, FROM_HERE, |
34 base::Bind(&SigninManagerCookieHelper::FetchGaiaCookiesOnIOThread, this)); | 34 base::Bind(&SigninManagerCookieHelper::FetchGaiaCookiesOnIOThread, this)); |
35 } | 35 } |
36 | 36 |
37 void SigninManagerCookieHelper::FetchGaiaCookiesOnIOThread() { | 37 void SigninManagerCookieHelper::FetchGaiaCookiesOnIOThread() { |
38 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 38 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
39 | 39 |
40 scoped_refptr<net::CookieMonster> cookie_monster = | 40 scoped_refptr<net::CookieMonster> cookie_monster = |
41 request_context_getter_->GetURLRequestContext()-> | 41 request_context_getter_->GetURLRequestContext()-> |
42 cookie_store()->GetCookieMonster(); | 42 cookie_store()->GetCookieMonster(); |
43 if (cookie_monster) { | 43 if (cookie_monster.get()) { |
44 cookie_monster->GetAllCookiesForURLAsync( | 44 cookie_monster->GetAllCookiesForURLAsync( |
45 GaiaUrls::GetInstance()->gaia_url(), | 45 GaiaUrls::GetInstance()->gaia_url(), |
46 base::Bind(&SigninManagerCookieHelper::OnGaiaCookiesFetched, this)); | 46 base::Bind(&SigninManagerCookieHelper::OnGaiaCookiesFetched, this)); |
47 } else { | 47 } else { |
48 OnGaiaCookiesFetched(net::CookieList()); | 48 OnGaiaCookiesFetched(net::CookieList()); |
49 } | 49 } |
50 } | 50 } |
51 | 51 |
52 void SigninManagerCookieHelper::OnGaiaCookiesFetched( | 52 void SigninManagerCookieHelper::OnGaiaCookiesFetched( |
53 const net::CookieList& cookies) { | 53 const net::CookieList& cookies) { |
54 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 54 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
55 BrowserThread::PostTask( | 55 BrowserThread::PostTask( |
56 BrowserThread::UI, FROM_HERE, | 56 BrowserThread::UI, FROM_HERE, |
57 base::Bind(&SigninManagerCookieHelper::NotifyOnUIThread, this, cookies)); | 57 base::Bind(&SigninManagerCookieHelper::NotifyOnUIThread, this, cookies)); |
58 } | 58 } |
59 | 59 |
60 void SigninManagerCookieHelper::NotifyOnUIThread( | 60 void SigninManagerCookieHelper::NotifyOnUIThread( |
61 const net::CookieList& cookies) { | 61 const net::CookieList& cookies) { |
62 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 62 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
63 base::ResetAndReturn(&completion_callback_).Run(cookies); | 63 base::ResetAndReturn(&completion_callback_).Run(cookies); |
64 } | 64 } |
OLD | NEW |