| 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 "content/browser/android/cookie_getter_impl.h" | 5 #include "content/browser/android/cookie_getter_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "content/browser/child_process_security_policy_impl.h" | 8 #include "content/browser/child_process_security_policy_impl.h" |
| 9 #include "content/public/browser/browser_context.h" | 9 #include "content/public/browser/browser_context.h" |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 } | 27 } |
| 28 | 28 |
| 29 // The task object that retrieves cookie on the IO thread. | 29 // The task object that retrieves cookie on the IO thread. |
| 30 // TODO(qinmin): refactor this class to make the code reusable by others as | 30 // TODO(qinmin): refactor this class to make the code reusable by others as |
| 31 // there are lots of duplicated functionalities elsewhere. | 31 // there are lots of duplicated functionalities elsewhere. |
| 32 class CookieGetterTask | 32 class CookieGetterTask |
| 33 : public base::RefCountedThreadSafe<CookieGetterTask> { | 33 : public base::RefCountedThreadSafe<CookieGetterTask> { |
| 34 public: | 34 public: |
| 35 CookieGetterTask(BrowserContext* browser_context, | 35 CookieGetterTask(BrowserContext* browser_context, |
| 36 int renderer_id, int routing_id); | 36 int renderer_id, int routing_id); |
| 37 virtual ~CookieGetterTask(); | |
| 38 | 37 |
| 39 // Called by CookieGetterImpl to start getting cookies for a URL. | 38 // Called by CookieGetterImpl to start getting cookies for a URL. |
| 40 void RequestCookies( | 39 void RequestCookies( |
| 41 const GURL& url, const GURL& first_party_for_cookies, | 40 const GURL& url, const GURL& first_party_for_cookies, |
| 42 const media::CookieGetter::GetCookieCB& callback); | 41 const media::CookieGetter::GetCookieCB& callback); |
| 43 | 42 |
| 44 private: | 43 private: |
| 44 friend class base::RefCountedThreadSafe<CookieGetterTask>; |
| 45 virtual ~CookieGetterTask(); |
| 46 |
| 45 void CheckPolicyForCookies( | 47 void CheckPolicyForCookies( |
| 46 const GURL& url, const GURL& first_party_for_cookies, | 48 const GURL& url, const GURL& first_party_for_cookies, |
| 47 const media::CookieGetter::GetCookieCB& callback, | 49 const media::CookieGetter::GetCookieCB& callback, |
| 48 const net::CookieList& cookie_list); | 50 const net::CookieList& cookie_list); |
| 49 | 51 |
| 50 // Context getter used to get the CookieStore. | 52 // Context getter used to get the CookieStore. |
| 51 net::URLRequestContextGetter* context_getter_; | 53 net::URLRequestContextGetter* context_getter_; |
| 52 | 54 |
| 53 // Resource context for checking cookie policies. | 55 // Resource context for checking cookie policies. |
| 54 ResourceContext* resource_context_; | 56 ResourceContext* resource_context_; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 base::Bind(&ReturnCookieOnUIThread, cb))); | 146 base::Bind(&ReturnCookieOnUIThread, cb))); |
| 145 } | 147 } |
| 146 | 148 |
| 147 void CookieGetterImpl::GetCookiesCallback( | 149 void CookieGetterImpl::GetCookiesCallback( |
| 148 const GetCookieCB& callback, const std::string& cookies) { | 150 const GetCookieCB& callback, const std::string& cookies) { |
| 149 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 151 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 150 callback.Run(cookies); | 152 callback.Run(cookies); |
| 151 } | 153 } |
| 152 | 154 |
| 153 } // namespace content | 155 } // namespace content |
| OLD | NEW |