diff options
author | hjd@chromium.org <hjd@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-29 19:01:02 +0000 |
---|---|---|
committer | hjd@chromium.org <hjd@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-29 19:01:02 +0000 |
commit | 41d70bd6049acc562fa0ff51bd3f7453d4969f07 (patch) | |
tree | 1433d7b4d2784f949529687f9f8761b8df85fee7 /android_webview/native | |
parent | 2b4e10f4dcd668a1e0ba3b800672e1ba4e6909de (diff) | |
download | chromium_src-41d70bd6049acc562fa0ff51bd3f7453d4969f07.zip chromium_src-41d70bd6049acc562fa0ff51bd3f7453d4969f07.tar.gz chromium_src-41d70bd6049acc562fa0ff51bd3f7453d4969f07.tar.bz2 |
Makes Third Party Cookie Settings per Aw
The third party bit of state is moved onto AwSettings.
AwCookiePolicy is split up in to a class which finds the right bits,
AwCookieAccessPolicy and AwStaticCookiePolicy which implements the
actual logic.
BUG=369496
TEST=AndroidWebviewTest
Review URL: https://codereview.chromium.org/288203002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@273528 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview/native')
-rw-r--r-- | android_webview/native/aw_contents.h | 3 | ||||
-rw-r--r-- | android_webview/native/aw_contents_io_thread_client_impl.cc | 10 | ||||
-rw-r--r-- | android_webview/native/aw_contents_io_thread_client_impl.h | 1 | ||||
-rw-r--r-- | android_webview/native/cookie_manager.cc | 40 |
4 files changed, 24 insertions, 30 deletions
diff --git a/android_webview/native/aw_contents.h b/android_webview/native/aw_contents.h index 679ebc8..5521567 100644 --- a/android_webview/native/aw_contents.h +++ b/android_webview/native/aw_contents.h @@ -160,6 +160,9 @@ class AwContents : public FindHelper::Listener, void ClearMatches(JNIEnv* env, jobject obj); FindHelper* GetFindHelper(); + // Per WebView Cookie Policy + bool AllowThirdPartyCookies(); + // FindHelper::Listener implementation. virtual void OnFindResultReceived(int active_ordinal, int match_count, diff --git a/android_webview/native/aw_contents_io_thread_client_impl.cc b/android_webview/native/aw_contents_io_thread_client_impl.cc index 555cd83..fd47138 100644 --- a/android_webview/native/aw_contents_io_thread_client_impl.cc +++ b/android_webview/native/aw_contents_io_thread_client_impl.cc @@ -273,6 +273,16 @@ bool AwContentsIoThreadClientImpl::ShouldBlockFileUrls() const { env, java_object_.obj()); } +bool AwContentsIoThreadClientImpl::ShouldAcceptThirdPartyCookies() const { + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); + if (java_object_.is_null()) + return false; + + JNIEnv* env = AttachCurrentThread(); + return Java_AwContentsIoThreadClient_shouldAcceptThirdPartyCookies( + env, java_object_.obj()); +} + bool AwContentsIoThreadClientImpl::ShouldBlockNetworkLoads() const { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); if (java_object_.is_null()) diff --git a/android_webview/native/aw_contents_io_thread_client_impl.h b/android_webview/native/aw_contents_io_thread_client_impl.h index e2561af..c783b2b 100644 --- a/android_webview/native/aw_contents_io_thread_client_impl.h +++ b/android_webview/native/aw_contents_io_thread_client_impl.h @@ -51,6 +51,7 @@ class AwContentsIoThreadClientImpl : public AwContentsIoThreadClient { const net::URLRequest* request) OVERRIDE; virtual bool ShouldBlockContentUrls() const OVERRIDE; virtual bool ShouldBlockFileUrls() const OVERRIDE; + virtual bool ShouldAcceptThirdPartyCookies() const OVERRIDE; virtual bool ShouldBlockNetworkLoads() const OVERRIDE; virtual void NewDownload(const GURL& url, const std::string& user_agent, diff --git a/android_webview/native/cookie_manager.cc b/android_webview/native/cookie_manager.cc index f47cf57..5d74418 100644 --- a/android_webview/native/cookie_manager.cc +++ b/android_webview/native/cookie_manager.cc @@ -147,10 +147,8 @@ class CookieManager { scoped_refptr<net::CookieStore> GetCookieStore(); - void SetAcceptCookie(bool accept); - bool AcceptCookie(); - void SetAcceptThirdPartyCookie(bool accept); - bool AcceptThirdPartyCookie(); + void SetShouldAcceptCookies(bool accept); + bool GetShouldAcceptCookies(); void SetCookie(const GURL& host, const std::string& cookie_value, scoped_ptr<BoolCookieCallbackHolder> callback); @@ -330,20 +328,12 @@ scoped_refptr<net::CookieStore> CookieManager::GetCookieStore() { return cookie_monster_; } -void CookieManager::SetAcceptCookie(bool accept) { - AwCookieAccessPolicy::GetInstance()->SetGlobalAllowAccess(accept); +void CookieManager::SetShouldAcceptCookies(bool accept) { + AwCookieAccessPolicy::GetInstance()->SetShouldAcceptCookies(accept); } -bool CookieManager::AcceptCookie() { - return AwCookieAccessPolicy::GetInstance()->GetGlobalAllowAccess(); -} - -void CookieManager::SetAcceptThirdPartyCookie(bool accept) { - AwCookieAccessPolicy::GetInstance()->SetThirdPartyAllowAccess(accept); -} - -bool CookieManager::AcceptThirdPartyCookie() { - return AwCookieAccessPolicy::GetInstance()->GetThirdPartyAllowAccess(); +bool CookieManager::GetShouldAcceptCookies() { + return AwCookieAccessPolicy::GetInstance()->GetShouldAcceptCookies(); } void CookieManager::SetCookie( @@ -529,22 +519,12 @@ void CookieManager::SetAcceptFileSchemeCookiesLocked(bool accept) { } // namespace -static void SetAcceptCookie(JNIEnv* env, jobject obj, jboolean accept) { - CookieManager::GetInstance()->SetAcceptCookie(accept); -} - -static jboolean AcceptCookie(JNIEnv* env, jobject obj) { - return CookieManager::GetInstance()->AcceptCookie(); -} - -static void SetAcceptThirdPartyCookie(JNIEnv* env, - jobject obj, - jboolean accept) { - CookieManager::GetInstance()->SetAcceptThirdPartyCookie(accept); +static void SetShouldAcceptCookies(JNIEnv* env, jobject obj, jboolean accept) { + CookieManager::GetInstance()->SetShouldAcceptCookies(accept); } -static jboolean AcceptThirdPartyCookie(JNIEnv* env, jobject obj) { - return CookieManager::GetInstance()->AcceptThirdPartyCookie(); +static jboolean GetShouldAcceptCookies(JNIEnv* env, jobject obj) { + return CookieManager::GetInstance()->GetShouldAcceptCookies(); } static void SetCookie(JNIEnv* env, |