| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "android_webview/browser/aw_cookie_access_policy.h" | 5 #include "android_webview/browser/aw_cookie_access_policy.h" |
| 6 | 6 |
| 7 #include <memory> |
| 8 |
| 7 #include "android_webview/browser/aw_contents_io_thread_client.h" | 9 #include "android_webview/browser/aw_contents_io_thread_client.h" |
| 8 | |
| 9 #include "base/logging.h" | 10 #include "base/logging.h" |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "content/public/browser/browser_thread.h" | 11 #include "content/public/browser/browser_thread.h" |
| 12 #include "content/public/browser/resource_request_info.h" | 12 #include "content/public/browser/resource_request_info.h" |
| 13 #include "net/base/net_errors.h" | 13 #include "net/base/net_errors.h" |
| 14 | 14 |
| 15 using base::AutoLock; | 15 using base::AutoLock; |
| 16 using content::BrowserThread; | 16 using content::BrowserThread; |
| 17 using content::ResourceRequestInfo; | 17 using content::ResourceRequestInfo; |
| 18 using net::StaticCookiePolicy; | 18 using net::StaticCookiePolicy; |
| 19 | 19 |
| 20 namespace android_webview { | 20 namespace android_webview { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 40 } | 40 } |
| 41 | 41 |
| 42 void AwCookieAccessPolicy::SetShouldAcceptCookies(bool allow) { | 42 void AwCookieAccessPolicy::SetShouldAcceptCookies(bool allow) { |
| 43 AutoLock lock(lock_); | 43 AutoLock lock(lock_); |
| 44 accept_cookies_ = allow; | 44 accept_cookies_ = allow; |
| 45 } | 45 } |
| 46 | 46 |
| 47 bool AwCookieAccessPolicy::GetShouldAcceptThirdPartyCookies( | 47 bool AwCookieAccessPolicy::GetShouldAcceptThirdPartyCookies( |
| 48 int render_process_id, | 48 int render_process_id, |
| 49 int render_frame_id) { | 49 int render_frame_id) { |
| 50 scoped_ptr<AwContentsIoThreadClient> io_thread_client = | 50 std::unique_ptr<AwContentsIoThreadClient> io_thread_client = |
| 51 AwContentsIoThreadClient::FromID(render_process_id, render_frame_id); | 51 AwContentsIoThreadClient::FromID(render_process_id, render_frame_id); |
| 52 if (!io_thread_client) { | 52 if (!io_thread_client) { |
| 53 return false; | 53 return false; |
| 54 } | 54 } |
| 55 return io_thread_client->ShouldAcceptThirdPartyCookies(); | 55 return io_thread_client->ShouldAcceptThirdPartyCookies(); |
| 56 } | 56 } |
| 57 | 57 |
| 58 bool AwCookieAccessPolicy::GetShouldAcceptThirdPartyCookies( | 58 bool AwCookieAccessPolicy::GetShouldAcceptThirdPartyCookies( |
| 59 const net::URLRequest& request) { | 59 const net::URLRequest& request) { |
| 60 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(&request); | 60 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(&request); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 net::OK; | 136 net::OK; |
| 137 } | 137 } |
| 138 | 138 |
| 139 bool AwStaticCookiePolicy::AllowGet(const GURL& url, | 139 bool AwStaticCookiePolicy::AllowGet(const GURL& url, |
| 140 const GURL& first_party) const { | 140 const GURL& first_party) const { |
| 141 return StaticCookiePolicy(GetPolicy(url)).CanGetCookies(url, first_party) == | 141 return StaticCookiePolicy(GetPolicy(url)).CanGetCookies(url, first_party) == |
| 142 net::OK; | 142 net::OK; |
| 143 } | 143 } |
| 144 | 144 |
| 145 } // namespace android_webview | 145 } // namespace android_webview |
| OLD | NEW |