Changeset 74131 in webkit


Ignore:
Timestamp:
Dec 15, 2010 11:34:25 AM (13 years ago)
Author:
bweinstein@apple.com
Message:

WebKit2: WebPageWin needs implementations of hasLocalDataForURL and canHandleRequest
https://bugs.webkit.org/show_bug.cgi?id=51090

Reviewed by Adam Roben.

Implement these functions for WebKit2 on Windows.

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::hasLocalDataForURL): Does the cross-platform part of the check for having local

data (file URL or subresource), then calls platformHasLocalDataForURL to let the platform do
their specific checks.

  • WebProcess/WebPage/WebPage.h:
  • WebProcess/WebPage/mac/WebPageMac.mm:

(WebKit::WebPage::platformHasLocalDataForURL): Moved the cross-platform code from here to WebPage::hasLocalDataForURL.

  • WebProcess/WebPage/qt/WebPageQt.cpp:

(WebKit::WebPage::platformHasLocalDataForURL): Renamed from hasLocalDataForURL.

  • WebProcess/WebPage/win/WebPageWin.cpp:

(WebKit::WebPage::platformHasLocalDataForURL): Renamed from hasLocalDataForURL and implemented with CFNetwork calls. This is the

CFNetwork equivalent of the code in WebPageMac::platformHasLocalDataForURL.

(WebKit::WebPage::canHandleRequest): Copied the line of code from WebView::canHandleRequest in WebKit1, with a FIXME saying

this might not be enough (although it was in WebKit1 on Windows).

Location:
trunk/WebKit2
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit2/ChangeLog

    r74124 r74131  
     12010-12-15  Brian Weinstein  <bweinstein@apple.com>
     2
     3        Reviewed by Adam Roben.
     4
     5        WebKit2: WebPageWin needs implementations of hasLocalDataForURL and canHandleRequest
     6        https://bugs.webkit.org/show_bug.cgi?id=51090
     7       
     8        Implement these functions for WebKit2 on Windows.
     9
     10        * WebProcess/WebPage/WebPage.cpp:
     11        (WebKit::WebPage::hasLocalDataForURL): Does the cross-platform part of the check for having local
     12            data (file URL or subresource), then calls platformHasLocalDataForURL to let the platform do
     13            their specific checks.
     14        * WebProcess/WebPage/WebPage.h:
     15        * WebProcess/WebPage/mac/WebPageMac.mm:
     16        (WebKit::WebPage::platformHasLocalDataForURL): Moved the cross-platform code from here to WebPage::hasLocalDataForURL.
     17        * WebProcess/WebPage/qt/WebPageQt.cpp:
     18        (WebKit::WebPage::platformHasLocalDataForURL): Renamed from hasLocalDataForURL.
     19        * WebProcess/WebPage/win/WebPageWin.cpp:
     20        (WebKit::WebPage::platformHasLocalDataForURL): Renamed from hasLocalDataForURL and implemented with CFNetwork calls. This is the
     21            CFNetwork equivalent of the code in WebPageMac::platformHasLocalDataForURL.
     22        (WebKit::WebPage::canHandleRequest): Copied the line of code from WebView::canHandleRequest in WebKit1, with a FIXME saying
     23            this might not be enough (although it was in WebKit1 on Windows).
     24
    1252010-12-15  Sheriff Bot  <webkit.review.bot@gmail.com>
    226
  • trunk/WebKit2/WebProcess/WebPage/WebPage.cpp

    r74041 r74131  
    5959#include "WebProcessProxyMessages.h"
    6060#include <WebCore/AbstractDatabase.h>
     61#include <WebCore/ArchiveResource.h>
    6162#include <WebCore/Chrome.h>
    6263#include <WebCore/ContextMenuController.h>
     64#include <WebCore/DocumentLoader.h>
    6365#include <WebCore/EventHandler.h>
    6466#include <WebCore/FocusController.h>
     
    12651267}
    12661268
     1269bool WebPage::hasLocalDataForURL(const KURL& url)
     1270{
     1271    if (url.isLocalFile())
     1272        return true;
     1273
     1274    FrameLoader* frameLoader = m_page->mainFrame()->loader();
     1275    DocumentLoader* documentLoader = frameLoader ? frameLoader->documentLoader() : 0;
     1276    if (documentLoader && documentLoader->subresource(url))
     1277        return true;
     1278
     1279    return platformHasLocalDataForURL(url);
     1280}
     1281
    12671282} // namespace WebKit
  • trunk/WebKit2/WebProcess/WebPage/WebPage.h

    r74046 r74131  
    268268    void loadData(PassRefPtr<WebCore::SharedBuffer>, const String& MIMEType, const String& encodingName, const WebCore::KURL& baseURL, const WebCore::KURL& failingURL);
    269269
     270    bool platformHasLocalDataForURL(const WebCore::KURL&);
     271
    270272    // Actions
    271273    void tryClose();
  • trunk/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm

    r74046 r74131  
    3131#include "WebPageProxyMessages.h"
    3232#include "WebProcess.h"
    33 #include <WebCore/ArchiveResource.h>
    34 #include <WebCore/DocumentLoader.h>
    3533#include <WebCore/FocusController.h>
    3634#include <WebCore/Frame.h>
     
    343341}
    344342
    345 bool WebPage::hasLocalDataForURL(const WebCore::KURL& url)
    346 {
    347     if (url.isLocalFile())
    348         return true;
    349    
    350     FrameLoader* frameLoader = m_page->mainFrame()->loader();
    351     DocumentLoader* documentLoader = frameLoader ? frameLoader->documentLoader() : 0;
    352     if (documentLoader && documentLoader->subresource(url))
    353         return true;
    354 
     343bool WebPage::platformHasLocalDataForURL(const WebCore::KURL& url)
     344{
    355345    NSMutableURLRequest* request = [[NSMutableURLRequest alloc] initWithURL:url];
    356346    [request setValue:(NSString*)userAgent() forHTTPHeaderField:@"User-Agent"];
  • trunk/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp

    r73941 r74131  
    265265}
    266266
    267 bool WebPage::hasLocalDataForURL(const WebCore::KURL&)
     267bool WebPage::platformHasLocalDataForURL(const WebCore::KURL&)
    268268{
    269269    // FIXME: Implement
  • trunk/WebKit2/WebProcess/WebPage/win/WebPageWin.cpp

    r73952 r74131  
    4141#include <WinUser.h>
    4242
     43#if USE(CFNETWORK)
     44#include <CFNetwork/CFURLCachePriv.h>
     45#include <CFNetwork/CFURLProtocolPriv.h>
     46#include <CFNetwork/CFURLRequestPriv.h>
     47#endif
     48
    4349using namespace WebCore;
    4450
     
    237243}
    238244
    239 bool WebPage::hasLocalDataForURL(const WebCore::KURL&)
    240 {
    241     // FIXME <rdar://problem/8608754>: Implement
     245bool WebPage::platformHasLocalDataForURL(const WebCore::KURL& url)
     246{
     247#if USE(CFNETWORK)
     248    RetainPtr<CFURLRef> cfURL(AdoptCF, url.createCFURL());
     249    RetainPtr<CFMutableURLRequestRef> request(AdoptCF, CFURLRequestCreateMutable(0, cfURL.get(), kCFURLRequestCachePolicyReloadIgnoringCache, 60, 0));
     250   
     251    RetainPtr<CFStringRef> userAgent(AdoptCF, userAgent().createCFString());
     252    CFURLRequestSetHTTPHeaderFieldValue(request.get(), CFSTR("User-Agent"), userAgent.get());
     253
     254    RetainPtr<CFURLCacheRef> cache(AdoptCF, CFURLCacheCopySharedURLCache());
     255
     256    RetainPtr<CFCachedURLResponseRef> response(AdoptCF, CFURLCacheCopyResponseForRequest(cache.get(), request.get()));   
     257    return response;
     258#else
    242259    return false;
    243 }
    244 
    245 bool WebPage::canHandleRequest(const WebCore::ResourceRequest&)
    246 {
    247     // FIXME <rdar://problem/8608754>: Implement
    248     return true;
     260#endif
     261}
     262
     263bool WebPage::canHandleRequest(const WebCore::ResourceRequest& request)
     264{
     265    // FIXME: Are there other requests we need to be able to handle? WebKit1's WebView.cpp has a FIXME here as well.
     266    return CFURLProtocolCanHandleRequest(request.cfURLRequest());
    249267}
    250268
Note: See TracChangeset for help on using the changeset viewer.