| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_ANDROID_COOKIE_GETTER_IMPL_H_ |
| 6 #define CONTENT_BROWSER_ANDROID_COOKIE_GETTER_IMPL_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/memory/weak_ptr.h" |
| 11 #include "media/base/android/cookie_getter.h" |
| 12 |
| 13 namespace net { |
| 14 class URLRequestContextGetter; |
| 15 } |
| 16 |
| 17 namespace content { |
| 18 |
| 19 // This class implements media::CookieGetter to retrive cookies |
| 20 // asynchronously on the UI thread. |
| 21 class CookieGetterImpl : public media::CookieGetter { |
| 22 public: |
| 23 // Construct a CookieGetterImpl by passing a URLRequestContextGetter object |
| 24 // to retrieve the CookieStore later. |
| 25 explicit CookieGetterImpl(net::URLRequestContextGetter* context_getter); |
| 26 virtual ~CookieGetterImpl(); |
| 27 |
| 28 // media::CookieGetter implementation. |
| 29 // Must be called on the UI thread. |
| 30 virtual void GetCookies( |
| 31 const std::string& url, const GetCookieCB& callback) OVERRIDE; |
| 32 |
| 33 private: |
| 34 void GetCookiesCallback( |
| 35 const std::string& cookies, const GetCookieCB& callback); |
| 36 void RequestCookies(const std::string& url, const GetCookieCB& callback); |
| 37 void ReturnCookies(const GetCookieCB& callback, const std::string& cookies); |
| 38 |
| 39 // Context getter used to get the CookieStore. |
| 40 net::URLRequestContextGetter* context_getter_; |
| 41 |
| 42 // Used to post tasks. |
| 43 base::WeakPtrFactory<CookieGetterImpl> weak_this_; |
| 44 |
| 45 DISALLOW_COPY_AND_ASSIGN(CookieGetterImpl); |
| 46 }; |
| 47 |
| 48 } // namespace content |
| 49 |
| 50 #endif // CONTENT_BROWSER_ANDROID_COOKIE_GETTER_IMPL_H_ |
| OLD | NEW |