| 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 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 #include "core/dom/Document.h" | 34 #include "core/dom/Document.h" |
| 35 #include "core/frame/LocalFrame.h" | 35 #include "core/frame/LocalFrame.h" |
| 36 #include "core/loader/FrameLoaderClient.h" | 36 #include "core/loader/FrameLoaderClient.h" |
| 37 #include "public/platform/Platform.h" | 37 #include "public/platform/Platform.h" |
| 38 #include "public/platform/WebCookieJar.h" | 38 #include "public/platform/WebCookieJar.h" |
| 39 #include "public/platform/WebURL.h" | 39 #include "public/platform/WebURL.h" |
| 40 | 40 |
| 41 namespace blink { | 41 namespace blink { |
| 42 | 42 |
| 43 static blink::WebCookieJar* toCookieJar(const Document* document) | 43 static WebCookieJar* toCookieJar(const Document* document) |
| 44 { | 44 { |
| 45 if (!document || !document->frame()) | 45 if (!document || !document->frame()) |
| 46 return 0; | 46 return 0; |
| 47 return document->frame()->loader().client()->cookieJar(); | 47 return document->frame()->loader().client()->cookieJar(); |
| 48 } | 48 } |
| 49 | 49 |
| 50 String cookies(const Document* document, const KURL& url) | 50 String cookies(const Document* document, const KURL& url) |
| 51 { | 51 { |
| 52 blink::WebCookieJar* cookieJar = toCookieJar(document); | 52 WebCookieJar* cookieJar = toCookieJar(document); |
| 53 if (!cookieJar) | 53 if (!cookieJar) |
| 54 return String(); | 54 return String(); |
| 55 return cookieJar->cookies(url, document->firstPartyForCookies()); | 55 return cookieJar->cookies(url, document->firstPartyForCookies()); |
| 56 } | 56 } |
| 57 | 57 |
| 58 void setCookies(Document* document, const KURL& url, const String& cookieString) | 58 void setCookies(Document* document, const KURL& url, const String& cookieString) |
| 59 { | 59 { |
| 60 blink::WebCookieJar* cookieJar = toCookieJar(document); | 60 WebCookieJar* cookieJar = toCookieJar(document); |
| 61 if (!cookieJar) | 61 if (!cookieJar) |
| 62 return; | 62 return; |
| 63 cookieJar->setCookie(url, document->firstPartyForCookies(), cookieString); | 63 cookieJar->setCookie(url, document->firstPartyForCookies(), cookieString); |
| 64 } | 64 } |
| 65 | 65 |
| 66 bool cookiesEnabled(const Document* document) | 66 bool cookiesEnabled(const Document* document) |
| 67 { | 67 { |
| 68 blink::WebCookieJar* cookieJar = toCookieJar(document); | 68 WebCookieJar* cookieJar = toCookieJar(document); |
| 69 if (!cookieJar) | 69 if (!cookieJar) |
| 70 return false; | 70 return false; |
| 71 return cookieJar->cookiesEnabled(document->cookieURL(), document->firstParty
ForCookies()); | 71 return cookieJar->cookiesEnabled(document->cookieURL(), document->firstParty
ForCookies()); |
| 72 } | 72 } |
| 73 | 73 |
| 74 String cookieRequestHeaderFieldValue(const Document* document, const KURL& url) | 74 String cookieRequestHeaderFieldValue(const Document* document, const KURL& url) |
| 75 { | 75 { |
| 76 blink::WebCookieJar* cookieJar = toCookieJar(document); | 76 WebCookieJar* cookieJar = toCookieJar(document); |
| 77 if (!cookieJar) | 77 if (!cookieJar) |
| 78 return String(); | 78 return String(); |
| 79 return cookieJar->cookieRequestHeaderFieldValue(url, document->firstPartyFor
Cookies()); | 79 return cookieJar->cookieRequestHeaderFieldValue(url, document->firstPartyFor
Cookies()); |
| 80 } | 80 } |
| 81 | 81 |
| 82 } | 82 } // namespace blink |
| OLD | NEW |