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

Side by Side Diff: android_webview/browser/aw_cookie_access_policy.cc

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
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 #include "android_webview/browser/aw_cookie_access_policy.h"
6
7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h"
9 #include "content/public/browser/browser_thread.h"
10
11 using base::AutoLock;
12 using content::BrowserThread;
13
14 namespace android_webview {
15
16 namespace {
17 base::LazyInstance<AwCookieAccessPolicy>::Leaky g_lazy_instance;
18 } // namespace
19
20 AwCookieAccessPolicy::~AwCookieAccessPolicy() {
21 }
22
23 AwCookieAccessPolicy::AwCookieAccessPolicy()
24 : allow_access_(false) {
25 }
26
27 AwCookieAccessPolicy* AwCookieAccessPolicy::GetInstance() {
28 return g_lazy_instance.Pointer();
29 }
30
31 bool AwCookieAccessPolicy::GetGlobalAllowAccess() {
32 AutoLock lock(lock_);
33 return allow_access_;
34 }
35
36 void AwCookieAccessPolicy::SetGlobalAllowAccess(bool allow) {
37 AutoLock lock(lock_);
38 allow_access_ = allow;
39 }
40
41 bool AwCookieAccessPolicy::OnCanGetCookies(const net::URLRequest& request,
42 const net::CookieList& cookie_list) {
43 return GetGlobalAllowAccess();
44 }
45
46 bool AwCookieAccessPolicy::OnCanSetCookie(const net::URLRequest& request,
47 const std::string& cookie_line,
48 net::CookieOptions* options) {
49 return GetGlobalAllowAccess();
50 }
51
52 bool AwCookieAccessPolicy::AllowGetCookie(const GURL& url,
53 const GURL& first_party,
54 const net::CookieList& cookie_list,
55 content::ResourceContext* context,
56 int render_process_id,
57 int render_view_id) {
58 return GetGlobalAllowAccess();
59 }
60
61 bool AwCookieAccessPolicy::AllowSetCookie(const GURL& url,
62 const GURL& first_party,
63 const std::string& cookie_line,
64 content::ResourceContext* context,
65 int render_process_id,
66 int render_view_id,
67 net::CookieOptions* options) {
68 return GetGlobalAllowAccess();
69 }
70
71 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/browser/aw_cookie_access_policy.h ('k') | android_webview/browser/net/aw_network_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698