Changeset 135013 in webkit


Ignore:
Timestamp:
Nov 16, 2012, 3:52:37 PM (12 years ago)
Author:
pilgrim@chromium.org
Message:

[Chromium] Remove cookie-related functions from PlatformSupport
https://bugs.webkit.org/show_bug.cgi?id=99340

Reviewed by Adam Barth.

Move cookie-related functions out of PlatformSupport and implement
new PlatformCookieJar interface via NetworkContext.

Source/WebCore:

  • WebCore.gyp/WebCore.gyp:
  • WebCore.gypi:
  • loader/CookieJar.cpp:
  • loader/chromium/CookieJarChromium.cpp: Removed.
  • platform/chromium/PlatformSupport.h:

(WebCore):
(PlatformSupport):

  • platform/network/NetworkingContext.h:

(WebKit):
(NetworkingContext):

  • platform/network/chromium/CookieJarChromium.cpp: Copied from Source/WebCore/loader/chromium/CookieJarChromium.cpp.

(WebCore::setCookiesFromDOM):
(WebCore::cookiesForDOM):
(WebCore::cookieRequestHeaderFieldValue):
(WebCore::cookiesEnabled):
(WebCore::getRawCookies):
(WebCore::deleteCookie):
(WebCore::getHostnamesWithCookies):
(WebCore::deleteCookiesForHostname):
(WebCore::deleteAllCookies):

Source/WebKit/chromium:

  • WebKit.gyp:
  • src/FrameNetworkingContextImpl.cpp: Added.

(WebKit):
(WebKit::FrameNetworkingContextImpl::cookieJar):

  • src/FrameNetworkingContextImpl.h:

(FrameNetworkingContextImpl):

  • src/PlatformSupport.cpp:
Location:
trunk/Source
Files:
1 added
10 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r135009 r135013  
     12012-11-16  Mark Pilgrim  <pilgrim@chromium.org>
     2
     3        [Chromium] Remove cookie-related functions from PlatformSupport
     4        https://bugs.webkit.org/show_bug.cgi?id=99340
     5
     6        Reviewed by Adam Barth.
     7
     8        Move cookie-related functions out of PlatformSupport and implement
     9        new PlatformCookieJar interface via NetworkContext.
     10
     11        * WebCore.gyp/WebCore.gyp:
     12        * WebCore.gypi:
     13        * loader/CookieJar.cpp:
     14        * loader/chromium/CookieJarChromium.cpp: Removed.
     15        * platform/chromium/PlatformSupport.h:
     16        (WebCore):
     17        (PlatformSupport):
     18        * platform/network/NetworkingContext.h:
     19        (WebKit):
     20        (NetworkingContext):
     21        * platform/network/chromium/CookieJarChromium.cpp: Copied from Source/WebCore/loader/chromium/CookieJarChromium.cpp.
     22        (WebCore::setCookiesFromDOM):
     23        (WebCore::cookiesForDOM):
     24        (WebCore::cookieRequestHeaderFieldValue):
     25        (WebCore::cookiesEnabled):
     26        (WebCore::getRawCookies):
     27        (WebCore::deleteCookie):
     28        (WebCore::getHostnamesWithCookies):
     29        (WebCore::deleteCookiesForHostname):
     30        (WebCore::deleteAllCookies):
     31
    1322012-11-16  Pablo Flouret  <pablof@motorola.com>
    233
  • trunk/Source/WebCore/WebCore.gyp/WebCore.gyp

    r134975 r135013  
    21172117        ['exclude', 'inspector/JavaScript[^/]*\\.cpp$'],
    21182118        ['exclude', 'loader/UserStyleSheetLoader\\.cpp$'],
    2119         ['exclude', 'loader/CookieJar\\.cpp$'],
    21202119        ['exclude', 'loader/appcache/'],
    21212120        ['exclude', 'loader/archive/cf/LegacyWebArchiveMac\\.mm$'],
  • trunk/Source/WebCore/WebCore.gypi

    r134975 r135013  
    30503050            'loader/cf/ResourceLoaderCFNet.cpp',
    30513051            'loader/chromium/CachedRawResourceChromium.cpp',
    3052             'loader/chromium/CookieJarChromium.cpp',
    30533052            'loader/chromium/DocumentThreadableLoaderChromium.cpp',
    30543053            'loader/chromium/ResourceLoaderChromium.cpp',
     
    55855584            'platform/network/chromium/AuthenticationChallenge.h',
    55865585            'platform/network/chromium/AuthenticationChallengeChromium.cpp',
     5586            'platform/network/chromium/CookieJarChromium.cpp',
    55875587            'platform/network/chromium/DNSChromium.cpp',
    55885588            'platform/network/chromium/ResourceError.h',
  • trunk/Source/WebCore/loader/CookieJar.cpp

    r134975 r135013  
    3131#include "PlatformCookieJar.h"
    3232
    33 #if PLATFORM(CHROMIUM) || PLATFORM(BLACKBERRY)
    34 #error Chromium and Blackberry currently use a fork of this file because of layering violations
     33#if PLATFORM(BLACKBERRY)
     34#error Blackberry currently uses a fork of this file because of layering violations
    3535#endif
    3636
  • trunk/Source/WebCore/platform/chromium/PlatformSupport.h

    r134975 r135013  
    7070class Widget;
    7171
    72 struct Cookie;
    7372struct FontRenderStyle;
    7473
     
    7978class PlatformSupport {
    8079public:
    81     // Cookies ------------------------------------------------------------
    82     static void setCookies(const Document*, const KURL&, const String& value);
    83     static String cookies(const Document*, const KURL&);
    84     static String cookieRequestHeaderFieldValue(const Document*, const KURL&);
    85     static bool rawCookies(const Document*, const KURL&, Vector<Cookie>&);
    86     static void deleteCookie(const Document*, const KURL&, const String& cookieName);
    87     static bool cookiesEnabled(const Document*);
    88 
    8980    // Font ---------------------------------------------------------------
    9081#if OS(WINDOWS)
  • trunk/Source/WebCore/platform/network/NetworkingContext.h

    r134975 r135013  
    2525#if PLATFORM(MAC)
    2626#include "SchedulePair.h"
     27#endif
     28
     29#if PLATFORM(CHROMIUM)
     30namespace WebKit {
     31class WebCookieJar;
     32}
    2733#endif
    2834
     
    6167
    6268    virtual bool isValid() const { return true; }
     69
     70#if PLATFORM(CHROMIUM)
     71    virtual WebKit::WebCookieJar* cookieJar() const = 0;
     72#endif
    6373
    6474#if PLATFORM(MAC)
  • trunk/Source/WebKit/chromium/ChangeLog

    r135002 r135013  
     12012-11-16  Mark Pilgrim  <pilgrim@chromium.org>
     2
     3        [Chromium] Remove cookie-related functions from PlatformSupport
     4        https://bugs.webkit.org/show_bug.cgi?id=99340
     5
     6        Reviewed by Adam Barth.
     7
     8        Move cookie-related functions out of PlatformSupport and implement
     9        new PlatformCookieJar interface via NetworkContext.
     10
     11        * WebKit.gyp:
     12        * src/FrameNetworkingContextImpl.cpp: Added.
     13        (WebKit):
     14        (WebKit::FrameNetworkingContextImpl::cookieJar):
     15        * src/FrameNetworkingContextImpl.h:
     16        (FrameNetworkingContextImpl):
     17        * src/PlatformSupport.cpp:
     18
    1192012-11-16  Tien-Ren Chen  <trchen@chromium.org>
    220
  • trunk/Source/WebKit/chromium/WebKit.gyp

    r134975 r135013  
    395395                'src/FrameLoaderClientImpl.cpp',
    396396                'src/FrameLoaderClientImpl.h',
     397                'src/FrameNetworkingContextImpl.cpp',
    397398                'src/FrameNetworkingContextImpl.h',
    398399                'src/GeolocationClientProxy.cpp',
  • trunk/Source/WebKit/chromium/src/FrameNetworkingContextImpl.cpp

    r135010 r135013  
    11/*
    2  * Copyright (c) 2010, Google Inc. All rights reserved.
    3  * 
     2 * Copyright (C) 2012 Google Inc. All rights reserved.
     3 *
    44 * Redistribution and use in source and binary forms, with or without
    55 * modification, are permitted provided that the following conditions are
    66 * met:
    7  * 
     7 *
    88 *     * Redistributions of source code must retain the above copyright
    99 * notice, this list of conditions and the following disclaimer.
     
    1515 * contributors may be used to endorse or promote products derived from
    1616 * this software without specific prior written permission.
    17  * 
     17 *
    1818 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    1919 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     
    3030
    3131#include "config.h"
    32 #include "CookieJar.h"
     32#include "FrameNetworkingContextImpl.h"
    3333
    34 #include "Cookie.h"
    35 #include "Document.h"
    36 #include "PlatformSupport.h"
     34#include "WebFrameClient.h"
     35#include "WebFrameImpl.h"
     36#include <public/Platform.h>
    3737
    38 namespace WebCore {
     38namespace WebKit {
    3939
    40 // FIXME: Unfork. This file is forked because all other platforms use NetworkingContext to access cookie jar, not Document or Frame.
    41 
    42 void setCookies(Document* document, const KURL& url, const String& value)
     40WebCookieJar* FrameNetworkingContextImpl::cookieJar() const
    4341{
    44     PlatformSupport::setCookies(document, url, value);
     42    WebFrameImpl* frameImpl = WebFrameImpl::fromFrame(frame());
     43    if (!frameImpl || !frameImpl->client())
     44        return 0;
     45    WebCookieJar* cookieJar = frameImpl->client()->cookieJar(frameImpl);
     46    if (!cookieJar)
     47        cookieJar = WebKit::Platform::current()->cookieJar();
     48    return cookieJar;
    4549}
    4650
    47 String cookies(const Document* document, const KURL& url)
    48 {
    49     return PlatformSupport::cookies(document, url);
    5051}
    51 
    52 String cookieRequestHeaderFieldValue(const Document* document, const KURL& url)
    53 {
    54     return PlatformSupport::cookieRequestHeaderFieldValue(document, url);
    55 }
    56 
    57 bool cookiesEnabled(const Document* document)
    58 {
    59     return PlatformSupport::cookiesEnabled(document);
    60 }
    61 
    62 bool getRawCookies(const Document* document, const KURL& url, Vector<Cookie>& rawCookies)
    63 {
    64     return PlatformSupport::rawCookies(document, url, rawCookies);
    65 }
    66 
    67 void deleteCookie(const Document* document, const KURL& url, const String& cookieName)
    68 {
    69     return PlatformSupport::deleteCookie(document, url, cookieName);
    70 }
    71 
    72 void getHostnamesWithCookies(HashSet<String>& hostnames)
    73 {
    74     // FIXME: Not yet implemented
    75 }
    76 
    77 void deleteCookiesForHostname(const String& hostname)
    78 {
    79     // FIXME: Not yet implemented
    80 }
    81 
    82 void deleteAllCookies()
    83 {
    84     // FIXME: Not yet implemented
    85 }
    86 
    87 } // namespace WebCore
  • trunk/Source/WebKit/chromium/src/FrameNetworkingContextImpl.h

    r134975 r135013  
    2222
    2323#include "FrameNetworkingContext.h"
     24#include <public/WebCookieJar.h>
    2425
    2526namespace WebKit {
     
    2728class FrameNetworkingContextImpl : public WebCore::FrameNetworkingContext {
    2829public:
     30    virtual WebCookieJar* cookieJar() const OVERRIDE;
     31
    2932    static PassRefPtr<FrameNetworkingContextImpl> create(WebCore::Frame* frame)
    3033    {
  • trunk/Source/WebKit/chromium/src/PlatformSupport.cpp

    r134975 r135013  
    8585
    8686#include "BitmapImage.h"
    87 #include "Cookie.h"
    88 #include "Document.h"
    8987#include "FrameView.h"
    9088#include "GraphicsContext.h"
     
    9896#include "Worker.h"
    9997#include "WorkerContextProxy.h"
    100 #include <public/WebCookie.h>
    101 #include <public/WebCookieJar.h>
    10298#include <public/WebMimeRegistry.h>
    10399#include <public/WebVector.h>
     
    109105namespace WebCore {
    110106
    111 static WebCookieJar* getCookieJar(const Document* document)
    112 {
    113     WebFrameImpl* frameImpl = WebFrameImpl::fromFrame(document->frame());
    114     if (!frameImpl || !frameImpl->client())
    115         return 0;
    116     WebCookieJar* cookieJar = frameImpl->client()->cookieJar(frameImpl);
    117     if (!cookieJar)
    118         cookieJar = WebKit::Platform::current()->cookieJar();
    119     return cookieJar;
    120 }
    121 
    122 // Cookies --------------------------------------------------------------------
    123 
    124 void PlatformSupport::setCookies(const Document* document, const KURL& url,
    125                                 const String& value)
    126 {
    127     WebCookieJar* cookieJar = getCookieJar(document);
    128     if (cookieJar)
    129         cookieJar->setCookie(url, document->firstPartyForCookies(), value);
    130 }
    131 
    132 String PlatformSupport::cookies(const Document* document, const KURL& url)
    133 {
    134     String result;
    135     WebCookieJar* cookieJar = getCookieJar(document);
    136     if (cookieJar)
    137         result = cookieJar->cookies(url, document->firstPartyForCookies());
    138     return result;
    139 }
    140 
    141 String PlatformSupport::cookieRequestHeaderFieldValue(const Document* document,
    142                                                      const KURL& url)
    143 {
    144     String result;
    145     WebCookieJar* cookieJar = getCookieJar(document);
    146     if (cookieJar)
    147         result = cookieJar->cookieRequestHeaderFieldValue(url, document->firstPartyForCookies());
    148     return result;
    149 }
    150 
    151 bool PlatformSupport::rawCookies(const Document* document, const KURL& url, Vector<Cookie>& rawCookies)
    152 {
    153     rawCookies.clear();
    154     WebVector<WebCookie> webCookies;
    155 
    156     WebCookieJar* cookieJar = getCookieJar(document);
    157     if (cookieJar)
    158         cookieJar->rawCookies(url, document->firstPartyForCookies(), webCookies);
    159 
    160     for (unsigned i = 0; i < webCookies.size(); ++i) {
    161         const WebCookie& webCookie = webCookies[i];
    162         Cookie cookie(webCookie.name,
    163                       webCookie.value,
    164                       webCookie.domain,
    165                       webCookie.path,
    166                       webCookie.expires,
    167                       webCookie.httpOnly,
    168                       webCookie.secure,
    169                       webCookie.session);
    170         rawCookies.append(cookie);
    171     }
    172     return true;
    173 }
    174 
    175 void PlatformSupport::deleteCookie(const Document* document, const KURL& url, const String& cookieName)
    176 {
    177     WebCookieJar* cookieJar = getCookieJar(document);
    178     if (cookieJar)
    179         cookieJar->deleteCookie(url, cookieName);
    180 }
    181 
    182 bool PlatformSupport::cookiesEnabled(const Document* document)
    183 {
    184     bool result = false;
    185     WebCookieJar* cookieJar = getCookieJar(document);
    186     if (cookieJar)
    187         result = cookieJar->cookiesEnabled(document->cookieURL(), document->firstPartyForCookies());
    188     return result;
    189 }
    190 
    191107// Font -----------------------------------------------------------------------
    192108
Note: See TracChangeset for help on using the changeset viewer.