#ifndef ANDROID_WEBVIEW_BROWSER_AW_COOKIE_ACCESS_POLICY_H_
#define ANDROID_WEBVIEW_BROWSER_AW_COOKIE_ACCESS_POLICY_H_
#include "base/basictypes.h"
#include "base/lazy_instance.h"
#include "base/synchronization/lock.h"
#include "net/cookies/canonical_cookie.h"
namespace content {
class ResourceContext;
}
namespace net {
class CookieOptions;
class URLRequest;
}
class GURL;
namespace android_webview {
class AwCookieAccessPolicy {
public:
static AwCookieAccessPolicy* GetInstance();
bool GetGlobalAllowAccess();
void SetGlobalAllowAccess(bool allow);
bool OnCanGetCookies(const net::URLRequest& request,
const net::CookieList& cookie_list);
bool OnCanSetCookie(const net::URLRequest& request,
const std::string& cookie_line,
net::CookieOptions* options);
bool AllowGetCookie(const GURL& url,
const GURL& first_party,
const net::CookieList& cookie_list,
content::ResourceContext* context,
int render_process_id,
int render_frame_id);
bool AllowSetCookie(const GURL& url,
const GURL& first_party,
const std::string& cookie_line,
content::ResourceContext* context,
int render_process_id,
int render_frame_id,
net::CookieOptions* options);
private:
friend struct base::DefaultLazyInstanceTraits<AwCookieAccessPolicy>;
AwCookieAccessPolicy();
~AwCookieAccessPolicy();
bool allow_access_;
base::Lock lock_;
DISALLOW_COPY_AND_ASSIGN(AwCookieAccessPolicy);
};
}
#endif