Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2201)

Unified Diff: android_webview/browser/aw_cookie_access_policy.h

Issue 241143002: Allows AwCookieManager to block ThirdParty cookies (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix issues raised Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: android_webview/browser/aw_cookie_access_policy.h
diff --git a/android_webview/browser/aw_cookie_access_policy.h b/android_webview/browser/aw_cookie_access_policy.h
index 701452126c3a953d0293cae9e22f9a0858016563..7fd7b59b3a0483cb053139ae8f1c68251b4af834 100644
--- a/android_webview/browser/aw_cookie_access_policy.h
+++ b/android_webview/browser/aw_cookie_access_policy.h
@@ -8,7 +8,9 @@
#include "base/basictypes.h"
#include "base/lazy_instance.h"
#include "base/synchronization/lock.h"
+#include "net/base/static_cookie_policy.h"
#include "net/cookies/canonical_cookie.h"
+#include "net/url_request/url_request.h"
namespace content {
class ResourceContext;
@@ -16,7 +18,6 @@ class ResourceContext;
namespace net {
class CookieOptions;
-class URLRequest;
}
class GURL;
@@ -33,6 +34,11 @@ class AwCookieAccessPolicy {
bool GetGlobalAllowAccess();
void SetGlobalAllowAccess(bool allow);
+ // These allow more fine grained control over requests depending on whether
+ // the cookie is third party or not.
+ bool GetThirdPartyAllowAccess();
+ void SetThirdPartyAllowAccess(bool allow);
+
// These are the functions called when operating over cookies from the
// network. See NetworkDelegate for further descriptions.
bool OnCanGetCookies(const net::URLRequest& request,
@@ -63,8 +69,18 @@ class AwCookieAccessPolicy {
AwCookieAccessPolicy();
~AwCookieAccessPolicy();
bool allow_access_;
+ bool allow_third_party_access_;
base::Lock lock_;
+ // We have two bits of state but only three different cases:
+ // If !GlobalAllowAccess then reject all cookies.
+ // If GlobalAllowAccess and !ThirdPartyAllowAccess then reject third party.
+ // If GlobalAllowAccess and ThirdPartyAllowAccess then allow all cookies.
+ net::StaticCookiePolicy::Type GetPolicy(void);
+
+ bool AllowGet(const GURL& url, const GURL& first_party);
+ bool AllowSet(const GURL& url, const GURL& first_party);
+
DISALLOW_COPY_AND_ASSIGN(AwCookieAccessPolicy);
};

Powered by Google App Engine
This is Rietveld 408576698