| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 #include "core/loader/CookieJar.h" | 32 #include "core/loader/CookieJar.h" |
| 33 | 33 |
| 34 #include "core/dom/Document.h" | 34 #include "core/dom/Document.h" |
| 35 #include "core/loader/FrameLoaderClient.h" |
| 35 #include "core/page/Frame.h" | 36 #include "core/page/Frame.h" |
| 36 #include "core/platform/Cookie.h" | 37 #include "core/platform/Cookie.h" |
| 37 #include "core/platform/network/NetworkingContext.h" | |
| 38 #include "public/platform/Platform.h" | 38 #include "public/platform/Platform.h" |
| 39 #include "public/platform/WebCookie.h" | 39 #include "public/platform/WebCookie.h" |
| 40 #include "public/platform/WebCookieJar.h" | 40 #include "public/platform/WebCookieJar.h" |
| 41 #include "public/platform/WebURL.h" | 41 #include "public/platform/WebURL.h" |
| 42 #include "public/platform/WebVector.h" | 42 #include "public/platform/WebVector.h" |
| 43 | 43 |
| 44 namespace WebCore { | 44 namespace WebCore { |
| 45 | 45 |
| 46 static WebKit::WebCookieJar* toCookieJar(const Document* document) | 46 static WebKit::WebCookieJar* toCookieJar(const Document* document) |
| 47 { | 47 { |
| 48 if (!document || !document->frame()) | 48 if (!document || !document->frame()) |
| 49 return 0; | 49 return 0; |
| 50 return document->frame()->loader()->networkingContext()->cookieJar(); | 50 WebKit::WebCookieJar* cookieJar = document->frame()->loader()->client()->coo
kieJar(); |
| 51 // FIXME: DRT depends on being able to get a cookie jar from Platform rather
than |
| 52 // FrameLoaderClient. Delete this when DRT is deleted. |
| 53 if (!cookieJar) |
| 54 cookieJar = WebKit::Platform::current()->cookieJar(); |
| 55 return cookieJar; |
| 51 } | 56 } |
| 52 | 57 |
| 53 String cookies(const Document* document, const KURL& url) | 58 String cookies(const Document* document, const KURL& url) |
| 54 { | 59 { |
| 55 WebKit::WebCookieJar* cookieJar = toCookieJar(document); | 60 WebKit::WebCookieJar* cookieJar = toCookieJar(document); |
| 56 if (!cookieJar) | 61 if (!cookieJar) |
| 57 return String(); | 62 return String(); |
| 58 return cookieJar->cookies(url, document->firstPartyForCookies()); | 63 return cookieJar->cookies(url, document->firstPartyForCookies()); |
| 59 } | 64 } |
| 60 | 65 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 | 105 |
| 101 void deleteCookie(const Document* document, const KURL& url, const String& cooki
eName) | 106 void deleteCookie(const Document* document, const KURL& url, const String& cooki
eName) |
| 102 { | 107 { |
| 103 WebKit::WebCookieJar* cookieJar = toCookieJar(document); | 108 WebKit::WebCookieJar* cookieJar = toCookieJar(document); |
| 104 if (!cookieJar) | 109 if (!cookieJar) |
| 105 return; | 110 return; |
| 106 cookieJar->deleteCookie(url, cookieName); | 111 cookieJar->deleteCookie(url, cookieName); |
| 107 } | 112 } |
| 108 | 113 |
| 109 } | 114 } |
| OLD | NEW |