| Index: content/browser/android/cookie_getter_impl.h
|
| diff --git a/content/browser/android/cookie_getter_impl.h b/content/browser/android/cookie_getter_impl.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..57154fe62fc9ec42738f6f2d43bcb90e362560d4
|
| --- /dev/null
|
| +++ b/content/browser/android/cookie_getter_impl.h
|
| @@ -0,0 +1,50 @@
|
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef CONTENT_BROWSER_ANDROID_COOKIE_GETTER_IMPL_H_
|
| +#define CONTENT_BROWSER_ANDROID_COOKIE_GETTER_IMPL_H_
|
| +
|
| +#include <string>
|
| +
|
| +#include "base/memory/weak_ptr.h"
|
| +#include "media/base/android/cookie_getter.h"
|
| +
|
| +namespace net {
|
| +class URLRequestContextGetter;
|
| +}
|
| +
|
| +namespace content {
|
| +
|
| +// This class implements media::CookieGetter to retrive cookies
|
| +// asynchronously on the UI thread.
|
| +class CookieGetterImpl : public media::CookieGetter {
|
| + public:
|
| + // Construct a CookieGetterImpl by passing a URLRequestContextGetter object
|
| + // to retrieve the CookieStore later.
|
| + explicit CookieGetterImpl(net::URLRequestContextGetter* context_getter);
|
| + virtual ~CookieGetterImpl();
|
| +
|
| + // media::CookieGetter implementation.
|
| + // Must be called on the UI thread.
|
| + virtual void GetCookies(
|
| + const std::string& url, const GetCookieCB& callback) OVERRIDE;
|
| +
|
| + private:
|
| + void GetCookiesCallback(
|
| + const std::string& cookies, const GetCookieCB& callback);
|
| + void RequestCookies(const std::string& url, const GetCookieCB& callback);
|
| + void ReturnCookies(const GetCookieCB& callback, const std::string& cookies);
|
| +
|
| + // Context getter used to get the CookieStore.
|
| + net::URLRequestContextGetter* context_getter_;
|
| +
|
| + // Used to post tasks.
|
| + base::WeakPtrFactory<CookieGetterImpl> weak_this_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(CookieGetterImpl);
|
| +};
|
| +
|
| +} // namespace content
|
| +
|
| +#endif // CONTENT_BROWSER_ANDROID_COOKIE_GETTER_IMPL_H_
|
|
|