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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: android_webview/browser/aw_cookie_access_policy.cc
diff --git a/android_webview/browser/aw_cookie_access_policy.cc b/android_webview/browser/aw_cookie_access_policy.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4809fdb5e89b24b06ff37359ac7d8523edbecf45
--- /dev/null
+++ b/android_webview/browser/aw_cookie_access_policy.cc
@@ -0,0 +1,71 @@
+// 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.
+
+#include "android_webview/browser/aw_cookie_access_policy.h"
+
+#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
+#include "content/public/browser/browser_thread.h"
+
+using base::AutoLock;
+using content::BrowserThread;
+
+namespace android_webview {
+
+namespace {
+base::LazyInstance<AwCookieAccessPolicy>::Leaky g_lazy_instance;
+} // namespace
+
+AwCookieAccessPolicy::~AwCookieAccessPolicy() {
+}
+
+AwCookieAccessPolicy::AwCookieAccessPolicy()
+ : allow_access_(false) {
+}
+
+AwCookieAccessPolicy* AwCookieAccessPolicy::GetInstance() {
+ return g_lazy_instance.Pointer();
+}
+
+bool AwCookieAccessPolicy::GetGlobalAllowAccess() {
+ AutoLock lock(lock_);
+ return allow_access_;
+}
+
+void AwCookieAccessPolicy::SetGlobalAllowAccess(bool allow) {
+ AutoLock lock(lock_);
+ allow_access_ = allow;
+}
+
+bool AwCookieAccessPolicy::OnCanGetCookies(const net::URLRequest& request,
+ const net::CookieList& cookie_list) {
+ return GetGlobalAllowAccess();
+}
+
+bool AwCookieAccessPolicy::OnCanSetCookie(const net::URLRequest& request,
+ const std::string& cookie_line,
+ net::CookieOptions* options) {
+ return GetGlobalAllowAccess();
+}
+
+bool AwCookieAccessPolicy::AllowGetCookie(const GURL& url,
+ const GURL& first_party,
+ const net::CookieList& cookie_list,
+ content::ResourceContext* context,
+ int render_process_id,
+ int render_view_id) {
+ return GetGlobalAllowAccess();
+}
+
+bool AwCookieAccessPolicy::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) {
+ return GetGlobalAllowAccess();
+}
+
+} // namespace android_webview
« 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