diff options
author | Elliott Slaughter <eds@google.com> | 2010-08-18 12:30:53 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-08-18 12:30:53 -0700 |
commit | c2734c93736c8d81f71459461411114e7cb6b44f (patch) | |
tree | 8b14cd634497eb32686ca0759ca9a7d4937a8286 | |
parent | 5fae6ab5a106cb38cb02978e2ab768de81a2cf41 (diff) | |
parent | 918f81255bd5490e0536420428111e71d31ae209 (diff) | |
download | external_webkit-c2734c93736c8d81f71459461411114e7cb6b44f.zip external_webkit-c2734c93736c8d81f71459461411114e7cb6b44f.tar.gz external_webkit-c2734c93736c8d81f71459461411114e7cb6b44f.tar.bz2 |
Merge "Fix for incognito mode cookies from WebCore."
-rw-r--r-- | WebCore/platform/android/PlatformBridge.h | 7 | ||||
-rw-r--r-- | WebCore/platform/network/android/CookieJarAndroid.cpp | 16 | ||||
-rw-r--r-- | WebKit/android/WebCoreSupport/PlatformBridge.cpp | 22 |
3 files changed, 29 insertions, 16 deletions
diff --git a/WebCore/platform/android/PlatformBridge.h b/WebCore/platform/android/PlatformBridge.h index e8722e2..4eeaa6c 100644 --- a/WebCore/platform/android/PlatformBridge.h +++ b/WebCore/platform/android/PlatformBridge.h @@ -81,6 +81,7 @@ class NPObject; namespace WebCore { +class Document; class FrameView; class Widget; @@ -100,9 +101,9 @@ public: static WTF::Vector<String> getSupportedKeyStrengthList(); static String getSignedPublicKeyAndChallengeString(unsigned index, const String& challenge, const KURL&); // Cookies - static void setCookies(const KURL&, const String& value); - static String cookies(const KURL&); - static bool cookiesEnabled(); + static void setCookies(const Document*, const KURL&, const String& value); + static String cookies(const Document*, const KURL&); + static bool cookiesEnabled(const Document*); // Plugin static NPObject* pluginScriptableObject(Widget*); // Popups diff --git a/WebCore/platform/network/android/CookieJarAndroid.cpp b/WebCore/platform/network/android/CookieJarAndroid.cpp index dd324c5..f3b343e 100644 --- a/WebCore/platform/network/android/CookieJarAndroid.cpp +++ b/WebCore/platform/network/android/CookieJarAndroid.cpp @@ -31,25 +31,25 @@ namespace WebCore { -void setCookies(Document*, const KURL& url, const String& value) +void setCookies(Document* document, const KURL& url, const String& value) { - PlatformBridge::setCookies(url, value); + PlatformBridge::setCookies(document, url, value); } -String cookies(const Document*, const KURL& url) +String cookies(const Document* document, const KURL& url) { - return PlatformBridge::cookies(url); + return PlatformBridge::cookies(document, url); } -String cookieRequestHeaderFieldValue(const Document*, const KURL& url) +String cookieRequestHeaderFieldValue(const Document* document, const KURL& url) { // FIXME: include HttpOnly cookie. - return PlatformBridge::cookies(url); + return PlatformBridge::cookies(document, url); } -bool cookiesEnabled(const Document*) +bool cookiesEnabled(const Document* document) { - return PlatformBridge::cookiesEnabled(); + return PlatformBridge::cookiesEnabled(document); } } diff --git a/WebKit/android/WebCoreSupport/PlatformBridge.cpp b/WebKit/android/WebCoreSupport/PlatformBridge.cpp index 31e3101..754e4d9 100644 --- a/WebKit/android/WebCoreSupport/PlatformBridge.cpp +++ b/WebKit/android/WebCoreSupport/PlatformBridge.cpp @@ -27,11 +27,13 @@ #include <PlatformBridge.h> #include "CookieClient.h" +#include "Document.h" #include "FileSystemClient.h" #include "FrameView.h" #include "JavaSharedClient.h" #include "KeyGeneratorClient.h" #include "PluginView.h" +#include "Settings.h" #include "WebCoreFrameBridge.h" #include "WebRequestContext.h" #include "WebViewCore.h" @@ -61,12 +63,17 @@ String PlatformBridge::getSignedPublicKeyAndChallengeString(unsigned index, cons return client->getSignedPublicKeyAndChallengeString(index, challenge, url); } -void PlatformBridge::setCookies(const KURL& url, const String& value) +void PlatformBridge::setCookies(const Document* document, const KURL& url, const String& value) { #if USE(CHROME_NETWORK_STACK) std::string cookieValue(value.utf8().data()); GURL cookieGurl(url.string().utf8().data()); - WebRequestContext::GetAndroidContext()->cookie_store()->SetCookie(cookieGurl ,cookieValue); + WebRequestContext* androidContext; + if (document->settings() && document->settings()->privateBrowsingEnabled()) + androidContext = WebRequestContext::GetAndroidPrivateBrowsingContext(); + else + androidContext = WebRequestContext::GetAndroidContext(); + androidContext->cookie_store()->SetCookie(cookieGurl, cookieValue); #else CookieClient* client = JavaSharedClient::GetCookieClient(); if (!client) @@ -76,11 +83,16 @@ void PlatformBridge::setCookies(const KURL& url, const String& value) #endif } -String PlatformBridge::cookies(const KURL& url) +String PlatformBridge::cookies(const Document* document, const KURL& url) { #if USE(CHROME_NETWORK_STACK) GURL cookieGurl(url.string().utf8().data()); - std::string cookies = WebRequestContext::GetAndroidContext()->cookie_store()->GetCookies(cookieGurl); + WebRequestContext* androidContext; + if (document->settings() && document->settings()->privateBrowsingEnabled()) + androidContext = WebRequestContext::GetAndroidPrivateBrowsingContext(); + else + androidContext = WebRequestContext::GetAndroidContext(); + std::string cookies = androidContext->cookie_store()->GetCookies(cookieGurl); String cookieString(cookies.c_str()); return cookieString; #else @@ -92,7 +104,7 @@ String PlatformBridge::cookies(const KURL& url) #endif } -bool PlatformBridge::cookiesEnabled() +bool PlatformBridge::cookiesEnabled(const Document* document) { CookieClient* client = JavaSharedClient::GetCookieClient(); if (!client) |