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

Unified Diff: android_webview/browser/aw_cookie_access_policy.h

Issue 10913074: Add WebView implementation for CookieManager. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebased Created 8 years, 3 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
« no previous file with comments | « android_webview/android_webview.gyp ('k') | android_webview/browser/aw_cookie_access_policy.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
new file mode 100644
index 0000000000000000000000000000000000000000..b25e4f6ab3a2289d4f5e72452f49e37a6f7e07fd
--- /dev/null
+++ b/android_webview/browser/aw_cookie_access_policy.h
@@ -0,0 +1,73 @@
+// 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 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 {
+
+// Manages the cookie access (both setting and getting) policy for WebView.
+class AwCookieAccessPolicy {
+ public:
+ static AwCookieAccessPolicy* GetInstance();
+
+ // These manage the global access state shared across requests regardless of
+ // source (i.e. network or JavaScript).
+ bool GetGlobalAllowAccess();
+ void SetGlobalAllowAccess(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,
+ const net::CookieList& cookie_list);
+ bool OnCanSetCookie(const net::URLRequest& request,
+ const std::string& cookie_line,
+ net::CookieOptions* options);
+
+ // These are the functions called when operating over cookies from the
+ // renderer. See ContentBrowserClient for further descriptions.
+ bool AllowGetCookie(const GURL& url,
+ const GURL& first_party,
+ const net::CookieList& cookie_list,
+ content::ResourceContext* context,
+ int render_process_id,
+ int render_view_id);
+ bool AllowSetCookie(const GURL& url,
+ const GURL& first_party,
+ const std::string& cookie_line,
+ content::ResourceContext* context,
+ int render_process_id,
+ int render_view_id,
+ net::CookieOptions* options);
+
+ private:
+ friend struct base::DefaultLazyInstanceTraits<AwCookieAccessPolicy>;
+
+ AwCookieAccessPolicy();
+ ~AwCookieAccessPolicy();
+ bool allow_access_;
+ base::Lock lock_;
+
+ DISALLOW_COPY_AND_ASSIGN(AwCookieAccessPolicy);
+};
+
+} // namespace android_webview
+
+#endif // ANDROID_WEBVIEW_BROWSER_AW_COOKIE_ACCESS_POLICY_H_
« no previous file with comments | « android_webview/android_webview.gyp ('k') | android_webview/browser/aw_cookie_access_policy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698