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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 ANDROID_WEBVIEW_BROWSER_AW_COOKIE_ACCESS_POLICY_H_
6 #define ANDROID_WEBVIEW_BROWSER_AW_COOKIE_ACCESS_POLICY_H_
7
8 #include "base/basictypes.h"
9 #include "base/lazy_instance.h"
10 #include "base/synchronization/lock.h"
11 #include "net/cookies/canonical_cookie.h"
12
13 namespace content {
14 class ResourceContext;
15 }
16
17 namespace net {
18 class CookieOptions;
19 class URLRequest;
20 }
21
22 class GURL;
23
24 namespace android_webview {
25
26 // Manages the cookie access (both setting and getting) policy for WebView.
27 class AwCookieAccessPolicy {
28 public:
29 static AwCookieAccessPolicy* GetInstance();
30
31 // These manage the global access state shared across requests regardless of
32 // source (i.e. network or JavaScript).
33 bool GetGlobalAllowAccess();
34 void SetGlobalAllowAccess(bool allow);
35
36 // These are the functions called when operating over cookies from the
37 // network. See NetworkDelegate for further descriptions.
38 bool OnCanGetCookies(const net::URLRequest& request,
39 const net::CookieList& cookie_list);
40 bool OnCanSetCookie(const net::URLRequest& request,
41 const std::string& cookie_line,
42 net::CookieOptions* options);
43
44 // These are the functions called when operating over cookies from the
45 // renderer. See ContentBrowserClient for further descriptions.
46 bool AllowGetCookie(const GURL& url,
47 const GURL& first_party,
48 const net::CookieList& cookie_list,
49 content::ResourceContext* context,
50 int render_process_id,
51 int render_view_id);
52 bool AllowSetCookie(const GURL& url,
53 const GURL& first_party,
54 const std::string& cookie_line,
55 content::ResourceContext* context,
56 int render_process_id,
57 int render_view_id,
58 net::CookieOptions* options);
59
60 private:
61 friend struct base::DefaultLazyInstanceTraits<AwCookieAccessPolicy>;
62
63 AwCookieAccessPolicy();
64 ~AwCookieAccessPolicy();
65 bool allow_access_;
66 base::Lock lock_;
67
68 DISALLOW_COPY_AND_ASSIGN(AwCookieAccessPolicy);
69 };
70
71 } // namespace android_webview
72
73 #endif // ANDROID_WEBVIEW_BROWSER_AW_COOKIE_ACCESS_POLICY_H_
OLDNEW
« 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