2011-06-12 Adam Barth <abarth@webkit.org>
authorabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 12 Jun 2011 19:21:49 +0000 (19:21 +0000)
committerabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 12 Jun 2011 19:21:49 +0000 (19:21 +0000)
        Reviewed by Alexey Proskuryakov.

        Remove trival "forward-to-client" member functions from FrameLoader
        https://bugs.webkit.org/show_bug.cgi?id=62510

        Update to call the FrameLoaderClient directly.  Also, remove cargo-cult
        code that checks whether FrameLoader is null.

        * webkit/webkitwebview.cpp:
        (webkit_web_view_stop_loading):
        (webkit_web_view_can_show_mime_type):
2011-06-12  Adam Barth  <abarth@webkit.org>

        Reviewed by Alexey Proskuryakov.

        Remove trival "forward-to-client" member functions from FrameLoader
        https://bugs.webkit.org/show_bug.cgi?id=62510

        * WebCoreSupport/WebFrameNetworkingContext.cpp:
        (WebFrameNetworkingContext::blockedError):
2011-06-12  Adam Barth  <abarth@webkit.org>

        Reviewed by Alexey Proskuryakov.

        Remove trival "forward-to-client" member functions from FrameLoader
        https://bugs.webkit.org/show_bug.cgi?id=62510

        * WebCoreSupport/WebFrameNetworkingContext.mm:
        (WebFrameNetworkingContext::blockedError):
2011-06-12  Adam Barth  <abarth@webkit.org>

        Reviewed by Alexey Proskuryakov.

        Remove trival "forward-to-client" member functions from FrameLoader
        https://bugs.webkit.org/show_bug.cgi?id=62510

        Originally, FrameLoader was supposed to abstract FrameLoaderClient, but
        we lost that battle log ago.  Nowadays, it's easier if folks just call
        into FrameLoaderClient directly.  Many of these functions have direct
        callers already anyway.

        * WebCore.exp.in:
        * html/HTMLMediaElement.cpp:
        (WebCore::HTMLMediaElement::createRenderer):
        (WebCore::HTMLMediaElement::attach):
        * loader/DocumentLoader.cpp:
        (WebCore::DocumentLoader::setRequest):
        (WebCore::DocumentLoader::setMainDocumentError):
        (WebCore::DocumentLoader::setupForReplaceByMIMEType):
        * loader/FrameLoader.cpp:
        (WebCore::FrameLoader::didFirstLayout):
        * loader/FrameLoader.h:
            - cancelledError is slightly more delicate, so I'm going to move it in
              a separate patch.
        * loader/MainResourceLoader.cpp:
        (WebCore::MainResourceLoader::interruptForPolicyChangeError):
        (WebCore::MainResourceLoader::stopLoadingForPolicyChange):
        (WebCore::MainResourceLoader::continueAfterContentPolicy):
        (WebCore::MainResourceLoader::handleEmptyLoad):
        (WebCore::MainResourceLoader::loadNow):
        * loader/MainResourceLoader.h:
        * loader/NetscapePlugInStreamLoader.cpp:
        (WebCore::NetscapePlugInStreamLoader::didReceiveResponse):
        * loader/PingLoader.cpp:
        (WebCore::PingLoader::PingLoader):
        * loader/PolicyChecker.cpp:
        (WebCore::PolicyChecker::continueAfterNavigationPolicy):
        * loader/ResourceLoader.cpp:
        (WebCore::ResourceLoader::blockedError):
        (WebCore::ResourceLoader::cannotShowURLError):
        (WebCore::ResourceLoader::shouldUseCredentialStorage):
        (WebCore::ResourceLoader::canAuthenticateAgainstProtectionSpace):
        * page/ContextMenuController.cpp:
        (WebCore::ContextMenuController::populate):
2011-06-12  Adam Barth  <abarth@webkit.org>

        Reviewed by Alexey Proskuryakov.

        Remove trival "forward-to-client" member functions from FrameLoader
        https://bugs.webkit.org/show_bug.cgi?id=62510

        * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
        (WebKit::WebFrameNetworkingContext::blockedError):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@88618 268f45cc-cd09-0410-ab3c-d52691b4dbfc

21 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/loader/DocumentLoader.cpp
Source/WebCore/loader/FrameLoader.cpp
Source/WebCore/loader/FrameLoader.h
Source/WebCore/loader/MainResourceLoader.cpp
Source/WebCore/loader/MainResourceLoader.h
Source/WebCore/loader/NetscapePlugInStreamLoader.cpp
Source/WebCore/loader/PingLoader.cpp
Source/WebCore/loader/PolicyChecker.cpp
Source/WebCore/loader/ResourceLoader.cpp
Source/WebCore/page/ContextMenuController.cpp
Source/WebKit/gtk/ChangeLog
Source/WebKit/gtk/webkit/webkitwebview.cpp
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebCoreSupport/WebFrameNetworkingContext.mm
Source/WebKit/win/ChangeLog
Source/WebKit/win/WebCoreSupport/WebFrameNetworkingContext.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm

index de7fc56..851ebbd 100644 (file)
@@ -1,3 +1,49 @@
+2011-06-12  Adam Barth  <abarth@webkit.org>
+
+        Reviewed by Alexey Proskuryakov.
+
+        Remove trival "forward-to-client" member functions from FrameLoader
+        https://bugs.webkit.org/show_bug.cgi?id=62510
+
+        Originally, FrameLoader was supposed to abstract FrameLoaderClient, but
+        we lost that battle log ago.  Nowadays, it's easier if folks just call
+        into FrameLoaderClient directly.  Many of these functions have direct
+        callers already anyway.
+
+        * WebCore.exp.in:
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::createRenderer):
+        (WebCore::HTMLMediaElement::attach):
+        * loader/DocumentLoader.cpp:
+        (WebCore::DocumentLoader::setRequest):
+        (WebCore::DocumentLoader::setMainDocumentError):
+        (WebCore::DocumentLoader::setupForReplaceByMIMEType):
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::didFirstLayout):
+        * loader/FrameLoader.h:
+            - cancelledError is slightly more delicate, so I'm going to move it in
+              a separate patch.
+        * loader/MainResourceLoader.cpp:
+        (WebCore::MainResourceLoader::interruptForPolicyChangeError):
+        (WebCore::MainResourceLoader::stopLoadingForPolicyChange):
+        (WebCore::MainResourceLoader::continueAfterContentPolicy):
+        (WebCore::MainResourceLoader::handleEmptyLoad):
+        (WebCore::MainResourceLoader::loadNow):
+        * loader/MainResourceLoader.h:
+        * loader/NetscapePlugInStreamLoader.cpp:
+        (WebCore::NetscapePlugInStreamLoader::didReceiveResponse):
+        * loader/PingLoader.cpp:
+        (WebCore::PingLoader::PingLoader):
+        * loader/PolicyChecker.cpp:
+        (WebCore::PolicyChecker::continueAfterNavigationPolicy):
+        * loader/ResourceLoader.cpp:
+        (WebCore::ResourceLoader::blockedError):
+        (WebCore::ResourceLoader::cannotShowURLError):
+        (WebCore::ResourceLoader::shouldUseCredentialStorage):
+        (WebCore::ResourceLoader::canAuthenticateAgainstProtectionSpace):
+        * page/ContextMenuController.cpp:
+        (WebCore::ContextMenuController::populate):
+
 2011-06-12  Dan Bernstein  <mitz@apple.com>
 
         Reviewed by Darin Adler.
index 8c5a648..57bf670 100644 (file)
@@ -1046,7 +1046,6 @@ __ZNK7WebCore10ScrollView16windowToContentsERKNS_8IntPointE
 __ZNK7WebCore10ScrollView18visibleContentRectEb
 __ZNK7WebCore11CachedImage5imageEv
 __ZNK7WebCore11FrameLoader10isCompleteEv
-__ZNK7WebCore11FrameLoader12blockedErrorERKNS_15ResourceRequestE
 __ZNK7WebCore11FrameLoader14cancelledErrorERKNS_15ResourceRequestE
 __ZNK7WebCore11FrameLoader14frameHasLoadedEv
 __ZNK7WebCore11FrameLoader16outgoingReferrerEv
index 7564b56..e8cc989 100644 (file)
@@ -335,7 +335,7 @@ RenderObject* HTMLMediaElement::createRenderer(RenderArena* arena, RenderStyle*)
         mediaRenderer->setWidget(m_proxyWidget);
 
         if (Frame* frame = document()->frame())
-            frame->loader()->showMediaPlayerProxyPlugin(m_proxyWidget.get());
+            frame->loader()->client()->showMediaPlayerProxyPlugin(m_proxyWidget.get());
     }
     return mediaRenderer;
 #else
@@ -376,7 +376,7 @@ void HTMLMediaElement::attach()
 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
     else if (m_proxyWidget) {
         if (Frame* frame = document()->frame())
-            frame->loader()->hideMediaPlayerProxyPlugin(m_proxyWidget.get());
+            frame->loader()->client()->hideMediaPlayerProxyPlugin(m_proxyWidget.get());
     }
 #endif
 }
index 7b98b6a..67ab924 100644 (file)
@@ -177,17 +177,17 @@ void DocumentLoader::setRequest(const ResourceRequest& req)
     KURL oldURL = m_request.url();
     m_request = req;
 
-    // Only send webView:didReceiveServerRedirectForProvisionalLoadForFrame: if URL changed (and is non-null).
+    // Only dispatchDidReceiveServerRedirectForProvisionalLoad() if URL changed (and is non-null).
     // Also, don't send it when replacing unreachable URLs with alternate content.
     if (!handlingUnreachableURL && !req.url().isNull() && oldURL != req.url())
-        frameLoader()->didReceiveServerRedirectForProvisionalLoadForFrame();
+        frameLoader()->client()->dispatchDidReceiveServerRedirectForProvisionalLoad();
 }
 
 void DocumentLoader::setMainDocumentError(const ResourceError& error)
 {
     m_mainDocumentError = error;    
-    frameLoader()->setMainDocumentError(this, error);
- }
+    frameLoader()->client()->setMainDocumentError(this, error);
+}
 
 void DocumentLoader::clearErrors()
 {
@@ -341,7 +341,7 @@ void DocumentLoader::setupForReplaceByMIMEType(const String& newMIMEType)
     String oldMIMEType = m_response.mimeType();
     
     if (!doesProgressiveLoad(oldMIMEType)) {
-        frameLoader()->revertToProvisional(this);
+        frameLoader()->client()->revertToProvisionalState(this);
         setupForReplace();
         RefPtr<SharedBuffer> resourceData = mainResourceData();
         commitLoad(resourceData->data(), resourceData->size());
@@ -354,7 +354,7 @@ void DocumentLoader::setupForReplaceByMIMEType(const String& newMIMEType)
     m_gotFirstByte = false;
     
     if (doesProgressiveLoad(newMIMEType)) {
-        frameLoader()->revertToProvisional(this);
+        frameLoader()->client()->revertToProvisionalState(this);
         setupForReplace();
     }
     
index 7f336a5..3a38931 100644 (file)
@@ -263,11 +263,6 @@ void FrameLoader::setDefersLoading(bool defers)
     }
 }
 
-bool FrameLoader::canHandleRequest(const ResourceRequest& request)
-{
-    return m_client->canHandleRequest(request);
-}
-
 void FrameLoader::changeLocation(PassRefPtr<SecurityOrigin> securityOrigin, const KURL& url, const String& referrer, bool lockHistory, bool lockBackForwardList, bool refresh)
 {
     RefPtr<Frame> protect(m_frame);
@@ -1077,18 +1072,6 @@ ObjectContentType FrameLoader::defaultObjectContentType(const KURL& url, const S
     return WebCore::ObjectContentNone;
 }
 
-#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
-void FrameLoader::hideMediaPlayerProxyPlugin(Widget* widget)
-{
-    m_client->hideMediaPlayerProxyPlugin(widget);
-}
-
-void FrameLoader::showMediaPlayerProxyPlugin(Widget* widget)
-{
-    m_client->showMediaPlayerProxyPlugin(widget);
-}
-#endif // ENABLE(PLUGIN_PROXY_FOR_VIDEO)
-
 String FrameLoader::outgoingReferrer() const
 {
     return m_outgoingReferrer;
@@ -2307,26 +2290,6 @@ bool FrameLoader::isLoadingMainFrame() const
     return page && m_frame == page->mainFrame();
 }
 
-bool FrameLoader::canShowMIMEType(const String& MIMEType) const
-{
-    return m_client->canShowMIMEType(MIMEType);
-}
-
-bool FrameLoader::representationExistsForURLScheme(const String& URLScheme)
-{
-    return m_client->representationExistsForURLScheme(URLScheme);
-}
-
-String FrameLoader::generatedMIMETypeForURLScheme(const String& URLScheme)
-{
-    return m_client->generatedMIMETypeForURLScheme(URLScheme);
-}
-
-void FrameLoader::didReceiveServerRedirectForProvisionalLoadForFrame()
-{
-    m_client->dispatchDidReceiveServerRedirectForProvisionalLoad();
-}
-
 void FrameLoader::finishedLoadingDocument(DocumentLoader* loader)
 {
     // FIXME: Platforms shouldn't differ here!
@@ -2375,11 +2338,6 @@ void FrameLoader::setReplacing()
     m_loadType = FrameLoadTypeReplace;
 }
 
-void FrameLoader::revertToProvisional(DocumentLoader* loader)
-{
-    m_client->revertToProvisionalState(loader);
-}
-
 bool FrameLoader::subframeIsLoading() const
 {
     // It's most likely that the last added frame is the last to load so we walk backwards.
@@ -2577,6 +2535,7 @@ void FrameLoader::didFirstLayout()
 
     if (m_stateMachine.committedFirstRealDocumentLoad() && !m_stateMachine.isDisplayingInitialEmptyDocument() && !m_stateMachine.firstLayoutDone())
         m_stateMachine.advanceTo(FrameLoaderStateMachine::FirstLayoutDone);
+
     m_client->dispatchDidFirstLayout();
 }
 
@@ -3367,11 +3326,6 @@ void FrameLoader::loadItem(HistoryItem* item, FrameLoadType loadType)
         loadDifferentDocumentItem(item, loadType);
 }
 
-void FrameLoader::setMainDocumentError(DocumentLoader* loader, const ResourceError& error)
-{
-    m_client->setMainDocumentError(loader, error);
-}
-
 void FrameLoader::mainReceivedCompleteError(DocumentLoader* loader, const ResourceError&)
 {
     loader->setPrimaryLoadComplete(true);
@@ -3393,38 +3347,6 @@ ResourceError FrameLoader::cancelledError(const ResourceRequest& request) const
     return error;
 }
 
-ResourceError FrameLoader::blockedError(const ResourceRequest& request) const
-{
-    return m_client->blockedError(request);
-}
-
-ResourceError FrameLoader::cannotShowURLError(const ResourceRequest& request) const
-{
-    return m_client->cannotShowURLError(request);
-}
-
-ResourceError FrameLoader::interruptionForPolicyChangeError(const ResourceRequest& request) const
-{
-    return m_client->interruptForPolicyChangeError(request);
-}
-
-ResourceError FrameLoader::fileDoesNotExistError(const ResourceResponse& response) const
-{
-    return m_client->fileDoesNotExistError(response);    
-}
-
-bool FrameLoader::shouldUseCredentialStorage(ResourceLoader* loader)
-{
-    return m_client->shouldUseCredentialStorage(loader->documentLoader(), loader->identifier());
-}
-
-#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
-bool FrameLoader::canAuthenticateAgainstProtectionSpace(ResourceLoader* loader, const ProtectionSpace& protectionSpace)
-{
-    return m_client->canAuthenticateAgainstProtectionSpace(loader->documentLoader(), loader->identifier(), protectionSpace);
-}
-#endif
-
 void FrameLoader::setTitle(const StringWithDirection& title)
 {
     documentLoader()->setTitle(title);
index 9e2b838..416303b 100644 (file)
@@ -128,8 +128,6 @@ public:
 
     unsigned long loadResourceSynchronously(const ResourceRequest&, StoredCredentials, ResourceError&, ResourceResponse&, Vector<char>& data);
 
-    bool canHandleRequest(const ResourceRequest&);
-
     // Also not cool.
     void stopAllLoaders(ClearProvisionalItemPolicy = ShouldClearProvisionalItem);
     void stopForUserCancel(bool deferCheckLoadComplete = false);
@@ -152,10 +150,6 @@ public:
     FrameState state() const { return m_state; }
     static double timeOfLastCompletedLoad();
 
-    bool shouldUseCredentialStorage(ResourceLoader*);
-#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
-    bool canAuthenticateAgainstProtectionSpace(ResourceLoader* loader, const ProtectionSpace& protectionSpace);
-#endif
     const ResourceRequest& originalRequest() const;
     const ResourceRequest& initialRequest() const;
     void receivedMainResourceError(const ResourceError&, bool isComplete);
@@ -167,27 +161,18 @@ public:
 
     void finishedLoading();
 
+    // FIXME: Move this method to ResourceLoader with the rest of the ResourceError accessors.
     ResourceError cancelledError(const ResourceRequest&) const;
-    ResourceError fileDoesNotExistError(const ResourceResponse&) const;
-    ResourceError blockedError(const ResourceRequest&) const;
-    ResourceError cannotShowURLError(const ResourceRequest&) const;
-    ResourceError interruptionForPolicyChangeError(const ResourceRequest&) const;
 
     bool isHostedByObjectElement() const;
     bool isLoadingMainFrame() const;
-    bool canShowMIMEType(const String& MIMEType) const;
-    bool representationExistsForURLScheme(const String& URLScheme);
-    String generatedMIMETypeForURLScheme(const String& URLScheme);
 
     void reload(bool endToEndReload = false);
     void reloadWithOverrideEncoding(const String& overrideEncoding);
 
-    void didReceiveServerRedirectForProvisionalLoadForFrame();
     void finishedLoadingDocument(DocumentLoader*);
     bool isReplacing() const;
     void setReplacing();
-    void revertToProvisional(DocumentLoader*);
-    void setMainDocumentError(DocumentLoader*, const ResourceError&);
     void mainReceivedCompleteError(DocumentLoader*, const ResourceError&);
     bool subframeIsLoading() const;
     void willChangeTitle(DocumentLoader*);
@@ -309,11 +294,6 @@ public:
 
     void open(CachedFrameBase&);
 
-#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
-    void hideMediaPlayerProxyPlugin(Widget*);
-    void showMediaPlayerProxyPlugin(Widget*);
-#endif
-
     // FIXME: Should these really be public?
     void completed();
     bool allAncestorsAreComplete() const; // including this
index feafa76..c5f5336 100644 (file)
@@ -118,14 +118,14 @@ void MainResourceLoader::didCancel(const ResourceError& error)
     frameLoader()->receivedMainResourceError(error, true);
 }
 
-ResourceError MainResourceLoader::interruptionForPolicyChangeError() const
+ResourceError MainResourceLoader::interruptForPolicyChangeError() const
 {
-    return frameLoader()->interruptionForPolicyChangeError(request());
+    return frameLoader()->client()->interruptForPolicyChangeError(request());
 }
 
 void MainResourceLoader::stopLoadingForPolicyChange()
 {
-    ResourceError error = interruptionForPolicyChangeError();
+    ResourceError error = interruptForPolicyChangeError();
     error.setIsCancellation(true);
     cancel(error);
 }
@@ -258,7 +258,7 @@ void MainResourceLoader::continueAfterContentPolicy(PolicyAction contentPolicy,
         // Prevent remote web archives from loading because they can claim to be from any domain and thus avoid cross-domain security checks (4120255).
         bool isRemoteWebArchive = (equalIgnoringCase("application/x-webarchive", mimeType) || equalIgnoringCase("multipart/related", mimeType))
             && !m_substituteData.isValid() && !url.isLocalFile();
-        if (!frameLoader()->canShowMIMEType(mimeType) || isRemoteWebArchive) {
+        if (!frameLoader()->client()->canShowMIMEType(mimeType) || isRemoteWebArchive) {
             frameLoader()->policyChecker()->cannotShowMIMEType(r);
             // Check reachedTerminalState since the load may have already been cancelled inside of _handleUnimplementablePolicyWithErrorCode::.
             if (!reachedTerminalState())
@@ -278,7 +278,7 @@ void MainResourceLoader::continueAfterContentPolicy(PolicyAction contentPolicy,
         frameLoader()->client()->download(m_handle.get(), request(), m_handle.get()->firstRequest(), r);
         // It might have gone missing
         if (frameLoader())
-            receivedError(interruptionForPolicyChangeError());
+            receivedError(interruptForPolicyChangeError());
         return;
 
     case PolicyIgnore:
@@ -316,7 +316,7 @@ void MainResourceLoader::continueAfterContentPolicy(PolicyAction contentPolicy,
                 didReceiveData(m_substituteData.content()->data(), m_substituteData.content()->size(), m_substituteData.content()->size(), true);
             if (frameLoader() && !frameLoader()->isStopping()) 
                 didFinishLoading(0);
-        } else if (shouldLoadAsEmptyDocument(url) || frameLoader()->representationExistsForURLScheme(url.protocol()))
+        } else if (shouldLoadAsEmptyDocument(url) || frameLoader()->client()->representationExistsForURLScheme(url.protocol()))
             didFinishLoading(0);
     }
 }
@@ -510,7 +510,7 @@ void MainResourceLoader::handleEmptyLoad(const KURL& url, bool forURLScheme)
 {
     String mimeType;
     if (forURLScheme)
-        mimeType = frameLoader()->generatedMIMETypeForURLScheme(url.protocol());
+        mimeType = frameLoader()->client()->generatedMIMETypeForURLScheme(url.protocol());
     else
         mimeType = "text/html";
     
@@ -580,7 +580,7 @@ bool MainResourceLoader::loadNow(ResourceRequest& r)
     resourceLoadScheduler()->addMainResourceLoad(this);
     if (m_substituteData.isValid()) 
         handleDataLoadSoon(r);
-    else if (shouldLoadEmpty || frameLoader()->representationExistsForURLScheme(url.protocol()))
+    else if (shouldLoadEmpty || frameLoader()->client()->representationExistsForURLScheme(url.protocol()))
         handleEmptyLoad(url, !shouldLoadEmpty);
     else
         m_handle = ResourceHandle::create(m_frame->loader()->networkingContext(), r, this, false, true);
index c1108ee..feaadb1 100644 (file)
@@ -86,7 +86,7 @@ namespace WebCore {
         void handleDataLoad(ResourceRequest&);
 
         void receivedError(const ResourceError&);
-        ResourceError interruptionForPolicyChangeError() const;
+        ResourceError interruptForPolicyChangeError() const;
         void stopLoadingForPolicyChange();
         bool isPostOrRedirectAfterPost(const ResourceRequest& newRequest, const ResourceResponse& redirectResponse);
 
index 79783a6..f43c21e 100644 (file)
@@ -30,6 +30,7 @@
 #include "NetscapePlugInStreamLoader.h"
 
 #include "FrameLoader.h"
+#include "FrameLoaderClient.h"
 #include "DocumentLoader.h"
 
 namespace WebCore {
@@ -89,7 +90,7 @@ void NetscapePlugInStreamLoader::didReceiveResponse(const ResourceResponse& resp
         return;
     
     if (response.httpStatusCode() < 100 || response.httpStatusCode() >= 400)
-        cancel(frameLoader()->fileDoesNotExistError(response));
+        cancel(frameLoader()->client()->fileDoesNotExistError(response));
 }
 
 void NetscapePlugInStreamLoader::didReceiveData(const char* data, int length, long long encodedDataLength, bool allAtOnce)
index 027ade9..bda74fb 100644 (file)
@@ -115,6 +115,11 @@ PingLoader::PingLoader(Frame* frame, ResourceRequest& request)
     : m_timeout(this, &PingLoader::timeout)
 {
     unsigned long identifier = frame->page()->progress()->createUniqueIdentifier();
+    // FIXME: Why activeDocumentLoader? I would have expected documentLoader().
+    // Itseems like the PingLoader should be associated with the current
+    // Document in the Frame, but the activeDocumentLoader will be associated
+    // with the provisional DocumentLoader if there is a provisional
+    // DocumentLoader.
     m_shouldUseCredentialStorage = frame->loader()->client()->shouldUseCredentialStorage(frame->loader()->activeDocumentLoader(), identifier);
     m_handle = ResourceHandle::create(frame->loader()->networkingContext(), request, this, false, false);
 
index 475f6bf..f9280ad 100644 (file)
@@ -153,7 +153,7 @@ void PolicyChecker::continueAfterNavigationPolicy(PolicyAction policy)
             ResourceRequest request(callback.request());
 
             if (!m_frame->loader()->client()->canHandleRequest(request)) {
-                handleUnimplementablePolicy(m_frame->loader()->cannotShowURLError(callback.request()));
+                handleUnimplementablePolicy(m_frame->loader()->client()->cannotShowURLError(callback.request()));
                 callback.clearRequest();
                 shouldContinue = false;
             }
index 5c3d39a..234eb5e 100644 (file)
@@ -406,12 +406,12 @@ ResourceError ResourceLoader::cancelledError()
 
 ResourceError ResourceLoader::blockedError()
 {
-    return frameLoader()->blockedError(m_request);
+    return frameLoader()->client()->blockedError(m_request);
 }
 
 ResourceError ResourceLoader::cannotShowURLError()
 {
-    return frameLoader()->cannotShowURLError(m_request);
+    return frameLoader()->client()->cannotShowURLError(m_request);
 }
 
 void ResourceLoader::willSendRequest(ResourceHandle*, ResourceRequest& request, const ResourceResponse& redirectResponse)
@@ -471,7 +471,7 @@ void ResourceLoader::cannotShowURL(ResourceHandle*)
 bool ResourceLoader::shouldUseCredentialStorage()
 {
     RefPtr<ResourceLoader> protector(this);
-    return frameLoader()->shouldUseCredentialStorage(this);
+    return frameLoader()->client()->shouldUseCredentialStorage(documentLoader(), identifier());
 }
 
 void ResourceLoader::didReceiveAuthenticationChallenge(const AuthenticationChallenge& challenge)
@@ -494,7 +494,7 @@ void ResourceLoader::didCancelAuthenticationChallenge(const AuthenticationChalle
 bool ResourceLoader::canAuthenticateAgainstProtectionSpace(const ProtectionSpace& protectionSpace)
 {
     RefPtr<ResourceLoader> protector(this);
-    return frameLoader()->canAuthenticateAgainstProtectionSpace(this, protectionSpace);
+    return frameLoader()->client()->canAuthenticateAgainstProtectionSpace(documentLoader(), identifier(), protectionSpace);
 }
 #endif
 
index d710f08..bfdc7be 100644 (file)
@@ -47,6 +47,7 @@
 #include "Frame.h"
 #include "FrameLoadRequest.h"
 #include "FrameLoader.h"
+#include "FrameLoaderClient.h"
 #include "FrameSelection.h"
 #include "HTMLFormElement.h"
 #include "HitTestRequest.h"
@@ -694,7 +695,7 @@ void ContextMenuController::populate()
         FrameLoader* loader = frame->loader();
         KURL linkURL = m_hitTestResult.absoluteLinkURL();
         if (!linkURL.isEmpty()) {
-            if (loader->canHandleRequest(ResourceRequest(linkURL))) {
+            if (loader->client()->canHandleRequest(ResourceRequest(linkURL))) {
                 appendItem(OpenLinkItem, m_contextMenu.get());
                 appendItem(OpenLinkInNewWindowItem, m_contextMenu.get());
                 appendItem(DownloadFileItem, m_contextMenu.get());
@@ -855,7 +856,7 @@ void ContextMenuController::populate()
         FrameLoader* loader = frame->loader();
         KURL linkURL = m_hitTestResult.absoluteLinkURL();
         if (!linkURL.isEmpty()) {
-            if (loader->canHandleRequest(ResourceRequest(linkURL))) {
+            if (loader->client()->canHandleRequest(ResourceRequest(linkURL))) {
                 appendItem(OpenLinkItem, m_contextMenu.get());
                 appendItem(OpenLinkInNewWindowItem, m_contextMenu.get());
                 appendItem(DownloadFileItem, m_contextMenu.get());
index c004944..db2b7d0 100644 (file)
@@ -1,3 +1,17 @@
+2011-06-12  Adam Barth  <abarth@webkit.org>
+
+        Reviewed by Alexey Proskuryakov.
+
+        Remove trival "forward-to-client" member functions from FrameLoader
+        https://bugs.webkit.org/show_bug.cgi?id=62510
+
+        Update to call the FrameLoaderClient directly.  Also, remove cargo-cult
+        code that checks whether FrameLoader is null.
+
+        * webkit/webkitwebview.cpp:
+        (webkit_web_view_stop_loading):
+        (webkit_web_view_can_show_mime_type):
+
 2011-06-09  Martin Robinson  <mrobinson@igalia.com>
 
         Reviewed by Eric Seidel.
index ea69b02..ca5788e 100644 (file)
@@ -52,6 +52,7 @@
 #include "FloatQuad.h"
 #include "FocusController.h"
 #include "FrameLoader.h"
+#include "FrameLoaderClient.h"
 #include "FrameLoaderTypes.h"
 #include "FrameView.h"
 #include "GOwnPtrGtk.h"
@@ -3978,10 +3979,7 @@ void webkit_web_view_stop_loading(WebKitWebView* webView)
 {
     g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
 
-    Frame* frame = core(webView)->mainFrame();
-
-    if (FrameLoader* loader = frame->loader())
-        loader->stopForUserCancel();
+    core(webView)->mainFrame()->loader()->stopForUserCancel();
 }
 
 /**
@@ -4356,10 +4354,7 @@ gboolean webkit_web_view_can_show_mime_type(WebKitWebView* webView, const gchar*
     g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), FALSE);
 
     Frame* frame = core(webkit_web_view_get_main_frame(webView));
-    if (FrameLoader* loader = frame->loader())
-        return loader->canShowMIMEType(String::fromUTF8(mimeType));
-    else
-        return FALSE;
+    return frame->loader()->client()->canShowMIMEType(String::fromUTF8(mimeType));
 }
 
 /**
index 9d3a6d2..b041bb0 100644 (file)
@@ -1,3 +1,13 @@
+2011-06-12  Adam Barth  <abarth@webkit.org>
+
+        Reviewed by Alexey Proskuryakov.
+
+        Remove trival "forward-to-client" member functions from FrameLoader
+        https://bugs.webkit.org/show_bug.cgi?id=62510
+
+        * WebCoreSupport/WebFrameNetworkingContext.mm:
+        (WebFrameNetworkingContext::blockedError):
+
 2011-06-10  Tony Chang  <tony@chromium.org>
 
         Reviewed by Ojan Vafai.
index 98b8ce1..5a5c63e 100644 (file)
@@ -19,6 +19,7 @@
 
 #import "WebFrameNetworkingContext.h"
 
+#import <WebCore/FrameLoaderClient.h>
 #import <WebCore/Page.h>
 #import <WebCore/ResourceError.h>
 #import <WebCore/Settings.h>
@@ -42,5 +43,5 @@ SchedulePairHashSet* WebFrameNetworkingContext::scheduledRunLoopPairs() const
 
 ResourceError WebFrameNetworkingContext::blockedError(const ResourceRequest& request) const
 {
-    return frame()->loader()->blockedError(request);
+    return frame()->loader()->client()->blockedError(request);
 }
index 9576792..6c8a870 100644 (file)
@@ -1,3 +1,13 @@
+2011-06-12  Adam Barth  <abarth@webkit.org>
+
+        Reviewed by Alexey Proskuryakov.
+
+        Remove trival "forward-to-client" member functions from FrameLoader
+        https://bugs.webkit.org/show_bug.cgi?id=62510
+
+        * WebCoreSupport/WebFrameNetworkingContext.cpp:
+        (WebFrameNetworkingContext::blockedError):
+
 2011-06-06  Michael Saboff  <msaboff@apple.com>
 
         Reviewed by Geoffrey Garen.
index b87b6d9..40ecf46 100644 (file)
 */
 
 #include "config.h"
-
 #include "WebFrameNetworkingContext.h"
 
+#include "FrameLoaderClient.h"
+
 using namespace WebCore;
 
 PassRefPtr<WebFrameNetworkingContext> WebFrameNetworkingContext::create(Frame* frame, const String& userAgent)
@@ -40,5 +41,5 @@ String WebFrameNetworkingContext::referrer() const
 
 WebCore::ResourceError WebFrameNetworkingContext::blockedError(const WebCore::ResourceRequest& request) const
 {
-    return frame()->loader()->blockedError(request);
+    return frame()->loader()->client()->blockedError(request);
 }
index bc9e5ff..ebfea46 100644 (file)
@@ -1,3 +1,13 @@
+2011-06-12  Adam Barth  <abarth@webkit.org>
+
+        Reviewed by Alexey Proskuryakov.
+
+        Remove trival "forward-to-client" member functions from FrameLoader
+        https://bugs.webkit.org/show_bug.cgi?id=62510
+
+        * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
+        (WebKit::WebFrameNetworkingContext::blockedError):
+
 2011-06-11  Stephanie Lewis  <slewis@apple.com>
 
         Reviewed by Sam Weinig.
index d91e8e8..a954471 100644 (file)
@@ -20,6 +20,7 @@
 #import "config.h"
 #import "WebFrameNetworkingContext.h"
 
+#import <WebCore/FrameLoaderClient.h>
 #import <WebCore/Page.h>
 #import <WebCore/ResourceError.h>
 #import <WebCore/Settings.h>
@@ -45,7 +46,7 @@ SchedulePairHashSet* WebFrameNetworkingContext::scheduledRunLoopPairs() const
 
 ResourceError WebFrameNetworkingContext::blockedError(const ResourceRequest& request) const
 {
-    return frame()->loader()->blockedError(request);
+    return frame()->loader()->client()->blockedError(request);
 }
 
 }