WebCore:
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 Oct 2006 03:28:02 +0000 (03:28 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 Oct 2006 03:28:02 +0000 (03:28 +0000)
        Reviewed by Maciej.

        - converted WebFrameLoader to C++

        * WebCore.exp: Added many new entry points for WebKit.
        * WebCore.xcodeproj/project.pbxproj: Made more files private (SPI).

        * bridge/mac/WebCoreFrameBridge.h:
        * bridge/mac/WebCoreFrameBridge.mm:
        (-[WebCoreFrameBridge initMainFrameWithPage:withEditorClient:]):
        (-[WebCoreFrameBridge initSubframeWithOwnerElement:withEditorClient:]):
        (-[WebCoreFrameBridge dealloc]):
        (-[WebCoreFrameBridge close]):
        (-[WebCoreFrameBridge clearFrame]):
        (-[WebCoreFrameBridge setFrameLoaderClient:]):
        (-[WebCoreFrameBridge frameLoader]):
        (-[WebCoreFrameBridge setTitle:]):
        (-[WebCoreFrameBridge didFirstLayout]):
        (-[WebCoreFrameBridge notifyIconChanged:]):
        (-[WebCoreFrameBridge originalRequestURL]):
        (-[WebCoreFrameBridge isLoadTypeReload]):
        (-[WebCoreFrameBridge frameDetached]):
        (-[WebCoreFrameBridge tokenizerProcessedData]):
        (-[WebCoreFrameBridge receivedData:textEncodingName:]):
        (-[WebCoreFrameBridge startLoadingResource:withMethod:URL:customHeaders:]):
        (-[WebCoreFrameBridge objectLoadedFromCacheWithURL:response:data:]):
        (-[WebCoreFrameBridge startLoadingResource:withMethod:URL:customHeaders:postData:]):
        (-[WebCoreFrameBridge reportClientRedirectToURL:delay:fireDate:lockHistory:isJavaScriptFormAction:]):
        (-[WebCoreFrameBridge reportClientRedirectCancelled:]):
        (-[WebCoreFrameBridge loadURL:referrer:reload:userGesture:target:triggeringEvent:form:formValues:]):
        (-[WebCoreFrameBridge postWithURL:referrer:target:data:contentType:triggeringEvent:form:formValues:]):
        (-[WebCoreFrameBridge syncLoadResourceWithMethod:URL:customHeaders:postData:finalURL:responseHeaders:statusCode:]):
        (-[WebCoreFrameBridge incomingReferrer]):
        (-[WebCoreFrameBridge isReloading]):
        (-[WebCoreFrameBridge handledOnloadEvents]):
        (-[WebCoreFrameBridge mainResourceURLResponse]):
        (-[WebCoreFrameBridge loadEmptyDocumentSynchronously]):
        * loader/mac/WebDocumentLoader.h:
        * loader/mac/WebDocumentLoader.mm:
        (-[WebDocumentLoader frameLoader]):
        (-[WebDocumentLoader dealloc]):
        (-[WebDocumentLoader mainResourceData]):
        (-[WebDocumentLoader setRequest:]):
        (-[WebDocumentLoader bridge]):
        (-[WebDocumentLoader setMainDocumentError:]):
        (-[WebDocumentLoader mainReceivedError:complete:]):
        (-[WebDocumentLoader stopLoading]):
        (-[WebDocumentLoader setupForReplace]):
        (-[WebDocumentLoader commitIfReady]):
        (-[WebDocumentLoader finishedLoading]):
        (-[WebDocumentLoader commitLoadWithData:]):
        (-[WebDocumentLoader doesProgressiveLoadWithMIMEType:]):
        (-[WebDocumentLoader setupForReplaceByMIMEType:]):
        (-[WebDocumentLoader updateLoading]):
        (-[WebDocumentLoader setFrame:]):
        (-[WebDocumentLoader attachToFrame]):
        (-[WebDocumentLoader detachFromFrame]):
        (-[WebDocumentLoader prepareForLoadStart]):
        (-[WebDocumentLoader setPrimaryLoadComplete:]):
        (-[WebDocumentLoader isLoadingInAPISense]):
        (-[WebDocumentLoader setTitle:]):
        * loader/mac/WebFrameLoader.h:
        (WebCore::FrameLoader::frame):
        * loader/mac/WebFrameLoader.mm:
        (WebCore::FrameLoader::FrameLoader):
        (WebCore::FrameLoader::~FrameLoader):
        (WebCore::FrameLoader::activeDocumentLoader):
        (WebCore::FrameLoader::addPlugInStreamLoader):
        (WebCore::FrameLoader::removePlugInStreamLoader):
        (WebCore::FrameLoader::defersCallbacksChanged):
        (WebCore::FrameLoader::defersCallbacks):
        (WebCore::setAllDefersCallbacks):
        (WebCore::FrameLoader::setDefersCallbacks):
        (WebCore::cancelAll):
        (WebCore::FrameLoader::stopLoadingPlugIns):
        (WebCore::FrameLoader::isLoadingMainResource):
        (WebCore::FrameLoader::isLoadingSubresources):
        (WebCore::FrameLoader::isLoadingPlugIns):
        (WebCore::FrameLoader::isLoading):
        (WebCore::FrameLoader::stopLoadingSubresources):
        (WebCore::FrameLoader::addSubresourceLoader):
        (WebCore::FrameLoader::removeSubresourceLoader):
        (WebCore::FrameLoader::mainResourceData):
        (WebCore::FrameLoader::releaseMainResourceLoader):
        (WebCore::FrameLoader::cancelMainResourceLoad):
        (WebCore::FrameLoader::startLoadingMainResource):
        (WebCore::FrameLoader::stopLoading):
        (WebCore::FrameLoader::setDocumentLoader):
        (WebCore::FrameLoader::documentLoader):
        (WebCore::FrameLoader::setPolicyDocumentLoader):
        (WebCore::FrameLoader::provisionalDocumentLoader):
        (WebCore::FrameLoader::setProvisionalDocumentLoader):
        (WebCore::FrameLoader::state):
        (WebCore::FrameLoader::timeOfLastCompletedLoad):
        (WebCore::FrameLoader::provisionalLoadStarted):
        (WebCore::FrameLoader::setState):
        (WebCore::FrameLoader::clearProvisionalLoad):
        (WebCore::FrameLoader::markLoadComplete):
        (WebCore::FrameLoader::commitProvisionalLoad):
        (WebCore::FrameLoader::stopLoadingSubframes):
        (WebCore::FrameLoader::startLoading):
        (WebCore::FrameLoader::setupForReplace):
        (WebCore::FrameLoader::identifierForInitialRequest):
        (WebCore::FrameLoader::willSendRequest):
        (WebCore::FrameLoader::didReceiveAuthenticationChallenge):
        (WebCore::FrameLoader::didCancelAuthenticationChallenge):
        (WebCore::FrameLoader::didReceiveResponse):
        (WebCore::FrameLoader::didReceiveData):
        (WebCore::FrameLoader::didFinishLoad):
        (WebCore::FrameLoader::didFailToLoad):
        (WebCore::FrameLoader::privateBrowsingEnabled):
        (WebCore::FrameLoader::originalRequest):
        (WebCore::FrameLoader::receivedMainResourceError):
        (WebCore::FrameLoader::clientRedirectCancelledOrFinished):
        (WebCore::FrameLoader::clientRedirected):
        (WebCore::FrameLoader::shouldReload):
        (WebCore::FrameLoader::load):
        (WebCore::FrameLoader::continueFragmentScrollAfterNavigationPolicy):
        (WebCore::FrameLoader::closeOldDataSources):
        (WebCore::FrameLoader::opened):
        (WebCore::FrameLoader::initialRequest):
        (WebCore::FrameLoader::receivedData):
        (WebCore::FrameLoader::setRequest):
        (WebCore::FrameLoader::download):
        (WebCore::FrameLoader::bridge):
        (WebCore::FrameLoader::handleFallbackContent):
        (WebCore::FrameLoader::isStopping):
        (WebCore::FrameLoader::setupForReplaceByMIMEType):
        (WebCore::FrameLoader::setResponse):
        (WebCore::FrameLoader::mainReceivedError):
        (WebCore::FrameLoader::finishedLoading):
        (WebCore::FrameLoader::notifyIconChanged):
        (WebCore::FrameLoader::URL):
        (WebCore::FrameLoader::cancelledError):
        (WebCore::FrameLoader::fileDoesNotExistError):
        (WebCore::FrameLoader::willUseArchive):
        (WebCore::FrameLoader::isArchiveLoadPending):
        (WebCore::FrameLoader::cancelPendingArchiveLoad):
        (WebCore::FrameLoader::handleUnimplementablePolicy):
        (WebCore::FrameLoader::cannotShowMIMEType):
        (WebCore::FrameLoader::interruptionForPolicyChangeError):
        (WebCore::FrameLoader::isHostedByObjectElement):
        (WebCore::FrameLoader::isLoadingMainFrame):
        (WebCore::FrameLoader::canShowMIMEType):
        (WebCore::FrameLoader::representationExistsForURLScheme):
        (WebCore::FrameLoader::generatedMIMETypeForURLScheme):
        (WebCore::FrameLoader::checkNavigationPolicy):
        (WebCore::FrameLoader::checkContentPolicy):
        (WebCore::FrameLoader::cancelContentPolicyCheck):
        (WebCore::FrameLoader::shouldReloadToHandleUnreachableURL):
        (WebCore::FrameLoader::reloadAllowingStaleData):
        (WebCore::FrameLoader::reload):
        (WebCore::FrameLoader::didReceiveServerRedirectForProvisionalLoadForFrame):
        (WebCore::FrameLoader::finishedLoadingDocument):
        (WebCore::FrameLoader::committedLoad):
        (WebCore::FrameLoader::isReplacing):
        (WebCore::FrameLoader::setReplacing):
        (WebCore::FrameLoader::revertToProvisional):
        (WebCore::FrameLoader::setMainDocumentError):
        (WebCore::FrameLoader::mainReceivedCompleteError):
        (WebCore::FrameLoader::finalSetupForReplace):
        (WebCore::FrameLoader::prepareForLoadStart):
        (WebCore::FrameLoader::subframeIsLoading):
        (WebCore::FrameLoader::willChangeTitle):
        (WebCore::FrameLoader::didChangeTitle):
        (WebCore::FrameLoader::loadType):
        (WebCore::FrameLoader::invalidatePendingPolicyDecision):
        (WebCore::FrameLoader::checkNewWindowPolicy):
        (WebCore::FrameLoader::continueAfterNewWindowPolicy):
        (WebCore::FrameLoader::continueAfterNavigationPolicy):
        (WebCore::FrameLoader::continueAfterWillSubmitForm):
        (WebCore::FrameLoader::continueLoadRequestAfterNavigationPolicy):
        (WebCore::FrameLoader::didFirstLayout):
        (WebCore::FrameLoader::frameLoadCompleted):
        (WebCore::FrameLoader::firstLayoutDone):
        (WebCore::FrameLoader::isQuickRedirectComing):
        (WebCore::FrameLoader::transitionToCommitted):
        (WebCore::FrameLoader::checkLoadCompleteForThisFrame):
        (WebCore::FrameLoader::continueLoadRequestAfterNewWindowPolicy):
        (WebCore::FrameLoader::sendRemainingDelegateMessages):
        (WebCore::FrameLoader::requestFromDelegate):
        (WebCore::FrameLoader::post):
        (WebCore::FrameLoader::detachChildren):
        (WebCore::FrameLoader::detachFromParent):
        (WebCore::FrameLoader::addExtraFieldsToRequest):
        (WebCore::FrameLoader::safeLoad):
        (WebCore::FrameLoader::actionInformation):
        (WebCore::FrameLoader::checkLoadComplete):
        (WebCore::FrameLoader::setFrameLoaderClient):
        (WebCore::FrameLoader::client):
        (WebCore::FrameLoader::asDelegate):
        (-[WebCoreFrameLoaderAsDelegate initWithLoader:]):
        (-[WebCoreFrameLoaderAsDelegate detachFromLoader]):
        (-[WebCoreFrameLoaderAsDelegate continueFragmentScrollAfterNavigationPolicy:formState:]):
        (-[WebCoreFrameLoaderAsDelegate continueAfterNewWindowPolicy:]):
        (-[WebCoreFrameLoaderAsDelegate continueAfterNavigationPolicy:]):
        (-[WebCoreFrameLoaderAsDelegate continueAfterWillSubmitForm:]):
        (-[WebCoreFrameLoaderAsDelegate continueLoadRequestAfterNavigationPolicy:formState:]):
        (-[WebCoreFrameLoaderAsDelegate continueLoadRequestAfterNewWindowPolicy:frameName:formState:]):
        * loader/mac/WebLoader.h:
        (WebCore::WebResourceLoader::identifier):
        (WebCore::WebResourceLoader::reachedTerminalState):
        (WebCore::WebResourceLoader::cancelled):
        * loader/mac/WebLoader.mm:
        (WebCore::WebResourceLoader::WebResourceLoader):
        (WebCore::WebResourceLoader::releaseResources):
        (WebCore::WebResourceLoader::load):
        (WebCore::WebResourceLoader::frameLoader):
        (WebCore::WebResourceLoader::willSendRequest):
        (WebCore::WebResourceLoader::didReceiveAuthenticationChallenge):
        (WebCore::WebResourceLoader::didCancelAuthenticationChallenge):
        (WebCore::WebResourceLoader::didReceiveResponse):
        (WebCore::WebResourceLoader::didReceiveData):
        (WebCore::WebResourceLoader::didFinishLoading):
        (WebCore::WebResourceLoader::didFinishLoadingOnePart):
        (WebCore::WebResourceLoader::didFail):
        (WebCore::WebResourceLoader::willCacheResponse):
        (WebCore::WebResourceLoader::didCancel):
        (WebCore::WebResourceLoader::cancel):
        (WebCore::WebResourceLoader::cancelledError):
        (WebCore::WebResourceLoader::delegate):
        * loader/mac/WebMainResourceLoader.h:
        * loader/mac/WebMainResourceLoader.mm:
        (WebCore::MainResourceLoader::MainResourceLoader):
        (WebCore::MainResourceLoader::create):
        (WebCore::MainResourceLoader::receivedError):
        (WebCore::MainResourceLoader::didCancel):
        (WebCore::MainResourceLoader::interruptionForPolicyChangeError):
        (WebCore::MainResourceLoader::isPostOrRedirectAfterPost):
        (WebCore::MainResourceLoader::addData):
        (WebCore::MainResourceLoader::willSendRequest):
        (WebCore::MainResourceLoader::continueAfterContentPolicy):
        (WebCore::MainResourceLoader::didReceiveResponse):
        (WebCore::MainResourceLoader::didReceiveData):
        (WebCore::MainResourceLoader::didFinishLoading):
        (WebCore::MainResourceLoader::didFail):
        (WebCore::MainResourceLoader::loadNow):
        (WebCore::MainResourceLoader::policyDelegate):
        * loader/mac/WebNetscapePlugInStreamLoader.h:
        * loader/mac/WebNetscapePlugInStreamLoader.mm:
        (WebCore::NetscapePlugInStreamLoader::NetscapePlugInStreamLoader):
        (WebCore::NetscapePlugInStreamLoader::create):
        (WebCore::NetscapePlugInStreamLoader::didReceiveResponse):
        (WebCore::NetscapePlugInStreamLoader::didFinishLoading):
        (WebCore::NetscapePlugInStreamLoader::didFail):
        (WebCore::NetscapePlugInStreamLoader::didCancel):
        * loader/mac/WebSubresourceLoader.h:
        * loader/mac/WebSubresourceLoader.mm:
        (-[WebCoreSubresourceHandle initWithLoader:]):

WebKit:

        Reviewed by Maciej.

        - converted WebFrameLoader to C++

        * History/WebHistoryItem.m:
        (+[WebHistoryItem _closeObjectsInPendingPageCaches]):
        * Plugins/WebBaseNetscapePluginView.mm:
        (-[WebBaseNetscapePluginView loadRequest:inTarget:withNotifyData:sendNotification:]):
        * Plugins/WebNetscapePluginStream.mm:
        (-[WebNetscapePluginStream start]):
        (-[WebNetscapePluginStream stop]):
        * Plugins/WebPluginController.mm:
        (-[WebPluginController webPlugInContainerLoadRequest:inFrame:]):
        (-[WebPluginController pluginView:receivedResponse:]):
        * WebCoreSupport/WebFrameBridge.h:
        * WebKit.xcodeproj/project.pbxproj:
        * WebView/WebDataSource.mm:
        (-[WebDataSource _loadFromPageCache:]):
        (-[WebDataSource _webView]):
        (-[WebDataSource webFrame]):
        * WebView/WebDocumentLoaderMac.h:
        * WebView/WebDocumentLoaderMac.m:
        (-[WebDocumentLoaderMac dealloc]):
        (-[WebDocumentLoaderMac attachToFrame]):
        (-[WebDocumentLoaderMac detachFromFrame]):
        * WebView/WebFrame.mm:
        (+[WebFrame _timeOfLastCompletedLoad]):
        (-[WebFrame _loadItem:withLoadType:]):
        (-[WebFrame _loadURL:referrer:intoChild:]):
        (-[WebFrame _currentBackForwardListItemToResetTo]):
        (-[WebFrame _itemForRestoringDocState]):
        (-[WebFrame _frameLoader]):
        (-[WebFrame _firstLayoutDone]):
        (-[WebFrame _loadType]):
        (-[WebFrame provisionalDataSource]):
        (-[WebFrame dataSource]):
        (-[WebFrame loadRequest:]):
        (-[WebFrame loadArchive:]):
        (-[WebFrame stopLoading]):
        (-[WebFrame reload]):
        (-[WebFrame _updateHistoryForCommit]):
        (-[WebFrame _updateHistoryForReload]):
        (-[WebFrame _updateHistoryForInternalLoad]):
        (-[WebFrame _deliverArchivedResourcesAfterDelay]):
        (-[WebFrame _willUseArchiveForRequest:originalURL:loader:]):
        (-[WebFrame _deliverArchivedResources]):
        (-[WebFrame _prepareForDataSourceReplacement]):
        (-[WebFrame _provisionalLoadStarted]):
        * WebView/WebFrameInternal.h:
        * WebView/WebHTMLView.m:
        (-[WebHTMLView _clearLastHitViewIfSelf]):
        (-[WebHTMLView _updateMouseoverWithEvent:]):
        (-[NSArray removeMouseMovedObserverUnconditionally]):
        (-[NSArray removeMouseMovedObserver]):
        (-[NSArray viewWillMoveToWindow:]):
        (-[NSArray viewDidMoveToWindow]):
        (-[WebHTMLView _canMakeTextSmaller]):
        (-[WebHTMLView _canMakeTextLarger]):
        (-[WebHTMLView _canMakeTextStandardSize]):
        * WebView/WebPDFView.mm:
        (-[WebPDFView PDFViewWillClickOnLink:withURL:]):
        * WebView/WebView.mm:
        (-[WebView _close]):
        (-[WebView setDefersCallbacks:]):
        (-[WebView setCustomTextEncodingName:]):

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

32 files changed:
WebCore/ChangeLog
WebCore/WebCore.exp
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/bridge/mac/WebCoreFrameBridge.h
WebCore/bridge/mac/WebCoreFrameBridge.mm
WebCore/loader/mac/WebDocumentLoader.h
WebCore/loader/mac/WebDocumentLoader.mm
WebCore/loader/mac/WebFrameLoader.h
WebCore/loader/mac/WebFrameLoader.mm
WebCore/loader/mac/WebLoader.h
WebCore/loader/mac/WebLoader.mm
WebCore/loader/mac/WebMainResourceLoader.h
WebCore/loader/mac/WebMainResourceLoader.mm
WebCore/loader/mac/WebNetscapePlugInStreamLoader.h
WebCore/loader/mac/WebNetscapePlugInStreamLoader.mm
WebCore/loader/mac/WebSubresourceLoader.h
WebCore/loader/mac/WebSubresourceLoader.mm
WebKit/ChangeLog
WebKit/History/WebHistoryItem.m
WebKit/Plugins/WebBaseNetscapePluginView.mm
WebKit/Plugins/WebNetscapePluginStream.mm
WebKit/Plugins/WebPluginController.mm
WebKit/WebCoreSupport/WebFrameBridge.h
WebKit/WebKit.xcodeproj/project.pbxproj
WebKit/WebView/WebDataSource.mm
WebKit/WebView/WebDocumentLoaderMac.h
WebKit/WebView/WebDocumentLoaderMac.m
WebKit/WebView/WebFrame.mm
WebKit/WebView/WebFrameInternal.h
WebKit/WebView/WebHTMLView.m
WebKit/WebView/WebPDFView.mm
WebKit/WebView/WebView.mm

index b7c4c979652321eb4f02f1c74ff5360110c12a17..a16c0e0e0c1d1677845c2859ce5e6685d5a49116 100644 (file)
@@ -1,3 +1,255 @@
+2006-10-23  Darin Adler  <darin@apple.com>
+
+        Reviewed by Maciej.
+
+        - converted WebFrameLoader to C++
+
+        * WebCore.exp: Added many new entry points for WebKit.
+        * WebCore.xcodeproj/project.pbxproj: Made more files private (SPI).
+
+        * bridge/mac/WebCoreFrameBridge.h:
+        * bridge/mac/WebCoreFrameBridge.mm:
+        (-[WebCoreFrameBridge initMainFrameWithPage:withEditorClient:]):
+        (-[WebCoreFrameBridge initSubframeWithOwnerElement:withEditorClient:]):
+        (-[WebCoreFrameBridge dealloc]):
+        (-[WebCoreFrameBridge close]):
+        (-[WebCoreFrameBridge clearFrame]):
+        (-[WebCoreFrameBridge setFrameLoaderClient:]):
+        (-[WebCoreFrameBridge frameLoader]):
+        (-[WebCoreFrameBridge setTitle:]):
+        (-[WebCoreFrameBridge didFirstLayout]):
+        (-[WebCoreFrameBridge notifyIconChanged:]):
+        (-[WebCoreFrameBridge originalRequestURL]):
+        (-[WebCoreFrameBridge isLoadTypeReload]):
+        (-[WebCoreFrameBridge frameDetached]):
+        (-[WebCoreFrameBridge tokenizerProcessedData]):
+        (-[WebCoreFrameBridge receivedData:textEncodingName:]):
+        (-[WebCoreFrameBridge startLoadingResource:withMethod:URL:customHeaders:]):
+        (-[WebCoreFrameBridge objectLoadedFromCacheWithURL:response:data:]):
+        (-[WebCoreFrameBridge startLoadingResource:withMethod:URL:customHeaders:postData:]):
+        (-[WebCoreFrameBridge reportClientRedirectToURL:delay:fireDate:lockHistory:isJavaScriptFormAction:]):
+        (-[WebCoreFrameBridge reportClientRedirectCancelled:]):
+        (-[WebCoreFrameBridge loadURL:referrer:reload:userGesture:target:triggeringEvent:form:formValues:]):
+        (-[WebCoreFrameBridge postWithURL:referrer:target:data:contentType:triggeringEvent:form:formValues:]):
+        (-[WebCoreFrameBridge syncLoadResourceWithMethod:URL:customHeaders:postData:finalURL:responseHeaders:statusCode:]):
+        (-[WebCoreFrameBridge incomingReferrer]):
+        (-[WebCoreFrameBridge isReloading]):
+        (-[WebCoreFrameBridge handledOnloadEvents]):
+        (-[WebCoreFrameBridge mainResourceURLResponse]):
+        (-[WebCoreFrameBridge loadEmptyDocumentSynchronously]):
+        * loader/mac/WebDocumentLoader.h:
+        * loader/mac/WebDocumentLoader.mm:
+        (-[WebDocumentLoader frameLoader]):
+        (-[WebDocumentLoader dealloc]):
+        (-[WebDocumentLoader mainResourceData]):
+        (-[WebDocumentLoader setRequest:]):
+        (-[WebDocumentLoader bridge]):
+        (-[WebDocumentLoader setMainDocumentError:]):
+        (-[WebDocumentLoader mainReceivedError:complete:]):
+        (-[WebDocumentLoader stopLoading]):
+        (-[WebDocumentLoader setupForReplace]):
+        (-[WebDocumentLoader commitIfReady]):
+        (-[WebDocumentLoader finishedLoading]):
+        (-[WebDocumentLoader commitLoadWithData:]):
+        (-[WebDocumentLoader doesProgressiveLoadWithMIMEType:]):
+        (-[WebDocumentLoader setupForReplaceByMIMEType:]):
+        (-[WebDocumentLoader updateLoading]):
+        (-[WebDocumentLoader setFrame:]):
+        (-[WebDocumentLoader attachToFrame]):
+        (-[WebDocumentLoader detachFromFrame]):
+        (-[WebDocumentLoader prepareForLoadStart]):
+        (-[WebDocumentLoader setPrimaryLoadComplete:]):
+        (-[WebDocumentLoader isLoadingInAPISense]):
+        (-[WebDocumentLoader setTitle:]):
+        * loader/mac/WebFrameLoader.h:
+        (WebCore::FrameLoader::frame):
+        * loader/mac/WebFrameLoader.mm:
+        (WebCore::FrameLoader::FrameLoader):
+        (WebCore::FrameLoader::~FrameLoader):
+        (WebCore::FrameLoader::activeDocumentLoader):
+        (WebCore::FrameLoader::addPlugInStreamLoader):
+        (WebCore::FrameLoader::removePlugInStreamLoader):
+        (WebCore::FrameLoader::defersCallbacksChanged):
+        (WebCore::FrameLoader::defersCallbacks):
+        (WebCore::setAllDefersCallbacks):
+        (WebCore::FrameLoader::setDefersCallbacks):
+        (WebCore::cancelAll):
+        (WebCore::FrameLoader::stopLoadingPlugIns):
+        (WebCore::FrameLoader::isLoadingMainResource):
+        (WebCore::FrameLoader::isLoadingSubresources):
+        (WebCore::FrameLoader::isLoadingPlugIns):
+        (WebCore::FrameLoader::isLoading):
+        (WebCore::FrameLoader::stopLoadingSubresources):
+        (WebCore::FrameLoader::addSubresourceLoader):
+        (WebCore::FrameLoader::removeSubresourceLoader):
+        (WebCore::FrameLoader::mainResourceData):
+        (WebCore::FrameLoader::releaseMainResourceLoader):
+        (WebCore::FrameLoader::cancelMainResourceLoad):
+        (WebCore::FrameLoader::startLoadingMainResource):
+        (WebCore::FrameLoader::stopLoading):
+        (WebCore::FrameLoader::setDocumentLoader):
+        (WebCore::FrameLoader::documentLoader):
+        (WebCore::FrameLoader::setPolicyDocumentLoader):
+        (WebCore::FrameLoader::provisionalDocumentLoader):
+        (WebCore::FrameLoader::setProvisionalDocumentLoader):
+        (WebCore::FrameLoader::state):
+        (WebCore::FrameLoader::timeOfLastCompletedLoad):
+        (WebCore::FrameLoader::provisionalLoadStarted):
+        (WebCore::FrameLoader::setState):
+        (WebCore::FrameLoader::clearProvisionalLoad):
+        (WebCore::FrameLoader::markLoadComplete):
+        (WebCore::FrameLoader::commitProvisionalLoad):
+        (WebCore::FrameLoader::stopLoadingSubframes):
+        (WebCore::FrameLoader::startLoading):
+        (WebCore::FrameLoader::setupForReplace):
+        (WebCore::FrameLoader::identifierForInitialRequest):
+        (WebCore::FrameLoader::willSendRequest):
+        (WebCore::FrameLoader::didReceiveAuthenticationChallenge):
+        (WebCore::FrameLoader::didCancelAuthenticationChallenge):
+        (WebCore::FrameLoader::didReceiveResponse):
+        (WebCore::FrameLoader::didReceiveData):
+        (WebCore::FrameLoader::didFinishLoad):
+        (WebCore::FrameLoader::didFailToLoad):
+        (WebCore::FrameLoader::privateBrowsingEnabled):
+        (WebCore::FrameLoader::originalRequest):
+        (WebCore::FrameLoader::receivedMainResourceError):
+        (WebCore::FrameLoader::clientRedirectCancelledOrFinished):
+        (WebCore::FrameLoader::clientRedirected):
+        (WebCore::FrameLoader::shouldReload):
+        (WebCore::FrameLoader::load):
+        (WebCore::FrameLoader::continueFragmentScrollAfterNavigationPolicy):
+        (WebCore::FrameLoader::closeOldDataSources):
+        (WebCore::FrameLoader::opened):
+        (WebCore::FrameLoader::initialRequest):
+        (WebCore::FrameLoader::receivedData):
+        (WebCore::FrameLoader::setRequest):
+        (WebCore::FrameLoader::download):
+        (WebCore::FrameLoader::bridge):
+        (WebCore::FrameLoader::handleFallbackContent):
+        (WebCore::FrameLoader::isStopping):
+        (WebCore::FrameLoader::setupForReplaceByMIMEType):
+        (WebCore::FrameLoader::setResponse):
+        (WebCore::FrameLoader::mainReceivedError):
+        (WebCore::FrameLoader::finishedLoading):
+        (WebCore::FrameLoader::notifyIconChanged):
+        (WebCore::FrameLoader::URL):
+        (WebCore::FrameLoader::cancelledError):
+        (WebCore::FrameLoader::fileDoesNotExistError):
+        (WebCore::FrameLoader::willUseArchive):
+        (WebCore::FrameLoader::isArchiveLoadPending):
+        (WebCore::FrameLoader::cancelPendingArchiveLoad):
+        (WebCore::FrameLoader::handleUnimplementablePolicy):
+        (WebCore::FrameLoader::cannotShowMIMEType):
+        (WebCore::FrameLoader::interruptionForPolicyChangeError):
+        (WebCore::FrameLoader::isHostedByObjectElement):
+        (WebCore::FrameLoader::isLoadingMainFrame):
+        (WebCore::FrameLoader::canShowMIMEType):
+        (WebCore::FrameLoader::representationExistsForURLScheme):
+        (WebCore::FrameLoader::generatedMIMETypeForURLScheme):
+        (WebCore::FrameLoader::checkNavigationPolicy):
+        (WebCore::FrameLoader::checkContentPolicy):
+        (WebCore::FrameLoader::cancelContentPolicyCheck):
+        (WebCore::FrameLoader::shouldReloadToHandleUnreachableURL):
+        (WebCore::FrameLoader::reloadAllowingStaleData):
+        (WebCore::FrameLoader::reload):
+        (WebCore::FrameLoader::didReceiveServerRedirectForProvisionalLoadForFrame):
+        (WebCore::FrameLoader::finishedLoadingDocument):
+        (WebCore::FrameLoader::committedLoad):
+        (WebCore::FrameLoader::isReplacing):
+        (WebCore::FrameLoader::setReplacing):
+        (WebCore::FrameLoader::revertToProvisional):
+        (WebCore::FrameLoader::setMainDocumentError):
+        (WebCore::FrameLoader::mainReceivedCompleteError):
+        (WebCore::FrameLoader::finalSetupForReplace):
+        (WebCore::FrameLoader::prepareForLoadStart):
+        (WebCore::FrameLoader::subframeIsLoading):
+        (WebCore::FrameLoader::willChangeTitle):
+        (WebCore::FrameLoader::didChangeTitle):
+        (WebCore::FrameLoader::loadType):
+        (WebCore::FrameLoader::invalidatePendingPolicyDecision):
+        (WebCore::FrameLoader::checkNewWindowPolicy):
+        (WebCore::FrameLoader::continueAfterNewWindowPolicy):
+        (WebCore::FrameLoader::continueAfterNavigationPolicy):
+        (WebCore::FrameLoader::continueAfterWillSubmitForm):
+        (WebCore::FrameLoader::continueLoadRequestAfterNavigationPolicy):
+        (WebCore::FrameLoader::didFirstLayout):
+        (WebCore::FrameLoader::frameLoadCompleted):
+        (WebCore::FrameLoader::firstLayoutDone):
+        (WebCore::FrameLoader::isQuickRedirectComing):
+        (WebCore::FrameLoader::transitionToCommitted):
+        (WebCore::FrameLoader::checkLoadCompleteForThisFrame):
+        (WebCore::FrameLoader::continueLoadRequestAfterNewWindowPolicy):
+        (WebCore::FrameLoader::sendRemainingDelegateMessages):
+        (WebCore::FrameLoader::requestFromDelegate):
+        (WebCore::FrameLoader::post):
+        (WebCore::FrameLoader::detachChildren):
+        (WebCore::FrameLoader::detachFromParent):
+        (WebCore::FrameLoader::addExtraFieldsToRequest):
+        (WebCore::FrameLoader::safeLoad):
+        (WebCore::FrameLoader::actionInformation):
+        (WebCore::FrameLoader::checkLoadComplete):
+        (WebCore::FrameLoader::setFrameLoaderClient):
+        (WebCore::FrameLoader::client):
+        (WebCore::FrameLoader::asDelegate):
+        (-[WebCoreFrameLoaderAsDelegate initWithLoader:]):
+        (-[WebCoreFrameLoaderAsDelegate detachFromLoader]):
+        (-[WebCoreFrameLoaderAsDelegate continueFragmentScrollAfterNavigationPolicy:formState:]):
+        (-[WebCoreFrameLoaderAsDelegate continueAfterNewWindowPolicy:]):
+        (-[WebCoreFrameLoaderAsDelegate continueAfterNavigationPolicy:]):
+        (-[WebCoreFrameLoaderAsDelegate continueAfterWillSubmitForm:]):
+        (-[WebCoreFrameLoaderAsDelegate continueLoadRequestAfterNavigationPolicy:formState:]):
+        (-[WebCoreFrameLoaderAsDelegate continueLoadRequestAfterNewWindowPolicy:frameName:formState:]):
+        * loader/mac/WebLoader.h:
+        (WebCore::WebResourceLoader::identifier):
+        (WebCore::WebResourceLoader::reachedTerminalState):
+        (WebCore::WebResourceLoader::cancelled):
+        * loader/mac/WebLoader.mm:
+        (WebCore::WebResourceLoader::WebResourceLoader):
+        (WebCore::WebResourceLoader::releaseResources):
+        (WebCore::WebResourceLoader::load):
+        (WebCore::WebResourceLoader::frameLoader):
+        (WebCore::WebResourceLoader::willSendRequest):
+        (WebCore::WebResourceLoader::didReceiveAuthenticationChallenge):
+        (WebCore::WebResourceLoader::didCancelAuthenticationChallenge):
+        (WebCore::WebResourceLoader::didReceiveResponse):
+        (WebCore::WebResourceLoader::didReceiveData):
+        (WebCore::WebResourceLoader::didFinishLoading):
+        (WebCore::WebResourceLoader::didFinishLoadingOnePart):
+        (WebCore::WebResourceLoader::didFail):
+        (WebCore::WebResourceLoader::willCacheResponse):
+        (WebCore::WebResourceLoader::didCancel):
+        (WebCore::WebResourceLoader::cancel):
+        (WebCore::WebResourceLoader::cancelledError):
+        (WebCore::WebResourceLoader::delegate):
+        * loader/mac/WebMainResourceLoader.h:
+        * loader/mac/WebMainResourceLoader.mm:
+        (WebCore::MainResourceLoader::MainResourceLoader):
+        (WebCore::MainResourceLoader::create):
+        (WebCore::MainResourceLoader::receivedError):
+        (WebCore::MainResourceLoader::didCancel):
+        (WebCore::MainResourceLoader::interruptionForPolicyChangeError):
+        (WebCore::MainResourceLoader::isPostOrRedirectAfterPost):
+        (WebCore::MainResourceLoader::addData):
+        (WebCore::MainResourceLoader::willSendRequest):
+        (WebCore::MainResourceLoader::continueAfterContentPolicy):
+        (WebCore::MainResourceLoader::didReceiveResponse):
+        (WebCore::MainResourceLoader::didReceiveData):
+        (WebCore::MainResourceLoader::didFinishLoading):
+        (WebCore::MainResourceLoader::didFail):
+        (WebCore::MainResourceLoader::loadNow):
+        (WebCore::MainResourceLoader::policyDelegate):
+        * loader/mac/WebNetscapePlugInStreamLoader.h:
+        * loader/mac/WebNetscapePlugInStreamLoader.mm:
+        (WebCore::NetscapePlugInStreamLoader::NetscapePlugInStreamLoader):
+        (WebCore::NetscapePlugInStreamLoader::create):
+        (WebCore::NetscapePlugInStreamLoader::didReceiveResponse):
+        (WebCore::NetscapePlugInStreamLoader::didFinishLoading):
+        (WebCore::NetscapePlugInStreamLoader::didFail):
+        (WebCore::NetscapePlugInStreamLoader::didCancel):
+        * loader/mac/WebSubresourceLoader.h:
+        * loader/mac/WebSubresourceLoader.mm:
+        (-[WebCoreSubresourceHandle initWithLoader:]):
+
 2006-10-23  Geoffrey Garen  <ggaren@apple.com>
 
         Reviewed by Bradee.
index 7a862987b44b6ff6793d4750f4d46188bbc172e3..26e6e07cf12764c9ce2519c78eea438b26d43a26 100644 (file)
 .objc_class_name_WebCoreViewFactory
 .objc_class_name_WebDashboardRegion
 .objc_class_name_WebDocumentLoader
-.objc_class_name_WebFrameLoader
 .objc_class_name_WebPolicyDecider
 .objc_class_name_WebScriptObject
 .objc_class_name_WebScriptObjectPrivate
@@ -131,11 +130,41 @@ _WebCoreSetAlwaysUseATSU
 _WebCoreSetShouldUseFontSmoothing
 _WebCoreShouldUseFontSmoothing
 _WebCoreTextFloatWidth
-__Z21isBackForwardLoadType13FrameLoadType
 __ZN7WebCore10StringImplD1Ev
+__ZN7WebCore11FrameLoader11stopLoadingEP7NSError
+__ZN7WebCore11FrameLoader11stopLoadingEv
+__ZN7WebCore11FrameLoader12shouldReloadEP5NSURLS2_
+__ZN7WebCore11FrameLoader14detachChildrenEv
+__ZN7WebCore11FrameLoader16detachFromParentEv
+__ZN7WebCore11FrameLoader17actionInformationE13FrameLoadTypebP7NSEventP5NSURL
+__ZN7WebCore11FrameLoader17actionInformationE14NavigationTypeP7NSEventP5NSURL
+__ZN7WebCore11FrameLoader21addPlugInStreamLoaderEPNS_17WebResourceLoaderE
+__ZN7WebCore11FrameLoader21commitProvisionalLoadEP12NSDictionary
+__ZN7WebCore11FrameLoader22defersCallbacksChangedEv
+__ZN7WebCore11FrameLoader23addExtraFieldsToRequestEP19NSMutableURLRequestbb
+__ZN7WebCore11FrameLoader23reloadAllowingStaleDataEP8NSString
+__ZN7WebCore11FrameLoader23timeOfLastCompletedLoadEv
+__ZN7WebCore11FrameLoader24removePlugInStreamLoaderEPNS_17WebResourceLoaderE
+__ZN7WebCore11FrameLoader25provisionalDocumentLoaderEv
+__ZN7WebCore11FrameLoader4loadEP12NSURLRequest
+__ZN7WebCore11FrameLoader4loadEP12NSURLRequestP12NSDictionary13FrameLoadTypeN3WTF10PassRefPtrINS_9FormStateEEE
+__ZN7WebCore11FrameLoader4loadEP12NSURLRequestP8NSString
+__ZN7WebCore11FrameLoader4loadEP17WebDocumentLoader
+__ZN7WebCore11FrameLoader4loadEP17WebDocumentLoader13FrameLoadTypeN3WTF10PassRefPtrINS_9FormStateEEE
+__ZN7WebCore11FrameLoader4loadEP5NSURLP8NSString13FrameLoadTypeS4_P7NSEventP10DOMElementP12NSDictionary
+__ZN7WebCore11FrameLoader6reloadEv
+__ZN7WebCore11FrameLoader8safeLoadEP5NSURL
 __ZN7WebCore17WebResourceLoader14cancelledErrorEv
 __ZN7WebCore17WebResourceLoader20inConnectionCallbackEv
-__ZN7WebCore26NetscapePlugInStreamLoader6createEP14WebFrameLoaderP11objc_object
+__ZN7WebCore21isBackForwardLoadTypeE13FrameLoadType
+__ZN7WebCore26NetscapePlugInStreamLoader6createEPNS_5FrameEP11objc_object
+__ZNK7WebCore11FrameLoader14documentLoaderEv
+__ZNK7WebCore11FrameLoader15defersCallbacksEv
+__ZNK7WebCore11FrameLoader15firstLayoutDoneEv
+__ZNK7WebCore11FrameLoader20activeDocumentLoaderEv
+__ZNK7WebCore11FrameLoader21isQuickRedirectComingEv
+__ZNK7WebCore11FrameLoader6clientEv
+__ZNK7WebCore11FrameLoader8loadTypeEv
 __ZNK7WebCore17WebResourceLoader11frameLoaderEv
 __ZNK7WebCore26NetscapePlugInStreamLoader6isDoneEv
 _canonicalURL
index 9ba6f04c30e31f22f5e40e7d9ed08ccc11ee0c8b..b652a414931b8df49e2a56809b2b1be120689083 100644 (file)
                65BF022E0974816300C43196 /* Frame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65BF02290974816300C43196 /* Frame.cpp */; };
                65BF022F0974816300C43196 /* Frame.h in Headers */ = {isa = PBXBuildFile; fileRef = 65BF022A0974816300C43196 /* Frame.h */; settings = {ATTRIBUTES = (Private, ); }; };
                65BF02300974816300C43196 /* FramePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 65BF022B0974816300C43196 /* FramePrivate.h */; };
-               65BF02440974819000C43196 /* FrameMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 65BF023B0974819000C43196 /* FrameMac.h */; };
+               65BF02440974819000C43196 /* FrameMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 65BF023B0974819000C43196 /* FrameMac.h */; settings = {ATTRIBUTES = (Private, ); }; };
                65BF02450974819000C43196 /* FrameMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 65BF023C0974819000C43196 /* FrameMac.mm */; };
                65C7F4320979E2620022E453 /* WebCorePageBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 65C7F4310979E2620022E453 /* WebCorePageBridge.h */; settings = {ATTRIBUTES = (Private, ); }; };
                65C7F44C0979E8C90022E453 /* WebCorePageBridge.mm in Sources */ = {isa = PBXBuildFile; fileRef = 65C7F44B0979E8C90022E453 /* WebCorePageBridge.mm */; };
                8502ABA90AD4396900378540 /* DOMSVGComponentTransferFunctionElementInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 8502ABA60AD4396900378540 /* DOMSVGComponentTransferFunctionElementInternal.h */; };
                85031B3C0A44EFC700F992E0 /* BeforeUnloadEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 85031B260A44EFC700F992E0 /* BeforeUnloadEvent.cpp */; };
                85031B3D0A44EFC700F992E0 /* BeforeUnloadEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 85031B270A44EFC700F992E0 /* BeforeUnloadEvent.h */; };
-               85031B3E0A44EFC700F992E0 /* Clipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 85031B280A44EFC700F992E0 /* Clipboard.h */; };
+               85031B3E0A44EFC700F992E0 /* Clipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 85031B280A44EFC700F992E0 /* Clipboard.h */; settings = {ATTRIBUTES = (Private, ); }; };
                85031B3F0A44EFC700F992E0 /* ClipboardEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 85031B290A44EFC700F992E0 /* ClipboardEvent.cpp */; };
                85031B400A44EFC700F992E0 /* ClipboardEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 85031B2A0A44EFC700F992E0 /* ClipboardEvent.h */; };
                85031B410A44EFC700F992E0 /* Event.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 85031B2B0A44EFC700F992E0 /* Event.cpp */; };
                935C476109AC4CD100A6AAB4 /* Length.h in Headers */ = {isa = PBXBuildFile; fileRef = 935C476009AC4CD100A6AAB4 /* Length.h */; settings = {ATTRIBUTES = (Private, ); }; };
                935C476309AC4CE600A6AAB4 /* MouseEventWithHitTestResults.h in Headers */ = {isa = PBXBuildFile; fileRef = 935C476209AC4CE600A6AAB4 /* MouseEventWithHitTestResults.h */; };
                935C476809AC4D4300A6AAB4 /* PlatformKeyboardEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 935C476609AC4D4300A6AAB4 /* PlatformKeyboardEvent.h */; };
-               935C476909AC4D4300A6AAB4 /* PlatformMouseEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 935C476709AC4D4300A6AAB4 /* PlatformMouseEvent.h */; };
+               935C476909AC4D4300A6AAB4 /* PlatformMouseEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 935C476709AC4D4300A6AAB4 /* PlatformMouseEvent.h */; settings = {ATTRIBUTES = (Private, ); }; };
                935C476B09AC4D4F00A6AAB4 /* PlatformWheelEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 935C476A09AC4D4F00A6AAB4 /* PlatformWheelEvent.h */; };
                935C476D09AC4D6300A6AAB4 /* FoundationExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = 935C476C09AC4D6300A6AAB4 /* FoundationExtras.h */; };
                935C477009AC4D7300A6AAB4 /* KeyEventMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 935C476E09AC4D7300A6AAB4 /* KeyEventMac.mm */; };
                93F199DE08245E59001E9ABC /* Position.h in Headers */ = {isa = PBXBuildFile; fileRef = BE91FC8B06133666005E3790 /* Position.h */; settings = {ATTRIBUTES = (Private, ); }; };
                93F199E008245E59001E9ABC /* Slider.h in Headers */ = {isa = PBXBuildFile; fileRef = BC86FB8D061F5C23006BB822 /* Slider.h */; };
                93F199E508245E59001E9ABC /* HTMLCanvasElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 51F6A3D60663BF04004D2919 /* HTMLCanvasElement.h */; };
-               93F199E708245E59001E9ABC /* ClipboardMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D90660B0665D937006B6F1A /* ClipboardMac.h */; };
+               93F199E708245E59001E9ABC /* ClipboardMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D90660B0665D937006B6F1A /* ClipboardMac.h */; settings = {ATTRIBUTES = (Private, ); }; };
                93F199EC08245E59001E9ABC /* XSLStyleSheet.h in Headers */ = {isa = PBXBuildFile; fileRef = BC06F24A06D18A7E004A6FA3 /* XSLStyleSheet.h */; };
                93F199ED08245E59001E9ABC /* XSLTProcessor.h in Headers */ = {isa = PBXBuildFile; fileRef = BC06F24C06D18A7E004A6FA3 /* XSLTProcessor.h */; };
                93F199EE08245E59001E9ABC /* FormData.h in Headers */ = {isa = PBXBuildFile; fileRef = 93ABCE5E06E1A42E0085925B /* FormData.h */; settings = {ATTRIBUTES = (Private, ); }; };
                BC1A37C0097C715F0019F3D8 /* DOMViews.h in Headers */ = {isa = PBXBuildFile; fileRef = BC1A37AA097C715F0019F3D8 /* DOMViews.h */; settings = {ATTRIBUTES = (Private, ); }; };
                BC3FCAA90AC3DB5800BA54AD /* PlatformScrollBar.h in Headers */ = {isa = PBXBuildFile; fileRef = BC3FCAA80AC3DB5800BA54AD /* PlatformScrollBar.h */; };
                BC6B7BAF0993603C0052867B /* Image.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC6B7BAE0993603C0052867B /* Image.cpp */; };
-               BC6B7ECF0998AC7F0052867B /* ImageSource.h in Headers */ = {isa = PBXBuildFile; fileRef = BC6B7ECE0998AC7F0052867B /* ImageSource.h */; };
+               BC6B7ECF0998AC7F0052867B /* ImageSource.h in Headers */ = {isa = PBXBuildFile; fileRef = BC6B7ECE0998AC7F0052867B /* ImageSource.h */; settings = {ATTRIBUTES = (Private, ); }; };
                BC6D6DD209AF906600F59759 /* Font.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC6D6DD009AF906600F59759 /* Font.cpp */; };
                BC6D6DD309AF906600F59759 /* Font.h in Headers */ = {isa = PBXBuildFile; fileRef = BC6D6DD109AF906600F59759 /* Font.h */; settings = {ATTRIBUTES = (Private, ); }; };
                BC6D6E2609AF943500F59759 /* ScrollView.h in Headers */ = {isa = PBXBuildFile; fileRef = BC6D6E2509AF943500F59759 /* ScrollView.h */; settings = {ATTRIBUTES = (Private, ); }; };
                BC6DB4740A1A90FB00E5CD14 /* GlyphMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC6DB4730A1A90FB00E5CD14 /* GlyphMap.cpp */; };
                BC6DB4D40A1AFEEF00E5CD14 /* GlyphMapMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC6DB4D30A1AFEEF00E5CD14 /* GlyphMapMac.cpp */; };
                BC73E25D0978682700EDFF8A /* FloatSize.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC73E25B0978682700EDFF8A /* FloatSize.cpp */; };
-               BC73E25E0978682700EDFF8A /* FloatSize.h in Headers */ = {isa = PBXBuildFile; fileRef = BC73E25C0978682700EDFF8A /* FloatSize.h */; };
+               BC73E25E0978682700EDFF8A /* FloatSize.h in Headers */ = {isa = PBXBuildFile; fileRef = BC73E25C0978682700EDFF8A /* FloatSize.h */; settings = {ATTRIBUTES = (Private, ); }; };
                BC73E3190978AFFC00EDFF8A /* IntPoint.h in Headers */ = {isa = PBXBuildFile; fileRef = BC73E3180978AFFB00EDFF8A /* IntPoint.h */; settings = {ATTRIBUTES = (Private, ); }; };
                BC73E3920978CED700EDFF8A /* FloatPoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC73E3900978CED700EDFF8A /* FloatPoint.cpp */; };
                BC73E3930978CED700EDFF8A /* FloatPoint.h in Headers */ = {isa = PBXBuildFile; fileRef = BC73E3910978CED700EDFF8A /* FloatPoint.h */; };
                BCC8D1740988301200140BF2 /* Pen.h in Headers */ = {isa = PBXBuildFile; fileRef = BCC8D1720988301200140BF2 /* Pen.h */; };
                BCCD74DC0A4C8D35005FDA6D /* HTMLViewSourceDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = BCCD74DB0A4C8D35005FDA6D /* HTMLViewSourceDocument.h */; };
                BCCD74E50A4C8DDF005FDA6D /* HTMLViewSourceDocument.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCCD74E40A4C8DDF005FDA6D /* HTMLViewSourceDocument.cpp */; };
-               BCD75ABC0989A446003E28DF /* Image.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD75ABB0989A446003E28DF /* Image.h */; };
+               BCD75ABC0989A446003E28DF /* Image.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD75ABB0989A446003E28DF /* Image.h */; settings = {ATTRIBUTES = (Private, ); }; };
                BCEA478F097CAAC80094C9E4 /* CSSComputedStyleDeclaration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEA477C097CAAC80094C9E4 /* CSSComputedStyleDeclaration.cpp */; };
                BCEA4790097CAAC80094C9E4 /* CSSComputedStyleDeclaration.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA477D097CAAC80094C9E4 /* CSSComputedStyleDeclaration.h */; };
                BCEA4798097CAAC80094C9E4 /* csshelper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEA4785097CAAC80094C9E4 /* csshelper.cpp */; };
index 03039dc3b73473575eca57a5594965b391858345..db093d8f55c4ad3b40eea816d3a22fb2b4a69236 100644 (file)
 #ifdef __cplusplus
 
 namespace WebCore {
-    class FrameMac;
-    class Element;
     class EditorClient;
+    class Element;
+    class FrameLoader;
+    class FrameMac;
 }
 
-typedef WebCore::FrameMac WebCoreMacFrame;
-typedef WebCore::Element WebCoreElement;
 typedef WebCore::EditorClient WebCoreEditorClient;
+typedef WebCore::Element WebCoreElement;
+typedef WebCore::FrameLoader WebCoreFrameLoader;
+typedef WebCore::FrameMac WebCoreFrameMac;
 
 #else
 
 @class NSMenu;
-@class WebCoreMacFrame;
-@class WebCoreElement;
 @class WebCoreEditorClient;
+@class WebCoreElement;
+@class WebCoreFrameLoader;
+@class WebCoreFrameMac;
 
 #endif
 
@@ -62,7 +65,6 @@ typedef WebCore::EditorClient WebCoreEditorClient;
 @class WebCorePageBridge;
 @class WebCoreSettings;
 @class WebFrame;
-@class WebFrameLoader;
 @class WebScriptObject;
 @class WebView;
 
@@ -186,8 +188,8 @@ typedef enum {
 
 @interface WebCoreFrameBridge : NSObject
 {
-    WebCoreMacFrame *m_frame;
-    WebFrameLoader *_frameLoader;
+    WebCoreFrameMac* m_frame;
+    WebCoreFrameLoader* m_frameLoader;
 
     BOOL _shouldCreateRenderers;
     BOOL _closed;
@@ -517,7 +519,7 @@ typedef enum {
 - (void)setProhibitsScrolling:(BOOL)prohibits;
 
 - (void)setFrameLoaderClient:(id<WebFrameLoaderClient>)client;
-- (WebFrameLoader *)frameLoader;
+- (WebCoreFrameLoader *)frameLoader;
 
 - (void)setTitle:(NSString *)title;
 - (void)didFirstLayout;
@@ -548,8 +550,6 @@ typedef enum {
 // In NSArray objects for post data, NSData objects represent literal data, and NSString objects represent encoded files.
 // The encoding is the standard form encoding for uploading files.
 
-@class WebFrameLoader;
-
 @protocol WebCoreFrameBridge
 
 - (NSView *)documentView;
@@ -714,7 +714,7 @@ typedef enum {
 // Could move this to another header, but would be a pity to create an entire header just for that.
 
 @interface WebCoreFrameBridge (WebCoreInternalUse)
-- (WebCoreMacFrame*)impl;
+- (WebCoreFrameMac*)impl;
 @end
 
 // Protocols that make up part of the interaces above.
index 77bb8f56717f6a6426f84ca58d365bbacdce3438..1d1bcd360eeeea4cc42c862cb3a8133f54810da2 100644 (file)
@@ -484,6 +484,7 @@ static inline WebCoreFrameBridge *bridge(Frame *frame)
         return nil;
 
     m_frame = new FrameMac([page impl], 0, client);
+    m_frameLoader = new FrameLoader(m_frame);
     m_frame->setBridge(self);
     _shouldCreateRenderers = YES;
 
@@ -493,8 +494,6 @@ static inline WebCoreFrameBridge *bridge(Frame *frame)
         WebCore::cache()->setMaximumSize([self getObjectCacheSize]);
         initializedObjectCacheSize = true;
     }
-
-    _frameLoader = [[WebFrameLoader alloc] initWithFrameBridge:self];
     
     return self;
 }
@@ -505,11 +504,10 @@ static inline WebCoreFrameBridge *bridge(Frame *frame)
         return nil;
     
     m_frame = new FrameMac(ownerElement->document()->frame()->page(), ownerElement, client);
+    m_frameLoader = new FrameLoader(m_frame);
     m_frame->setBridge(self);
     _shouldCreateRenderers = YES;
 
-    _frameLoader = [[WebFrameLoader alloc] initWithFrameBridge:self];
-
     return self;
 }
 
@@ -526,10 +524,6 @@ static inline WebCoreFrameBridge *bridge(Frame *frame)
 - (void)dealloc
 {
     ASSERT(_closed);
-    
-    [_frameLoader release];
-    _frameLoader = nil;
-    
     [super dealloc];
 }
 
@@ -543,8 +537,6 @@ static inline WebCoreFrameBridge *bridge(Frame *frame)
 {
     [self removeFromFrame];
     [self clearFrame];
-    [_frameLoader release];
-    _frameLoader = nil;
     _closed = YES;
 }
 
@@ -757,6 +749,8 @@ static inline WebCoreFrameBridge *bridge(Frame *frame)
 - (void)clearFrame
 {
     m_frame = 0;
+    delete m_frameLoader;
+    m_frameLoader = 0;
 }
 
 - (void)handleFallbackContent
@@ -2619,12 +2613,12 @@ static NSCharacterSet *_getPostSmartSet(void)
 
 - (void)setFrameLoaderClient:(id<WebFrameLoaderClient>)client
 {
-    [_frameLoader setFrameLoaderClient:client];
+    m_frameLoader->setFrameLoaderClient(client);
 }
 
-- (WebFrameLoader *)frameLoader
+- (FrameLoader *)frameLoader
 {
-    return _frameLoader;
+    return m_frameLoader;
 }
 
 static NSString *stringByCollapsingNonPrintingCharacters(NSString *string)
@@ -2673,44 +2667,50 @@ static NSString *stringByCollapsingNonPrintingCharacters(NSString *string)
 
 - (void)setTitle:(NSString *)title
 {
-    [[[self frameLoader] documentLoader] setTitle:stringByCollapsingNonPrintingCharacters(title)];
+    if (!m_frame)
+        return;
+    [m_frameLoader->documentLoader() setTitle:stringByCollapsingNonPrintingCharacters(title)];
 }
 
 - (void)didFirstLayout
 {
-    [[self frameLoader] didFirstLayout];
+    if (!m_frame)
+        return;
+    m_frameLoader->didFirstLayout();
 }
 
 - (void)notifyIconChanged:(NSURL*)iconURL
 {
-    [[self frameLoader] _notifyIconChanged:iconURL];
+    if (!m_frame)
+        return;
+    m_frameLoader->notifyIconChanged(iconURL);
 }
 
 - (NSURL*)originalRequestURL
 {
-    return [[[[self frameLoader] activeDocumentLoader] initialRequest] URL];
+    return [[m_frameLoader->activeDocumentLoader() initialRequest] URL];
 }
 
 - (BOOL)isLoadTypeReload
 {
-    return [[self frameLoader] loadType] == FrameLoadTypeReload;
+    return m_frameLoader->loadType() == FrameLoadTypeReload;
 }
 
 - (void)frameDetached
 {
-    [[self frameLoader] stopLoading];
-    [[self frameLoader] detachFromParent];
+    m_frameLoader->stopLoading();
+    m_frameLoader->detachFromParent();
 }
 
 - (void)tokenizerProcessedData
 {
-    [[self frameLoader] checkLoadComplete];
+    m_frameLoader->checkLoadComplete();
 }
 
 - (void)receivedData:(NSData *)data textEncodingName:(NSString *)textEncodingName
 {
     // Set the encoding. This only needs to be done once, but it's harmless to do it again later.
-    NSString *encoding = [[[self frameLoader] documentLoader] overrideEncoding];
+    NSString *encoding = [m_frameLoader->documentLoader() overrideEncoding];
     BOOL userChosen = encoding != nil;
     if (encoding == nil) {
         encoding = textEncodingName;
@@ -2732,18 +2732,18 @@ static NSString *stringByCollapsingNonPrintingCharacters(NSString *string)
     BOOL hideReferrer;
     [self canLoadURL:URL fromReferrer:[self referrer] hideReferrer:&hideReferrer];
     
-    return SubresourceLoader::create([self frameLoader], resourceLoader,
+    return SubresourceLoader::create(m_frame, resourceLoader,
         method, URL, customHeaders, hideReferrer ? nil : [self referrer]);
 }
 
 - (void)objectLoadedFromCacheWithURL:(NSURL *)URL response:(NSURLResponse *)response data:(NSData *)data
 {
     // FIXME: If the WebKit client changes or cancels the request, WebCore does not respect this and continues the load.
+    NSURLRequest *request = [[NSURLRequest alloc] initWithURL:URL];
     NSError *error;
     id identifier;
-    NSURLRequest *request = [[NSURLRequest alloc] initWithURL:URL];
-    [[self frameLoader] requestFromDelegateForRequest:request identifier:&identifier error:&error];    
-    [[self frameLoader] sendRemainingDelegateMessagesWithIdentifier:identifier response:response length:[data length] error:error];
+    m_frameLoader->requestFromDelegate(request, identifier, error);    
+    m_frameLoader->sendRemainingDelegateMessages(identifier, response, [data length], error);
     [request release];
 }
 
@@ -2760,18 +2760,18 @@ static NSString *stringByCollapsingNonPrintingCharacters(NSString *string)
     BOOL hideReferrer;
     [self canLoadURL:URL fromReferrer:[self referrer] hideReferrer:&hideReferrer];
     
-    return SubresourceLoader::create([self frameLoader], resourceLoader,
+    return SubresourceLoader::create(m_frame, resourceLoader,
         method, URL, customHeaders, postData, hideReferrer ? nil : [self referrer]);
 }
 
 - (void)reportClientRedirectToURL:(NSURL *)URL delay:(NSTimeInterval)seconds fireDate:(NSDate *)date lockHistory:(BOOL)lockHistory isJavaScriptFormAction:(BOOL)isJavaScriptFormAction
 {
-    [[self frameLoader] clientRedirectedTo:URL delay:seconds fireDate:date lockHistory:lockHistory isJavaScriptFormAction:(BOOL)isJavaScriptFormAction];
+    m_frameLoader->clientRedirected(URL, seconds, date, lockHistory, isJavaScriptFormAction);
 }
 
 - (void)reportClientRedirectCancelled:(BOOL)cancelWithLoadInProgress
 {
-    [[self frameLoader] clientRedirectCancelledOrFinished:cancelWithLoadInProgress];
+    m_frameLoader->clientRedirectCancelledOrFinished(cancelWithLoadInProgress);
 }
 
 - (void)loadURL:(NSURL *)URL referrer:(NSString *)referrer reload:(BOOL)reload userGesture:(BOOL)forUser target:(NSString *)target triggeringEvent:(NSEvent *)event form:(DOMElement *)form formValues:(NSDictionary *)values
@@ -2780,28 +2780,24 @@ static NSString *stringByCollapsingNonPrintingCharacters(NSString *string)
     if (![self canLoadURL:URL fromReferrer:referrer hideReferrer:&hideReferrer])
         return;
     
-    if ([target length] == 0) {
+    if ([target length] == 0)
         target = nil;
-    }
     
     WebCoreFrameBridge *targetFrame = [self findFrameNamed:target];
-    if (![self canTargetLoadInFrame:targetFrame]) {
+    if (![self canTargetLoadInFrame:targetFrame])
         return;
-    }
     
     FrameLoadType loadType;
-    
     if (reload)
         loadType = FrameLoadTypeReload;
     else if (!forUser)
         loadType = FrameLoadTypeInternal;
     else
         loadType = FrameLoadTypeStandard;
-    [[self frameLoader] loadURL:URL referrer:(hideReferrer ? nil : referrer) loadType:loadType target:target triggeringEvent:event form:form formValues:values];
+    m_frameLoader->load(URL, (hideReferrer ? nil : referrer), loadType, target, event, form, values);
     
-    if (targetFrame != nil && self != targetFrame) {
+    if (targetFrame != nil && self != targetFrame)
         [targetFrame activateWindow];
-    }
 }
 
 - (void)postWithURL:(NSURL *)URL referrer:(NSString *)referrer target:(NSString *)target data:(NSArray *)postData contentType:(NSString *)contentType triggeringEvent:(NSEvent *)event form:(DOMElement *)form formValues:(NSDictionary *)values
@@ -2817,9 +2813,7 @@ static NSString *stringByCollapsingNonPrintingCharacters(NSString *string)
     if (![self canTargetLoadInFrame:targetFrame])
         return;
     
-    [[self frameLoader] postWithURL:URL referrer:(hideReferrer ? nil : referrer) target:target
-                               data:postData contentType:contentType
-                    triggeringEvent:event form:form formValues:values];
+    m_frameLoader->post(URL, (hideReferrer ? nil : referrer), target, postData, contentType, event, form, values);
     
     if (targetFrame != nil && self != targetFrame)
         [targetFrame activateWindow];
@@ -2851,17 +2845,17 @@ static NSString *stringByCollapsingNonPrintingCharacters(NSString *string)
     if (isConditionalRequest(request))
         [request setCachePolicy:NSURLRequestReloadIgnoringCacheData];
     else
-        [request setCachePolicy:[[[[self frameLoader] documentLoader] request] cachePolicy]];
+        [request setCachePolicy:[[m_frameLoader->documentLoader() request] cachePolicy]];
     if (!hideReferrer)
         setHTTPReferrer(request, [self referrer]);
     
     WebCorePageBridge *page = [self page];
-    [request setMainDocumentURL:[[[[[page mainFrame] frameLoader] documentLoader] request] URL]];
+    [request setMainDocumentURL:[[[[page mainFrame] frameLoader]->documentLoader() request] URL]];
     [request setValue:[self userAgentForURL:[request URL]] forHTTPHeaderField:@"User-Agent"];
     
     NSError *error = nil;
     id identifier = nil;    
-    NSURLRequest *newRequest = [[self frameLoader] requestFromDelegateForRequest:request identifier:&identifier error:&error];
+    NSURLRequest *newRequest = m_frameLoader->requestFromDelegate(request, identifier, error);
     
     NSURLResponse *response = nil;
     NSData *result = nil;
@@ -2890,7 +2884,7 @@ static NSString *stringByCollapsingNonPrintingCharacters(NSString *string)
         }
     }
     
-    [[self frameLoader] sendRemainingDelegateMessagesWithIdentifier:identifier response:response length:[result length] error:error];
+    m_frameLoader->sendRemainingDelegateMessages(identifier, response, [result length], error);
     [request release];
     
     return result;
@@ -2899,29 +2893,29 @@ static NSString *stringByCollapsingNonPrintingCharacters(NSString *string)
 
 - (NSString *)incomingReferrer
 {
-    return [[[[self frameLoader] documentLoader] request] valueForHTTPHeaderField:@"Referer"];
+    return [[m_frameLoader->documentLoader() request] valueForHTTPHeaderField:@"Referer"];
 }
 
 - (BOOL)isReloading
 {
-    return [[[[self frameLoader] documentLoader] request] cachePolicy] == NSURLRequestReloadIgnoringCacheData;
+    return [[m_frameLoader->documentLoader() request] cachePolicy] == NSURLRequestReloadIgnoringCacheData;
 }
 
 - (void)handledOnloadEvents
 {
-    [[[self frameLoader] client] _dispatchDidHandleOnloadEventsForFrame];
+    [m_frameLoader->client() _dispatchDidHandleOnloadEventsForFrame];
 }
 
 - (NSURLResponse*)mainResourceURLResponse
 {
-    return [[[self frameLoader] documentLoader] response];
+    return [m_frameLoader->documentLoader() response];
 }
 
 - (void)loadEmptyDocumentSynchronously
 {
     NSURL *url = [[NSURL alloc] initWithString:@""];
     NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url];
-    [[self frameLoader] loadRequest:request];
+    m_frameLoader->load(request);
     [request release];
     [url release];
 }
index 570524ba399dd658d879e6a0933e5cb3f526c714..f472c75a1d0fa521f4e4da91c5e10fd7cee80c3e 100644 (file)
 
 #import <Cocoa/Cocoa.h>
 
-@class WebFrameLoader;
+namespace WebCore {
+    class Frame;
+    class FrameLoader;
+}
 
 @interface WebDocumentLoader : NSObject
 {
 @public
-    WebFrameLoader *frameLoader;
+    WebCore::Frame* m_frame;
     
     NSData *mainResourceData;
 
@@ -88,8 +91,8 @@
 }
 
 - (id)initWithRequest:(NSURLRequest *)request;
-- (void)setFrameLoader:(WebFrameLoader *)fl;
-- (WebFrameLoader *)frameLoader;
+- (void)setFrame:(WebCore::Frame*)frame;
+- (WebCore::FrameLoader*)frameLoader;
 - (void)setMainResourceData:(NSData *)data;
 - (NSData *)mainResourceData;
 - (NSURLRequest *)originalRequest;
 - (NSError *)mainDocumentError;
 - (void)mainReceivedError:(NSError *)error complete:(BOOL)isComplete;
 - (void)setResponse:(NSURLResponse *)resp;
-- (void)detachFromFrameLoader;
+- (void)attachToFrame;
+- (void)detachFromFrame;
 - (void)prepareForLoadStart;
 - (double)loadingStartedTime;
 - (BOOL)isClientRedirect;
index 358d0e27be10651176430a47095a7981e2381e72..0d313ff5b77af0e6b2b3b0cc32518cf28e4ddfb4 100644 (file)
 #import "config.h"
 #import "WebDocumentLoader.h"
 
-#import <wtf/Assertions.h>
-#import "WebFrameLoader.h"
-#import "WebDataProtocol.h"
+#import "FrameMac.h"
 #import "WebCoreFrameBridge.h"
 #import "WebCoreSystemInterface.h"
+#import "WebDataProtocol.h"
+#import "WebFrameLoader.h"
+#import <wtf/Assertions.h>
+
+using namespace WebCore;
 
 @implementation WebDocumentLoader
 
     return self;
 }
 
+- (FrameLoader*)frameLoader
+{
+    if (!m_frame)
+        return 0;
+    return [Mac(m_frame)->bridge() frameLoader];
+}
+
 - (void)dealloc
 {
-    ASSERT([frameLoader activeDocumentLoader] != self || ![frameLoader isLoading]);
-    
+    ASSERT(!m_frame || [self frameLoader]->activeDocumentLoader() != self || ![self frameLoader]->isLoading());
 
     [mainResourceData release];
     [originalRequest release];
 }    
 
 
-- (void)setFrameLoader:(WebFrameLoader *)fl
-{
-    ASSERT(fl);
-    ASSERT(!frameLoader);
-    
-    frameLoader = fl;
-}
-
-- (WebFrameLoader *)frameLoader
-{
-    return frameLoader;
-}
-
 - (void)setMainResourceData:(NSData *)data
 {
     [data retain];
@@ -93,7 +89,7 @@
 
 - (NSData *)mainResourceData
 {
-    return mainResourceData != nil ? mainResourceData : [frameLoader mainResourceData];
+    return mainResourceData != nil ? mainResourceData : [self frameLoader]->mainResourceData();
 }
 
 - (NSURLRequest *)originalRequest
     // Only send webView:didReceiveServerRedirectForProvisionalLoadForFrame: if URL changed.
     // Also, don't send it when replacing unreachable URLs with alternate content.
     if (!handlingUnreachableURL && ![[oldRequest URL] isEqual:[req URL]])
-        [frameLoader didReceiveServerRedirectForProvisionalLoadForFrame];
+        [self frameLoader]->didReceiveServerRedirectForProvisionalLoadForFrame();
     
     [oldRequest release];
 }
 
 - (WebCoreFrameBridge *)bridge
 {
-    return [frameLoader bridge];
+    if (!m_frame)
+        return nil;
+    return Mac(m_frame)->bridge();
 }
 
 - (void)setMainDocumentError:(NSError *)error
     [mainDocumentError release];
     mainDocumentError = error;
     
-    [frameLoader documentLoader:self setMainDocumentError:error];
+    [self frameLoader]->setMainDocumentError(self, error);
  }
 
 - (NSError *)mainDocumentError
 
 - (void)mainReceivedError:(NSError *)error complete:(BOOL)isComplete
 {
-    if (!frameLoader)
+    if (![self frameLoader])
         return;
     
     [self setMainDocumentError:error];
     
-    if (isComplete) {
-        [frameLoader documentLoader:self mainReceivedCompleteError:error];
-    }
+    if (isComplete)
+        [self frameLoader]->mainReceivedCompleteError(self, error);
 }
 
 // Cancels the data source's pending loads.  Conceptually, a data source only loads
     if (!loading)
         return;
     
+    RefPtr<Frame> protect(m_frame);
     [self retain];
-    
+
     stopping = YES;
+
+    FrameLoader* frameLoader = [self frameLoader];
     
-    if ([frameLoader isLoadingMainResource]) {
+    if (frameLoader->isLoadingMainResource())
         // Stop the main resource loader and let it send the cancelled message.
-        [frameLoader cancelMainResourceLoad];
-    } else if ([frameLoader isLoadingSubresources]) {
+        frameLoader->cancelMainResourceLoad();
+    else if (frameLoader->isLoadingSubresources())
         // The main resource loader already finished loading. Set the cancelled error on the 
         // document and let the subresourceLoaders send individual cancelled messages below.
-        [self setMainDocumentError:[frameLoader cancelledErrorWithRequest:request]];
-    } else {
+        [self setMainDocumentError:frameLoader->cancelledError(request)];
+    else
         // If there are no resource loaders, we need to manufacture a cancelled message.
         // (A back/forward navigation has no resource loaders because its resources are cached.)
-        [self mainReceivedError:[frameLoader cancelledErrorWithRequest:request] complete:YES];
-    }
+        [self mainReceivedError:frameLoader->cancelledError(request) complete:YES];
     
-    [frameLoader stopLoadingSubresources];
-    [frameLoader stopLoadingPlugIns];
+    frameLoader->stopLoadingSubresources();
+    frameLoader->stopLoadingPlugIns();
     
     stopping = NO;
     
 
 - (void)setupForReplace
 {
-    [frameLoader setupForReplace];
+    [self frameLoader]->setupForReplace();
     committed = NO;
 }
 
 {
     if (gotFirstByte && !committed) {
         committed = YES;
-        [frameLoader commitProvisionalLoad:nil];
+        [self frameLoader]->commitProvisionalLoad(nil);
     }
 }
 
 {
     gotFirstByte = YES;   
     [self commitIfReady];
-    [frameLoader finishedLoadingDocument:self];
+    [self frameLoader]->finishedLoadingDocument(self);
     [[self bridge] end];
 }
 
     [self retain];
     [self commitIfReady];
     
-    [frameLoader committedLoadWithDocumentLoader:self data:data];
+    if (FrameLoader* frameLoader = [self frameLoader])
+        frameLoader->committedLoad(self, data);
 
     [self release];
 }
 
 - (BOOL)doesProgressiveLoadWithMIMEType:(NSString *)MIMEType
 {
-    return ![frameLoader isReplacing] || [MIMEType isEqualToString:@"text/html"];
+    return ![self frameLoader]->isReplacing() || [MIMEType isEqualToString:@"text/html"];
 }
 
 - (void)receivedData:(NSData *)data
     NSString *oldMIMEType = [response MIMEType];
     
     if (![self doesProgressiveLoadWithMIMEType:oldMIMEType]) {
-        [frameLoader revertToProvisionalWithDocumentLoader:self];
+        [self frameLoader]->revertToProvisional(self);
         [self setupForReplace];
         [self commitLoadWithData:[self mainResourceData]];
     }
     
-    [frameLoader finishedLoadingDocument:self];
+    [self frameLoader]->finishedLoadingDocument(self);
     [[self bridge] end];
     
-    [frameLoader setReplacing];
+    [self frameLoader]->setReplacing();
     gotFirstByte = NO;
     
     if ([self doesProgressiveLoadWithMIMEType:newMIMEType]) {
-        [frameLoader revertToProvisionalWithDocumentLoader:self];
+        [self frameLoader]->revertToProvisional(self);
         [self setupForReplace];
     }
     
-    [frameLoader stopLoadingSubresources];
-    [frameLoader stopLoadingPlugIns];
+    [self frameLoader]->stopLoadingSubresources();
+    [self frameLoader]->stopLoadingPlugIns();
 
-    [frameLoader finalSetupForReplaceWithDocumentLoader:self];
+    [self frameLoader]->finalSetupForReplace(self);
 }
 
 - (void)updateLoading
 {
-    ASSERT(self == [frameLoader activeDocumentLoader]);
+    ASSERT(self == [self frameLoader]->activeDocumentLoader());
     
-    [self setLoading:[frameLoader isLoading]];
+    [self setLoading:[self frameLoader]->isLoading()];
 }
 
 - (NSURLResponse *)response
     return response;
 }
 
-- (void)detachFromFrameLoader
+- (void)setFrame:(Frame*)frame
+{
+    if (m_frame == frame)
+        return;
+    ASSERT(frame && !m_frame);
+    m_frame = frame;
+    [self attachToFrame];
+}
+
+- (void)attachToFrame
+{
+    ASSERT(m_frame);
+}
+
+- (void)detachFromFrame
 {
-    frameLoader = nil;
+    ASSERT(m_frame);
+    m_frame = 0;
 }
 
 - (void)prepareForLoadStart
 {
     ASSERT(!stopping);
     [self setPrimaryLoadComplete:NO];
-    ASSERT(frameLoader != nil);
+    ASSERT([self frameLoader]);
     [self clearErrors];
     
     // Mark the start loading time.
     
     [self setLoading:YES];
     
-    [frameLoader prepareForLoadStart];
+    [self frameLoader]->prepareForLoadStart();
 }
 
 - (double)loadingStartedTime
     primaryLoadComplete = flag;
     
     if (flag) {
-        if ([frameLoader isLoadingMainResource]) {
-            [self setMainResourceData:[frameLoader mainResourceData]];
-            [frameLoader releaseMainResourceLoader];
+        if ([self frameLoader]->isLoadingMainResource()) {
+            [self setMainResourceData:[self frameLoader]->mainResourceData()];
+            [self frameLoader]->releaseMainResourceLoader();
         }
         
         [self updateLoading];
 {
     // Once a frame has loaded, we no longer need to consider subresources,
     // but we still need to consider subframes.
-    if ([frameLoader state] != WebFrameStateComplete) {
+    if ([self frameLoader]->state() != WebFrameStateComplete) {
         if (!primaryLoadComplete && [self isLoading])
             return YES;
-        if ([frameLoader isLoadingSubresources])
+        if ([self frameLoader]->isLoadingSubresources())
             return YES;
-        if (![[frameLoader bridge] doneProcessingData])
+        if (![[self bridge] doneProcessingData])
             return YES;
     }
     
-    return [frameLoader subframeIsLoading];
+    return [self frameLoader]->subframeIsLoading();
 }
 
 - (void)addResponse:(NSURLResponse *)r
     CFStringTrimWhitespace((CFMutableStringRef)trimmed);
 
     if ([trimmed length] != 0 && ![pageTitle isEqualToString:trimmed]) {
-        [frameLoader willChangeTitleForDocument:self];
+        [self frameLoader]->willChangeTitle(self);
         [pageTitle release];
         pageTitle = [trimmed copy];
-        [frameLoader didChangeTitleForDocument:self];
+        [self frameLoader]->didChangeTitle(self);
     }
 
     [trimmed release];
index 6a765df582b101ef26a9428dde62f70495dba85c..89e95114e37c31289c8caab3f6ef59c6c3fc7692 100644 (file)
  */
 
 #import "FrameLoaderTypes.h"
-#import <Cocoa/Cocoa.h>
+#import "RetainPtr.h"
 #import <wtf/Forward.h>
 #import <wtf/HashSet.h>
+#import <wtf/Noncopyable.h>
 #import <wtf/RefPtr.h>
-#import <wtf/Vector.h>
-
-namespace WebCore {
-    class FormState;
-    class MainResourceLoader;
-    class WebResourceLoader;
-}
 
 @class DOMElement;
-@class WebDocumentLoader;
 @class WebCoreFrameBridge;
+@class WebCoreFrameLoaderAsDelegate;
+@class WebDocumentLoader;
 @class WebPolicyDecider;
 @protocol WebFrameLoaderClient;
 
-bool isBackForwardLoadType(FrameLoadType);
+namespace WebCore {
 
-@interface WebFrameLoader : NSObject 
-{
-    WebCoreFrameBridge *frameBridge;
-    
-    WebCore::MainResourceLoader *m_mainResourceLoader;
-    
-    HashSet<RefPtr<WebCore::WebResourceLoader> >* m_subresourceLoaders;
-    HashSet<RefPtr<WebCore::WebResourceLoader> >* m_plugInStreamLoaders;
-    
-    id <WebFrameLoaderClient> client;
-    WebDocumentLoader *documentLoader;
-    WebDocumentLoader *provisionalDocumentLoader;
-    WebDocumentLoader *policyDocumentLoader;
-        
-    WebFrameState state;
+    class FormState;
+    class Frame;
+    class MainResourceLoader;
+    class WebResourceLoader;
+
+    bool isBackForwardLoadType(FrameLoadType);
+
+    class FrameLoader : Noncopyable {
+    public:
+        FrameLoader(Frame*);
+        ~FrameLoader();
+
+        Frame* frame() const { return m_frame; }
+
+        void addPlugInStreamLoader(WebResourceLoader*);
+        void removePlugInStreamLoader(WebResourceLoader*);
+        void stopLoadingPlugIns();
+        bool isLoadingMainResource() const;
+        bool isLoadingSubresources() const;
+        bool isLoading() const;
+        void stopLoadingSubresources();
+        void addSubresourceLoader(WebResourceLoader*);
+        void removeSubresourceLoader(WebResourceLoader*);
+        NSData *mainResourceData() const;
+        void releaseMainResourceLoader();
+        void cancelMainResourceLoad();
+        void stopLoading(NSError *);
+        void stopLoading();
+
+        WebDocumentLoader *activeDocumentLoader() const;
+        WebDocumentLoader *documentLoader() const;
+        WebDocumentLoader *provisionalDocumentLoader();
+        WebFrameState state() const;
+        void setupForReplace();
+        static double timeOfLastCompletedLoad();
+
+        bool defersCallbacks() const;
+        void defersCallbacksChanged();
+        id identifierForInitialRequest(NSURLRequest *);
+        NSURLRequest *willSendRequest(WebResourceLoader*, NSMutableURLRequest *, NSURLResponse *redirectResponse);
+        void didReceiveAuthenticationChallenge(WebResourceLoader*, NSURLAuthenticationChallenge *);
+        void didCancelAuthenticationChallenge(WebResourceLoader*, NSURLAuthenticationChallenge *);
+        void didReceiveResponse(WebResourceLoader*, NSURLResponse *);
+        void didReceiveData(WebResourceLoader*, NSData *, int lengthReceived);
+        void didFinishLoad(WebResourceLoader*);
+        void didFailToLoad(WebResourceLoader*, NSError *);
+        bool privateBrowsingEnabled() const;
+        NSURLRequest *originalRequest() const;
+        void receivedMainResourceError(NSError *, bool isComplete);
+        NSURLRequest *initialRequest() const;
+        void receivedData(NSData *);
+        void setRequest(NSURLRequest *);
+        void download(NSURLConnection *, NSURLRequest *request, NSURLResponse *, id proxy);
+        void handleFallbackContent();
+        bool isStopping() const;
+        void setupForReplaceByMIMEType(NSString *newMIMEType);
+        void setResponse(NSURLResponse *);
+
+        void finishedLoading();
+        NSURL *URL() const;
+
+        NSError *cancelledError(NSURLRequest *) const;
+        NSError *fileDoesNotExistError(NSURLResponse *) const;
+        bool willUseArchive(WebResourceLoader*, NSURLRequest *, NSURL *) const;
+        bool isArchiveLoadPending(WebResourceLoader*) const;
+        void cancelPendingArchiveLoad(WebResourceLoader*);
+        void cannotShowMIMEType(NSURLResponse *);
+        NSError *interruptionForPolicyChangeError(NSURLRequest *);
+        bool isHostedByObjectElement() const;
+        bool isLoadingMainFrame() const;
+        bool canShowMIMEType(NSString *MIMEType) const;
+        bool representationExistsForURLScheme(NSString *URLScheme);
+        NSString *generatedMIMETypeForURLScheme(NSString *URLScheme);
+        void notifyIconChanged(NSURL *iconURL);
+        void checkNavigationPolicy(NSURLRequest *newRequest, id continuationObject, SEL continuationSelector);
+        void checkContentPolicy(NSString *MIMEType, id continuationObject, SEL continuationSelector);
+        void cancelContentPolicyCheck();
+        void reload();
+        void reloadAllowingStaleData(NSString *overrideEncoding);
+        void load(NSURLRequest *, NSDictionary *triggeringAaction, FrameLoadType, PassRefPtr<FormState>);
+
+        void didReceiveServerRedirectForProvisionalLoadForFrame();
+        void finishedLoadingDocument(WebDocumentLoader *);
+        void committedLoad(WebDocumentLoader *, NSData *data);
+        bool isReplacing() const;
+        void setReplacing();
+        void revertToProvisional(WebDocumentLoader *);
+        void setMainDocumentError(WebDocumentLoader *, NSError *);
+        void mainReceivedCompleteError(WebDocumentLoader *, NSError *);
+        void finalSetupForReplace(WebDocumentLoader *);
+        void prepareForLoadStart();
+        bool subframeIsLoading() const;
+        void willChangeTitle(WebDocumentLoader *);
+        void didChangeTitle(WebDocumentLoader *);
+
+        FrameLoadType loadType() const;
+
+        void load(WebDocumentLoader *);
+        void load(WebDocumentLoader *, FrameLoadType, PassRefPtr<FormState>);
+
+        void didFirstLayout();
+        bool firstLayoutDone() const;
+
+        void clientRedirectCancelledOrFinished(bool cancelWithLoadInProgress);
+        void clientRedirected(NSURL *, double delay, NSDate *fireDate, bool lockHistory, bool isJavaScriptFormAction);
+        void load(NSURL *, NSString *referrer, FrameLoadType loadType, NSString *target, NSEvent *event, DOMElement *form, NSDictionary *formValues);
+        void commitProvisionalLoad(NSDictionary *pageCache);
+        bool isQuickRedirectComing() const;
+        bool shouldReload(NSURL *currentURL, NSURL *destinationURL);
+
+        void sendRemainingDelegateMessages(id identifier, NSURLResponse *, unsigned length, NSError *);
+        NSURLRequest *requestFromDelegate(NSURLRequest *, id& identifier, NSError *& error);
+        void load(NSURLRequest *);
+        void load(NSURLRequest *, NSString *frameName);
+        void post(NSURL *, NSString *referrer, NSString *target, NSArray *postData, NSString *contentType, NSEvent *, DOMElement *form, NSDictionary *formValues);
+
+        void checkLoadComplete();
+        void detachFromParent();
+        void safeLoad(NSURL *);
+        void detachChildren();
+        void addExtraFieldsToRequest(NSMutableURLRequest *, bool isMainResource, bool alwaysFromRequest);
+        NSDictionary *actionInformation(NavigationType, NSEvent *, NSURL *);
+        NSDictionary *actionInformation(FrameLoadType loadType, bool isFormSubmission, NSEvent *, NSURL *);
+
+        void setFrameLoaderClient(id <WebFrameLoaderClient>);
+        id <WebFrameLoaderClient> client() const;
+
+        void continueAfterWillSubmitForm(WebPolicyAction);
+        void continueAfterNewWindowPolicy(WebPolicyAction);
+        void continueAfterNavigationPolicy(WebPolicyAction);
+        void continueLoadRequestAfterNavigationPolicy(NSURLRequest *, FormState*);
+        void continueFragmentScrollAfterNavigationPolicy(NSURLRequest *);
+        void continueLoadRequestAfterNewWindowPolicy(NSURLRequest *, NSString *frameName, FormState*);
+
+    private:
+        void setDefersCallbacks(bool);
+        bool startLoadingMainResource(NSMutableURLRequest *, id identifier);
+        void clearProvisionalLoad();
+        void stopLoadingSubframes();
+        void markLoadComplete();
+        void commitProvisionalLoad();
+        void startLoading();
+        void provisionalLoadStarted();
+        void frameLoadCompleted();
+
+        void mainReceivedError(NSError *, bool isComplete);
+
+        void setLoadType(FrameLoadType);
+
+        void invalidatePendingPolicyDecision(bool callDefaultAction);
+        void checkNewWindowPolicy(NSURLRequest *, NSDictionary *, NSString *frameName, PassRefPtr<FormState>);
+        void checkNavigationPolicy(NSURLRequest *, WebDocumentLoader *, PassRefPtr<FormState>, id continuationObject, SEL continuationSelector);
+
+        void transitionToCommitted(NSDictionary *pageCache);
+        void checkLoadCompleteForThisFrame();
+
+        void setDocumentLoader(WebDocumentLoader *);
+        void setPolicyDocumentLoader(WebDocumentLoader *);
+        void setProvisionalDocumentLoader(WebDocumentLoader *);
+
+        bool isLoadingPlugIns() const;
+
+        void setState(WebFrameState);
+
+        WebCoreFrameBridge *bridge() const;
+
+        WebCoreFrameLoaderAsDelegate *asDelegate();
+
+        void closeOldDataSources();
+        void opened();
+
+        void handleUnimplementablePolicy(NSError *);
+        bool shouldReloadToHandleUnreachableURL(NSURLRequest *);
+
+        Frame* m_frame;
+        RetainPtr<WebCoreFrameLoaderAsDelegate> m_asDelegate;
+
+        RefPtr<MainResourceLoader> m_mainResourceLoader;
+        HashSet<RefPtr<WebResourceLoader> > m_subresourceLoaders;
+        HashSet<RefPtr<WebResourceLoader> > m_plugInStreamLoaders;
     
-    FrameLoadType loadType;
-
-    // state we'll need to continue after waiting for the policy delegate's decision
-    WebPolicyDecider *policyDecider;    
-
-    NSURLRequest *policyRequest;
-    NSString *policyFrameName;
-    id policyTarget;
-    SEL policySelector;
-    WebCore::FormState *policyFormState;
-    FrameLoadType policyLoadType;
-
-    BOOL delegateIsHandlingProvisionalLoadError;
-    BOOL delegateIsDecidingNavigationPolicy;
-    BOOL delegateIsHandlingUnimplementablePolicy;
-
-    BOOL firstLayoutDone;
-    BOOL quickRedirectComing;
-    BOOL sentRedirectNotification;
-    BOOL isStoppingLoad;    
-}
+        id <WebFrameLoaderClient> m_client;
+
+        RetainPtr<WebDocumentLoader> m_documentLoader;
+        RetainPtr<WebDocumentLoader> m_provisionalDocumentLoader;
+        RetainPtr<WebDocumentLoader> m_policyDocumentLoader;
 
-- (id)initWithFrameBridge:(WebCoreFrameBridge *)bridge;
-- (void)addPlugInStreamLoader:(WebCore::WebResourceLoader *)loader;
-- (void)removePlugInStreamLoader:(WebCore::WebResourceLoader *)loader;
-- (void)setDefersCallbacks:(BOOL)defers;
-- (void)stopLoadingPlugIns;
-- (BOOL)isLoadingMainResource;
-- (BOOL)isLoadingSubresources;
-- (BOOL)isLoading;
-- (void)stopLoadingSubresources;
-- (void)addSubresourceLoader:(WebCore::WebResourceLoader *)loader;
-- (void)removeSubresourceLoader:(WebCore::WebResourceLoader *)loader;
-- (NSData *)mainResourceData;
-- (void)releaseMainResourceLoader;
-- (void)cancelMainResourceLoad;
-- (BOOL)startLoadingMainResourceWithRequest:(NSMutableURLRequest *)request identifier:(id)identifier;
-- (void)stopLoadingWithError:(NSError *)error;
-- (void)clearProvisionalLoad;
-- (void)stopLoading;
-- (void)stopLoadingSubframes;
-- (void)markLoadComplete;
-- (void)commitProvisionalLoad;
-- (void)startLoading;
-- (void)startProvisionalLoad:(WebDocumentLoader *)loader;
-- (WebDocumentLoader *)activeDocumentLoader;
-- (WebDocumentLoader *)documentLoader;
-- (WebDocumentLoader *)provisionalDocumentLoader;
-- (WebFrameState)state;
-- (void)setupForReplace;
-+ (CFAbsoluteTime)timeOfLastCompletedLoad;
-- (void)provisionalLoadStarted;
-- (void)frameLoadCompleted;
-
-- (BOOL)defersCallbacks;
-- (void)defersCallbacksChanged;
-- (id)_identifierForInitialRequest:(NSURLRequest *)clientRequest;
-- (NSURLRequest *)_willSendRequest:(NSMutableURLRequest *)clientRequest forResource:(id)identifier redirectResponse:(NSURLResponse *)redirectResponse;
-- (void)_didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)currentWebChallenge forResource:(id)identifier;
-- (void)_didCancelAuthenticationChallenge:(NSURLAuthenticationChallenge *)currentWebChallenge forResource:(id)identifier;
-- (void)_didReceiveResponse:(NSURLResponse *)r forResource:(id)identifier;
-- (void)_didReceiveData:(NSData *)data contentLength:(int)lengthReceived forResource:(id)identifier;
-- (void)_didFinishLoadingForResource:(id)identifier;
-- (void)_didFailLoadingWithError:(NSError *)error forResource:(id)identifier;
-- (BOOL)_privateBrowsingEnabled;
-- (void)_didFailLoadingWithError:(NSError *)error forResource:(id)identifier;
-- (void)_finishedLoadingResource;
-- (void)_receivedError:(NSError *)error;
-- (NSURLRequest *)_originalRequest;
-- (void)_receivedMainResourceError:(NSError *)error complete:(BOOL)isComplete;
-- (NSURLRequest *)initialRequest;
-- (void)_receivedData:(NSData *)data;
-- (void)_setRequest:(NSURLRequest *)request;
-- (void)_downloadWithLoadingConnection:(NSURLConnection *)connection request:(NSURLRequest *)request response:(NSURLResponse *)r proxy:(id)proxy;
-- (void)_handleFallbackContent;
-- (BOOL)_isStopping;
-- (void)_setupForReplaceByMIMEType:(NSString *)newMIMEType;
-- (void)_setResponse:(NSURLResponse *)response;
-- (void)_mainReceivedError:(NSError *)error complete:(BOOL)isComplete;
-- (void)_finishedLoading;
-- (NSURL *)_URL;
-
-- (NSError *)cancelledErrorWithRequest:(NSURLRequest *)request;
-- (NSError *)fileDoesNotExistErrorWithResponse:(NSURLResponse *)response;
-- (BOOL)willUseArchiveForRequest:(NSURLRequest *)request originalURL:(NSURL *)originalURL loader:(WebCore::WebResourceLoader *)loader;
-- (BOOL)archiveLoadPendingForLoader:(WebCore::WebResourceLoader *)loader;
-- (void)cancelPendingArchiveLoadForLoader:(WebCore::WebResourceLoader *)loader;
-- (void)cannotShowMIMETypeWithResponse:(NSURLResponse *)response;
-- (NSError *)interruptForPolicyChangeErrorWithRequest:(NSURLRequest *)request;
-- (BOOL)isHostedByObjectElement;
-- (BOOL)isLoadingMainFrame;
-- (BOOL)_canShowMIMEType:(NSString *)MIMEType;
-- (BOOL)_representationExistsForURLScheme:(NSString *)URLScheme;
-- (NSString *)_generatedMIMETypeForURLScheme:(NSString *)URLScheme;
-- (void)_notifyIconChanged:(NSURL *)iconURL;
-- (void)_checkNavigationPolicyForRequest:(NSURLRequest *)newRequest andCall:(id)obj withSelector:(SEL)sel;
-- (void)_checkContentPolicyForMIMEType:(NSString *)MIMEType andCall:(id)obj withSelector:(SEL)sel;
-- (void)cancelContentPolicy;
-- (void)reload;
-- (void)_reloadAllowingStaleDataWithOverrideEncoding:(NSString *)encoding;
-- (void)_loadRequest:(NSURLRequest *)request triggeringAction:(NSDictionary *)action loadType:(FrameLoadType)loadType formState:(PassRefPtr<WebCore::FormState>)formState;
-
-- (void)didReceiveServerRedirectForProvisionalLoadForFrame;
-- (WebCoreFrameBridge *)bridge;
-- (void)finishedLoadingDocument:(WebDocumentLoader *)loader;
-- (void)committedLoadWithDocumentLoader:(WebDocumentLoader *)loader data:(NSData *)data;
-- (BOOL)isReplacing;
-- (void)setReplacing;
-- (void)revertToProvisionalWithDocumentLoader:(WebDocumentLoader *)loader;
-- (void)documentLoader:(WebDocumentLoader *)loader setMainDocumentError:(NSError *)error;
-- (void)documentLoader:(WebDocumentLoader *)loader mainReceivedCompleteError:(NSError *)error;
-- (void)finalSetupForReplaceWithDocumentLoader:(WebDocumentLoader *)loader;
-- (void)prepareForLoadStart;
-- (BOOL)subframeIsLoading;
-- (void)willChangeTitleForDocument:(WebDocumentLoader *)loader;
-- (void)didChangeTitleForDocument:(WebDocumentLoader *)loader;
-
-- (FrameLoadType)loadType;
-- (void)setLoadType:(FrameLoadType)type;
-
-- (void)invalidatePendingPolicyDecisionCallingDefaultAction:(BOOL)call;
-- (void)checkNewWindowPolicyForRequest:(NSURLRequest *)request action:(NSDictionary *)action frameName:(NSString *)frameName formState:(PassRefPtr<WebCore::FormState>)formState andCall:(id)target withSelector:(SEL)selector;
-- (void)checkNavigationPolicyForRequest:(NSURLRequest *)request documentLoader:(WebDocumentLoader *)loader formState:(PassRefPtr<WebCore::FormState>)formState andCall:(id)target withSelector:(SEL)selector;
-- (void)continueAfterWillSubmitForm:(WebPolicyAction)policy;
-- (void)loadDocumentLoader:(WebDocumentLoader *)loader;
-- (void)loadDocumentLoader:(WebDocumentLoader *)loader withLoadType:(FrameLoadType)loadType formState:(PassRefPtr<WebCore::FormState>)formState;
-
-- (void)didFirstLayout;
-- (BOOL)firstLayoutDone;
-
-- (void)clientRedirectCancelledOrFinished:(BOOL)cancelWithLoadInProgress;
-- (void)clientRedirectedTo:(NSURL *)URL delay:(NSTimeInterval)seconds fireDate:(NSDate *)date lockHistory:(BOOL)lockHistory isJavaScriptFormAction:(BOOL)isJavaScriptFormAction;
-- (void)loadURL:(NSURL *)URL referrer:(NSString *)referrer loadType:(FrameLoadType)loadType target:(NSString *)target triggeringEvent:(NSEvent *)event form:(DOMElement *)form formValues:(NSDictionary *)values;
-- (void)commitProvisionalLoad:(NSDictionary *)pageCache;
-- (BOOL)isQuickRedirectComing;
-- (BOOL)shouldReloadForCurrent:(NSURL *)currentURL andDestination:(NSURL *)destinationURL;
-
-- (void)transitionToCommitted:(NSDictionary *)pageCache;
-- (void)checkLoadCompleteForThisFrame;
-- (void)sendRemainingDelegateMessagesWithIdentifier:(id)identifier response:(NSURLResponse *)response length:(unsigned)length error:(NSError *)error;
-- (NSURLRequest *)requestFromDelegateForRequest:(NSURLRequest *)request identifier:(id *)identifier error:(NSError **)error;
-- (void)loadRequest:(NSURLRequest *)request;
-- (void)loadRequest:(NSURLRequest *)request inFrameNamed:(NSString *)frameName;
-- (void)postWithURL:(NSURL *)URL referrer:(NSString *)referrer target:(NSString *)target data:(NSArray *)postData contentType:(NSString *)contentType triggeringEvent:(NSEvent *)event form:(DOMElement *)form formValues:(NSDictionary *)values;
-
-- (void)checkLoadComplete;
-- (void)detachFromParent;
-- (void)safeLoadURL:(NSURL *)URL;
-- (void)defersCallbacksChanged;
-- (void)detachChildren;
-- (void)addExtraFieldsToRequest:(NSMutableURLRequest *)request mainResource:(BOOL)mainResource alwaysFromRequest:(BOOL)alwaysFromRequest;
-- (NSDictionary *)actionInformationForNavigationType:(NavigationType)navigationType event:(NSEvent *)event originalURL:(NSURL *)URL;
-- (NSDictionary *)actionInformationForLoadType:(FrameLoadType)loadType isFormSubmission:(BOOL)isFormSubmission event:(NSEvent *)event originalURL:(NSURL *)URL;
-
-- (void)setFrameLoaderClient:(id<WebFrameLoaderClient>)cli;
-- (id<WebFrameLoaderClient>)client;
-   
-@end
+        WebFrameState m_state;
+        FrameLoadType m_loadType;
+
+        // state we'll need to continue after waiting for the policy delegate's decision
+        RetainPtr<WebPolicyDecider> m_policyDecider;    
+
+        RetainPtr<NSURLRequest> m_policyRequest;
+        RetainPtr<NSString> m_policyFrameName;
+        RetainPtr<id> m_policyTarget;
+        SEL m_policySelector;
+        RefPtr<FormState> m_policyFormState;
+        FrameLoadType m_policyLoadType;
+
+        bool m_delegateIsHandlingProvisionalLoadError;
+        bool m_delegateIsDecidingNavigationPolicy;
+        bool m_delegateIsHandlingUnimplementablePolicy;
+
+        bool m_firstLayoutDone;
+        bool m_quickRedirectComing;
+        bool m_sentRedirectNotification;
+        bool m_isStoppingLoad;    
+    };
+
+}
index 4f077a48e011e5fbbee3b154526ae16d3de90a62..12c9cefe8654fe0ce7bcece1df6af99e812e9245 100644 (file)
 #import "WebFrameLoader.h"
 
 #import "DOMElementInternal.h"
-#import "DOMHTMLObjectElement.h"
 #import "Element.h"
 #import "FrameMac.h"
+#import "FrameTree.h"
+#import "HTMLNames.h"
 #import "LoaderNSURLExtras.h"
 #import "LoaderNSURLRequestExtras.h"
 #import "WebCoreFrameBridge.h"
 
 using namespace WebCore;
 
-namespace WebCore {
-
-typedef HashSet<RefPtr<WebCore::WebResourceLoader> > ResourceLoaderSet;
-
-static void setDefersCallbacks(const ResourceLoaderSet* set, bool defers)
+@interface WebCoreFrameLoaderAsDelegate : NSObject
 {
-    if (!set)
-        return;
-    const ResourceLoaderSet copy = *set;
-    ResourceLoaderSet::const_iterator end = copy.end();
-    for (ResourceLoaderSet::const_iterator it = copy.begin(); it != end; ++it)
-        (*it)->setDefersCallbacks(defers);
+    FrameLoader* m_loader;
 }
+- (id)initWithLoader:(FrameLoader*)loader;
+- (void)detachFromLoader;
+@end
 
-static void cancelAll(const ResourceLoaderSet* set)
-{
-    if (!set)
-        return;
-    const ResourceLoaderSet copy = *set;
-    ResourceLoaderSet::const_iterator end = copy.end();
-    for (ResourceLoaderSet::const_iterator it = copy.begin(); it != end; ++it)
-        (*it)->cancel();
-}
+namespace WebCore {
 
-}
+using namespace HTMLNames;
+
+typedef HashSet<RefPtr<WebCore::WebResourceLoader> > ResourceLoaderSet;
+
+static double storedTimeOfLastCompletedLoad;
 
 static bool isCaseInsensitiveEqual(NSString *a, NSString *b)
 {
@@ -100,452 +91,409 @@ bool isBackForwardLoadType(FrameLoadType type)
     return false;
 }
 
-@implementation WebFrameLoader
-
-- (id)initWithFrameBridge:(WebCoreFrameBridge *)bridge
+FrameLoader::FrameLoader(Frame* frame)
+    : m_frame(frame)
+    , m_client(nil)
+    , m_state(WebFrameStateCommittedPage)
+    , m_loadType(FrameLoadTypeStandard)
+    , m_delegateIsHandlingProvisionalLoadError(false)
+    , m_delegateIsDecidingNavigationPolicy(false)
+    , m_delegateIsHandlingUnimplementablePolicy(false)
+    , m_firstLayoutDone(false)
+    , m_quickRedirectComing(false)
+    , m_sentRedirectNotification(false)
+    , m_isStoppingLoad(false)
 {
-    self = [super init];
-    if (self) {
-        frameBridge = bridge;
-        state = WebFrameStateCommittedPage;
-    }
-    return self;    
 }
 
-- (void)dealloc
+FrameLoader::~FrameLoader()
 {
-    // FIXME: Is there really a possiblity that any of these could be non-null?
-    if (m_mainResourceLoader)
-        m_mainResourceLoader->deref();
-    delete m_subresourceLoaders;
-    delete m_plugInStreamLoaders;
-    [documentLoader release];
-    [provisionalDocumentLoader release];
-    ASSERT(!policyDocumentLoader);
-    ASSERT(!policyFormState);
-    
-    [super dealloc];
+    [m_asDelegate.get() detachFromLoader];
 }
 
-- (void)finalize
+WebDocumentLoader *FrameLoader::activeDocumentLoader() const
 {
-    if (m_mainResourceLoader)
-        m_mainResourceLoader->deref();
-    [super finalize];
+    if (m_state == WebFrameStateProvisional)
+        return m_provisionalDocumentLoader.get();
+    return m_documentLoader.get();
 }
 
-- (WebDocumentLoader *)activeDocumentLoader
+void FrameLoader::addPlugInStreamLoader(WebResourceLoader* loader)
 {
-    if (state == WebFrameStateProvisional)
-        return provisionalDocumentLoader;
-    
-    return documentLoader;    
+    m_plugInStreamLoaders.add(loader);
+    [activeDocumentLoader() setLoading:YES];
 }
 
-- (void)addPlugInStreamLoader:(WebResourceLoader *)loader
+void FrameLoader::removePlugInStreamLoader(WebResourceLoader* loader)
 {
-    if (!m_plugInStreamLoaders)
-        m_plugInStreamLoaders = new ResourceLoaderSet;
-    m_plugInStreamLoaders->add(loader);
-    [[self activeDocumentLoader] setLoading:YES];
+    m_plugInStreamLoaders.remove(loader);
+    [activeDocumentLoader() updateLoading];
 }
 
-- (void)removePlugInStreamLoader:(WebResourceLoader *)loader
+void FrameLoader::defersCallbacksChanged()
 {
-    ASSERT(m_plugInStreamLoaders);
-    m_plugInStreamLoaders->remove(loader);
-    [[self activeDocumentLoader] updateLoading];
+    bool defers = defersCallbacks();
+    for (Frame* child = m_frame; child; child = child->tree()->traverseNext(m_frame))
+        [Mac(child)->bridge() frameLoader]->setDefersCallbacks(defers);
 }
 
-- (void)defersCallbacksChanged
+bool FrameLoader::defersCallbacks() const
 {
-    BOOL defers = [frameBridge defersLoading];
-    for (WebCoreFrameBridge *frame = frameBridge; frame; frame = [frame traverseNextFrameStayWithin:frameBridge])
-        [[frame frameLoader] setDefersCallbacks:defers];
+    return [bridge() defersLoading];
 }
 
-- (BOOL)defersCallbacks
+static void setAllDefersCallbacks(const ResourceLoaderSet& loaders, bool defers)
 {
-    return [frameBridge defersLoading];
+    const ResourceLoaderSet copy = loaders;
+    ResourceLoaderSet::const_iterator end = copy.end();
+    for (ResourceLoaderSet::const_iterator it = copy.begin(); it != end; ++it)
+        (*it)->setDefersCallbacks(defers);
 }
 
-- (void)setDefersCallbacks:(BOOL)defers
+void FrameLoader::setDefersCallbacks(bool defers)
 {
     if (m_mainResourceLoader)
         m_mainResourceLoader->setDefersCallbacks(defers);
-    setDefersCallbacks(m_subresourceLoaders, defers);
-    setDefersCallbacks(m_plugInStreamLoaders, defers);
-    [client _setDefersCallbacks:defers];
+    setAllDefersCallbacks(m_subresourceLoaders, defers);
+    setAllDefersCallbacks(m_plugInStreamLoaders, defers);
+    [m_client _setDefersCallbacks:defers];
 }
 
-- (void)stopLoadingPlugIns
+static void cancelAll(const ResourceLoaderSet& loaders)
+{
+    const ResourceLoaderSet copy = loaders;
+    ResourceLoaderSet::const_iterator end = copy.end();
+    for (ResourceLoaderSet::const_iterator it = copy.begin(); it != end; ++it)
+        (*it)->cancel();
+}
+
+void FrameLoader::stopLoadingPlugIns()
 {
     cancelAll(m_plugInStreamLoaders);
 }
 
-- (BOOL)isLoadingMainResource
+bool FrameLoader::isLoadingMainResource() const
 {
-    return m_mainResourceLoader != 0;
+    return m_mainResourceLoader;
 }
 
-- (BOOL)isLoadingSubresources
+bool FrameLoader::isLoadingSubresources() const
 {
-    return m_subresourceLoaders && !m_subresourceLoaders->isEmpty();
+    return !m_subresourceLoaders.isEmpty();
 }
 
-- (BOOL)isLoadingPlugIns
+bool FrameLoader::isLoadingPlugIns() const
 {
-    return m_plugInStreamLoaders && !m_plugInStreamLoaders->isEmpty();
+    return !m_plugInStreamLoaders.isEmpty();
 }
 
-- (BOOL)isLoading
+bool FrameLoader::isLoading() const
 {
-    return [self isLoadingMainResource] || [self isLoadingSubresources] || [self isLoadingPlugIns];
+    return isLoadingMainResource() || isLoadingSubresources() || isLoadingPlugIns();
 }
 
-- (void)stopLoadingSubresources
+void FrameLoader::stopLoadingSubresources()
 {
     cancelAll(m_subresourceLoaders);
 }
 
-- (void)addSubresourceLoader:(WebResourceLoader *)loader
+void FrameLoader::addSubresourceLoader(WebResourceLoader* loader)
 {
-    ASSERT(!provisionalDocumentLoader);
-    if (!m_subresourceLoaders)
-        m_subresourceLoaders = new ResourceLoaderSet;
-    m_subresourceLoaders->add(loader);
-    [[self activeDocumentLoader] setLoading:YES];
+    ASSERT(!m_provisionalDocumentLoader);
+    m_subresourceLoaders.add(loader);
+    [activeDocumentLoader() setLoading:YES];
 }
 
-- (void)removeSubresourceLoader:(WebResourceLoader *)loader
+void FrameLoader::removeSubresourceLoader(WebResourceLoader* loader)
 {
-    ASSERT(m_subresourceLoaders);
-    m_subresourceLoaders->remove(loader);
-    [[self activeDocumentLoader] updateLoading];
+    m_subresourceLoaders.remove(loader);
+    [activeDocumentLoader() updateLoading];
+    checkLoadComplete();
 }
 
-- (NSData *)mainResourceData
+NSData *FrameLoader::mainResourceData() const
 {
     if (!m_mainResourceLoader)
         return nil;
     return m_mainResourceLoader->resourceData();
 }
 
-- (void)releaseMainResourceLoader
+void FrameLoader::releaseMainResourceLoader()
 {
-    if (!m_mainResourceLoader)
-        return;
-    m_mainResourceLoader->deref();
     m_mainResourceLoader = 0;
 }
 
-- (void)cancelMainResourceLoad
+void FrameLoader::cancelMainResourceLoad()
 {
     if (m_mainResourceLoader)
         m_mainResourceLoader->cancel();
 }
 
-- (BOOL)startLoadingMainResourceWithRequest:(NSMutableURLRequest *)request identifier:(id)identifier
+bool FrameLoader::startLoadingMainResource(NSMutableURLRequest *request, id identifier)
 {
     ASSERT(!m_mainResourceLoader);
-    m_mainResourceLoader = MainResourceLoader::create(self).release();
-    
+    m_mainResourceLoader = MainResourceLoader::create(m_frame);
     m_mainResourceLoader->setIdentifier(identifier);
-    [self addExtraFieldsToRequest:request mainResource:YES alwaysFromRequest:NO];
+    addExtraFieldsToRequest(request, true, false);
     if (!m_mainResourceLoader->load(request)) {
-        // FIXME: if this should really be caught, we should just ASSERT this doesn't happen;
+        // FIXME: If this should really be caught, we should just ASSERT this doesn't happen;
         // should it be caught by other parts of WebKit or other parts of the app?
         LOG_ERROR("could not create WebResourceHandle for URL %@ -- should be caught by policy handler level", [request URL]);
-        m_mainResourceLoader->deref();
         m_mainResourceLoader = 0;
-        return NO;
+        return false;
     }
-    
-    return YES;
+    return true;
 }
 
-- (void)stopLoadingWithError:(NSError *)error
+void FrameLoader::stopLoading(NSError *error)
 {
     m_mainResourceLoader->cancel(error);
 }
 
-- (void)setDocumentLoader:(WebDocumentLoader *)loader
+void FrameLoader::setDocumentLoader(WebDocumentLoader* loader)
 {
-    if (loader == nil && documentLoader == nil)
+    if (!loader && !m_documentLoader)
         return;
     
-    ASSERT(loader != documentLoader);
-    
-    [client _prepareForDataSourceReplacement];
-    [documentLoader detachFromFrameLoader];
-    
-    [loader retain];
-    [documentLoader release];
-    documentLoader = loader;
+    ASSERT(loader != m_documentLoader);
+    ASSERT(!loader || [loader frameLoader] == this);
+
+    [m_client _prepareForDataSourceReplacement];
+    [m_documentLoader.get() detachFromFrame];
+
+    m_documentLoader = loader;
 }
 
-- (WebDocumentLoader *)documentLoader
+WebDocumentLoader *FrameLoader::documentLoader() const
 {
-    return documentLoader;
+    return m_documentLoader.get();
 }
 
-- (void)setPolicyDocumentLoader:(WebDocumentLoader *)loader
+void FrameLoader::setPolicyDocumentLoader(WebDocumentLoader *loader)
 {
-    if (policyDocumentLoader == loader)
+    if (m_policyDocumentLoader == loader)
         return;
 
-    if (policyDocumentLoader != provisionalDocumentLoader && policyDocumentLoader != documentLoader)
-        [policyDocumentLoader detachFromFrameLoader];
+    ASSERT(m_frame);
+    [loader setFrame:m_frame];
+    if (m_policyDocumentLoader != m_provisionalDocumentLoader && m_policyDocumentLoader != m_documentLoader)
+        [m_policyDocumentLoader.get() detachFromFrame];
 
-    [policyDocumentLoader release];
-    [loader retain];
-    policyDocumentLoader = loader;
+    m_policyDocumentLoader = loader;
 }
    
-- (WebDocumentLoader *)provisionalDocumentLoader
+WebDocumentLoader* FrameLoader::provisionalDocumentLoader()
 {
-    return provisionalDocumentLoader;
+    return m_provisionalDocumentLoader.get();
 }
 
-- (void)setProvisionalDocumentLoader:(WebDocumentLoader *)loader
+void FrameLoader::setProvisionalDocumentLoader(WebDocumentLoader *loader)
 {
-    ASSERT(!loader || !provisionalDocumentLoader);
+    ASSERT(!loader || !m_provisionalDocumentLoader);
+    ASSERT(!loader || [loader frameLoader] == this);
 
-    if (provisionalDocumentLoader != documentLoader)
-        [provisionalDocumentLoader detachFromFrameLoader];
+    if (m_provisionalDocumentLoader != m_documentLoader)
+        [m_provisionalDocumentLoader.get() detachFromFrame];
 
-    [loader retain];
-    [provisionalDocumentLoader release];
-    provisionalDocumentLoader = loader;
+    m_provisionalDocumentLoader = loader;
 }
 
-- (WebFrameState)state
+WebFrameState FrameLoader::state() const
 {
-    return state;
+    return m_state;
 }
 
-#if !LOG_DISABLED
-static const char * const stateNames[] = {
-    "WebFrameStateProvisional",
-    "WebFrameStateCommittedPage",
-    "WebFrameStateComplete"
-};
-#endif
-
-static CFAbsoluteTime _timeOfLastCompletedLoad;
-
-+ (CFAbsoluteTime)timeOfLastCompletedLoad
+double FrameLoader::timeOfLastCompletedLoad()
 {
-    return _timeOfLastCompletedLoad;
+    return storedTimeOfLastCompletedLoad;
 }
 
-- (void)provisionalLoadStarted
+void FrameLoader::provisionalLoadStarted()
 {
-    firstLayoutDone = NO;
-    [frameBridge provisionalLoadStarted];
-
-    [client _provisionalLoadStarted];
+    m_firstLayoutDone = false;
+    [bridge() provisionalLoadStarted];
+    [m_client _provisionalLoadStarted];
 }
 
-- (void)setState:(WebFrameState)newState
+void FrameLoader::setState(WebFrameState newState)
 {    
-    state = newState;
-    
-    if (state == WebFrameStateProvisional)
-        [self provisionalLoadStarted];
-    else if (state == WebFrameStateComplete) {
-        [self frameLoadCompleted];
-        _timeOfLastCompletedLoad = CFAbsoluteTimeGetCurrent();
-        [[self documentLoader] stopRecordingResponses];
+    m_state = newState;
+    
+    if (newState == WebFrameStateProvisional)
+        provisionalLoadStarted();
+    else if (newState == WebFrameStateComplete) {
+        frameLoadCompleted();
+        storedTimeOfLastCompletedLoad = CFAbsoluteTimeGetCurrent();
+        [documentLoader() stopRecordingResponses];
     }
 }
 
-- (void)clearProvisionalLoad
+void FrameLoader::clearProvisionalLoad()
 {
-    [self setProvisionalDocumentLoader:nil];
-    [client _progressCompleted];
-    [self setState:WebFrameStateComplete];
+    setProvisionalDocumentLoader(nil);
+    [m_client _progressCompleted];
+    setState(WebFrameStateComplete);
 }
 
-- (void)markLoadComplete
+void FrameLoader::markLoadComplete()
 {
-    [self setState:WebFrameStateComplete];
+    setState(WebFrameStateComplete);
 }
 
-- (void)commitProvisionalLoad
+void FrameLoader::commitProvisionalLoad()
 {
-    [self stopLoadingSubresources];
-    [self stopLoadingPlugIns];
+    stopLoadingSubresources();
+    stopLoadingPlugIns();
 
-    [self setDocumentLoader:provisionalDocumentLoader];
-    [self setProvisionalDocumentLoader:nil];
-    [self setState:WebFrameStateCommittedPage];
+    setDocumentLoader(m_provisionalDocumentLoader.get());
+    setProvisionalDocumentLoader(nil);
+    setState(WebFrameStateCommittedPage);
 }
 
-- (void)stopLoadingSubframes
+void FrameLoader::stopLoadingSubframes()
 {
-    for (WebCoreFrameBridge *child = [frameBridge firstChild]; child; child = [child nextSibling])
-        [[child frameLoader] stopLoading];
+    for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling())
+        [Mac(child)->bridge() frameLoader]->stopLoading();
 }
 
-- (void)stopLoading
+void FrameLoader::stopLoading()
 {
     // If this method is called from within this method, infinite recursion can occur (3442218). Avoid this.
-    if (isStoppingLoad)
+    if (m_isStoppingLoad)
         return;
-    
-    isStoppingLoad = YES;
-    
-    [self invalidatePendingPolicyDecisionCallingDefaultAction:YES];
-    
-    [self stopLoadingSubframes];
-    [provisionalDocumentLoader stopLoading];
-    [documentLoader stopLoading];
-    [self setProvisionalDocumentLoader:nil];
-    [client _clearArchivedResources];
 
-    isStoppingLoad = NO;    
+    m_isStoppingLoad = true;
+
+    invalidatePendingPolicyDecision(true);
+
+    stopLoadingSubframes();
+    [m_provisionalDocumentLoader.get() stopLoading];
+    [m_documentLoader.get() stopLoading];
+    setProvisionalDocumentLoader(nil);
+    [m_client _clearArchivedResources];
+
+    m_isStoppingLoad = false;    
 }
 
-// FIXME: poor method name; also why is this not part of startProvisionalLoad:?
-- (void)startLoading
+// FIXME: Poor method name; also, why is this not part of startProvisionalLoad:?
+void FrameLoader::startLoading()
 {
-    [provisionalDocumentLoader prepareForLoadStart];
-        
-    if ([self isLoadingMainResource])
+    [m_provisionalDocumentLoader.get() prepareForLoadStart];
+
+    if (isLoadingMainResource())
         return;
 
-    [client _clearLoadingFromPageCacheForDocumentLoader:provisionalDocumentLoader];
+    [m_client _clearLoadingFromPageCacheForDocumentLoader:m_provisionalDocumentLoader.get()];
 
-    id identifier = [client _dispatchIdentifierForInitialRequest:[provisionalDocumentLoader originalRequest] fromDocumentLoader:provisionalDocumentLoader];
+    id identifier = [m_client _dispatchIdentifierForInitialRequest:[m_provisionalDocumentLoader.get() originalRequest]
+        fromDocumentLoader:m_provisionalDocumentLoader.get()];
         
-    if (![self startLoadingMainResourceWithRequest:[provisionalDocumentLoader actualRequest] identifier:identifier])
-        [provisionalDocumentLoader updateLoading];
-}
-
-- (void)startProvisionalLoad:(WebDocumentLoader *)loader
-{
-    [self setProvisionalDocumentLoader:loader];
-    [self setState:WebFrameStateProvisional];
+    if (!startLoadingMainResource([m_provisionalDocumentLoader.get() actualRequest], identifier))
+        [m_provisionalDocumentLoader.get() updateLoading];
 }
 
-- (void)setupForReplace
+void FrameLoader::setupForReplace()
 {
-    [self setState:WebFrameStateProvisional];
-    WebDocumentLoader *old = provisionalDocumentLoader;
-    provisionalDocumentLoader = documentLoader;
-    documentLoader = nil;
-    [old release];
-    
-    [self detachChildren];
+    setState(WebFrameStateProvisional);
+    m_provisionalDocumentLoader = m_documentLoader;
+    m_documentLoader = nil;
+    detachChildren();
 }
 
-- (id)_identifierForInitialRequest:(NSURLRequest *)clientRequest
+id FrameLoader::identifierForInitialRequest(NSURLRequest *clientRequest)
 {
-    // FIXME: why retain here, but not in the other place this happens?
-
-    // The identifier is released after the last callback, rather than in dealloc,
-    // to avoid potential cycles.    
-    return [[client _dispatchIdentifierForInitialRequest:clientRequest fromDocumentLoader:[self activeDocumentLoader]] retain];
+    return [m_client _dispatchIdentifierForInitialRequest:clientRequest fromDocumentLoader:activeDocumentLoader()];
 }
 
-- (NSURLRequest *)_willSendRequest:(NSMutableURLRequest *)clientRequest forResource:(id)identifier redirectResponse:(NSURLResponse *)redirectResponse
+NSURLRequest *FrameLoader::willSendRequest(WebResourceLoader* loader, NSMutableURLRequest *clientRequest, NSURLResponse *redirectResponse)
 {
-    [clientRequest setValue:[frameBridge userAgentForURL:[clientRequest URL]] forHTTPHeaderField:@"User-Agent"];
-    return [client _dispatchResource:identifier willSendRequest:clientRequest redirectResponse:redirectResponse fromDocumentLoader:[self activeDocumentLoader]];
+    [clientRequest setValue:[bridge() userAgentForURL:[clientRequest URL]] forHTTPHeaderField:@"User-Agent"];
+    return [m_client _dispatchResource:loader->identifier() willSendRequest:clientRequest
+        redirectResponse:redirectResponse fromDocumentLoader:activeDocumentLoader()];
 }
 
-- (void)_didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)currentWebChallenge forResource:(id)identifier
+void FrameLoader::didReceiveAuthenticationChallenge(WebResourceLoader* loader, NSURLAuthenticationChallenge *currentWebChallenge)
 {
-    [client _dispatchDidReceiveAuthenticationChallenge:currentWebChallenge forResource:identifier fromDocumentLoader:[self activeDocumentLoader]];
+    [m_client _dispatchDidReceiveAuthenticationChallenge:currentWebChallenge
+        forResource:loader->identifier() fromDocumentLoader:activeDocumentLoader()];
 }
 
-- (void)_didCancelAuthenticationChallenge:(NSURLAuthenticationChallenge *)currentWebChallenge forResource:(id)identifier
+void FrameLoader::didCancelAuthenticationChallenge(WebResourceLoader* loader, NSURLAuthenticationChallenge *currentWebChallenge)
 {
-    [client _dispatchDidCancelAuthenticationChallenge:currentWebChallenge forResource:identifier fromDocumentLoader:[self activeDocumentLoader]];
+    [m_client _dispatchDidCancelAuthenticationChallenge:currentWebChallenge
+        forResource:loader->identifier() fromDocumentLoader:activeDocumentLoader()];
 }
 
-- (void)_didReceiveResponse:(NSURLResponse *)r forResource:(id)identifier
+void FrameLoader::didReceiveResponse(WebResourceLoader* loader, NSURLResponse *r)
 {
-    [[self activeDocumentLoader] addResponse:r];
+    [activeDocumentLoader() addResponse:r];
     
-    [client _incrementProgressForIdentifier:identifier response:r];
-    [client _dispatchResource:identifier didReceiveResponse:r fromDocumentLoader:[self activeDocumentLoader]];
+    [m_client _incrementProgressForIdentifier:loader->identifier() response:r];
+    [m_client _dispatchResource:loader->identifier() didReceiveResponse:r fromDocumentLoader:activeDocumentLoader()];
 }
 
-- (void)_didReceiveData:(NSData *)data contentLength:(int)lengthReceived forResource:(id)identifier
+void FrameLoader::didReceiveData(WebResourceLoader* loader, NSData *data, int lengthReceived)
 {
-    [client _incrementProgressForIdentifier:identifier data:data];
-    [client _dispatchResource:identifier didReceiveContentLength:lengthReceived fromDocumentLoader:[self activeDocumentLoader]];
+    [m_client _incrementProgressForIdentifier:loader->identifier() data:data];
+    [m_client _dispatchResource:loader->identifier() didReceiveContentLength:lengthReceived fromDocumentLoader:activeDocumentLoader()];
 }
 
-- (void)_didFinishLoadingForResource:(id)identifier
+void FrameLoader::didFinishLoad(WebResourceLoader* loader)
 {    
-    [client _completeProgressForIdentifier:identifier];
-    [client _dispatchResource:identifier didFinishLoadingFromDocumentLoader:[self activeDocumentLoader]];
+    [m_client _completeProgressForIdentifier:loader->identifier()];
+    [m_client _dispatchResource:loader->identifier() didFinishLoadingFromDocumentLoader:activeDocumentLoader()];
 }
 
-- (void)_didFailLoadingWithError:(NSError *)error forResource:(id)identifier
+void FrameLoader::didFailToLoad(WebResourceLoader* loader, NSError *error)
 {
-    [client _completeProgressForIdentifier:identifier];
+    [m_client _completeProgressForIdentifier:loader->identifier()];
     if (error)
-        [client _dispatchResource:identifier didFailLoadingWithError:error fromDocumentLoader:[self activeDocumentLoader]];
+        [m_client _dispatchResource:loader->identifier() didFailLoadingWithError:error fromDocumentLoader:activeDocumentLoader()];
 }
 
-- (BOOL)_privateBrowsingEnabled
+bool FrameLoader::privateBrowsingEnabled() const
 {
-    return [client _privateBrowsingEnabled];
+    return [m_client _privateBrowsingEnabled];
 }
 
-- (void)_finishedLoadingResource
+NSURLRequest *FrameLoader::originalRequest() const
 {
-    [self checkLoadComplete];
+    return [activeDocumentLoader() originalRequestCopy];
 }
 
-- (void)_receivedError:(NSError *)error
+void FrameLoader::receivedMainResourceError(NSError *error, bool isComplete)
 {
-    [self checkLoadComplete];
-}
-
-- (NSURLRequest *)_originalRequest
-{
-    return [[self activeDocumentLoader] originalRequestCopy];
-}
-
-- (void)_receivedMainResourceError:(NSError *)error complete:(BOOL)isComplete
-{
-    WebDocumentLoader *loader = [self activeDocumentLoader];
+    WebDocumentLoader *loader = activeDocumentLoader();
     [loader retain];
     
-    WebCoreFrameBridge *bridge = frameBridge;
+    WebCoreFrameBridge *bridge = FrameLoader::bridge();
     
     // Retain the bridge because the stop may release the last reference to it.
     [bridge retain];
  
-    id<WebFrameLoaderClient> cli = [client retain];
+    id<WebFrameLoaderClient> cli = [m_client retain];
    
     if (isComplete) {
         // FIXME: Don't want to do this if an entirely new load is going, so should check
-        // that both data sources on the frame are either self or nil.
+        // that both data sources on the frame are either this or nil.
         // Can't call _bridge because we might not have commited yet
         [bridge stop];
         if ([cli _shouldFallBackForError:error])
             [bridge handleFallbackContent];
     }
     
-    if ([self state] == WebFrameStateProvisional) {
-        NSURL *failedURL = [[provisionalDocumentLoader originalRequestCopy] URL];
+    if (m_state == WebFrameStateProvisional) {
+        NSURL *failedURL = [[m_provisionalDocumentLoader.get() originalRequestCopy] URL];
         [bridge didNotOpenURL:failedURL];
-        [client _invalidateCurrentItemPageCache];
+        [m_client _invalidateCurrentItemPageCache];
         
-        // Call -_clientRedirectCancelledOrFinished: here so that the frame load delegate is notified that the redirect's
-        // status has changed, if there was a redirect.  The frame load delegate may have saved some state about
-        // the redirect in its -webView:willPerformClientRedirectToURL:delay:fireDate:forFrame:.  Since we are definitely
+        // Call clientRedirectCancelledOrFinished here so that the frame load delegate is notified that the redirect's
+        // status has changed, if there was a redirect. The frame load delegate may have saved some state about
+        // the redirect in its -webView:willPerformClientRedirectToURL:delay:fireDate:forFrame:. Since we are definitely
         // not going to use this provisional resource, as it was cancelled, notify the frame load delegate that the redirect
         // has ended.
-        if (sentRedirectNotification)
-            [self clientRedirectCancelledOrFinished:NO];
+        if (m_sentRedirectNotification)
+            clientRedirectCancelledOrFinished(false);
     }
     
     
@@ -556,97 +504,81 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
     [loader release];
 }
 
-- (void)clientRedirectCancelledOrFinished:(BOOL)cancelWithLoadInProgress
+void FrameLoader::clientRedirectCancelledOrFinished(bool cancelWithLoadInProgress)
 {
     // Note that -webView:didCancelClientRedirectForFrame: is called on the frame load delegate even if
     // the redirect succeeded.  We should either rename this API, or add a new method, like
     // -webView:didFinishClientRedirectForFrame:
-    [client _dispatchDidCancelClientRedirectForFrame];
+    [m_client _dispatchDidCancelClientRedirectForFrame];
 
     if (!cancelWithLoadInProgress)
-        quickRedirectComing = NO;
-    
-    sentRedirectNotification = NO;
+        m_quickRedirectComing = false;
+
+    m_sentRedirectNotification = false;
 }
 
-- (void)clientRedirectedTo:(NSURL *)URL delay:(NSTimeInterval)seconds fireDate:(NSDate *)date lockHistory:(BOOL)lockHistory isJavaScriptFormAction:(BOOL)isJavaScriptFormAction
+void FrameLoader::clientRedirected(NSURL *URL, double seconds, NSDate *date, bool lockHistory, bool isJavaScriptFormAction)
 {
-    [client _dispatchWillPerformClientRedirectToURL:URL delay:seconds fireDate:date];
+    [m_client _dispatchWillPerformClientRedirectToURL:URL delay:seconds fireDate:date];
     
     // Remember that we sent a redirect notification to the frame load delegate so that when we commit
     // the next provisional load, we can send a corresponding -webView:didCancelClientRedirectForFrame:
-    sentRedirectNotification = YES;
+    m_sentRedirectNotification = true;
     
     // If a "quick" redirect comes in an, we set a special mode so we treat the next
-    // load as part of the same navigation.
-    
-    if (!documentLoader || isJavaScriptFormAction) {
-        // If we don't have a dataSource, we have no "original" load on which to base a redirect,
-        // so we better just treat the redirect as a normal load.
-        quickRedirectComing = NO;
-    } else {
-        quickRedirectComing = lockHistory;
-    }
+    // load as part of the same navigation. If we don't have a document loader, we have
+    // no "original" load on which to base a redirect, so we treat the redirect as a normal load.
+    m_quickRedirectComing = lockHistory && m_documentLoader && !isJavaScriptFormAction;
 }
 
-- (BOOL)shouldReloadForCurrent:(NSURL *)currentURL andDestination:(NSURL *)destinationURL
+bool FrameLoader::shouldReload(NSURL *currentURL, NSURL *destinationURL)
 {
-    return !(([currentURL fragment] || [destinationURL fragment]) &&
-             [urlByRemovingFragment(currentURL) isEqual:urlByRemovingFragment(destinationURL)]);
+    return !(([currentURL fragment] || [destinationURL fragment])
+        && [urlByRemovingFragment(currentURL) isEqual:urlByRemovingFragment(destinationURL)]);
 }
 
-// main funnel for navigating via callback from WebCore (e.g., clicking a link, redirect)
-- (void)loadURL:(NSURL *)URL referrer:(NSString *)referrer loadType:(FrameLoadType)_loadType target:(NSString *)target triggeringEvent:(NSEvent *)event form:(DOMElement *)form formValues:(NSDictionary *)values
+void FrameLoader::load(NSURL *URL, NSString *referrer, FrameLoadType newLoadType, NSString *target, NSEvent *event, DOMElement *form, NSDictionary *values)
 {
-    BOOL isFormSubmission = (values != nil);
+    bool isFormSubmission = values != nil;
     
     NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:URL];
     setHTTPReferrer(request, referrer);
-    [self addExtraFieldsToRequest:request mainResource:YES alwaysFromRequest:(event != nil || isFormSubmission)];
-    if (_loadType == FrameLoadTypeReload)
+    addExtraFieldsToRequest(request, true, event || isFormSubmission);
+    if (newLoadType == FrameLoadTypeReload)
         [request setCachePolicy:NSURLRequestReloadIgnoringCacheData];
-    
-    // I believe this is never called with LoadSame.  If it is, we probably want to set the cache
-    // policy of LoadFromOrigin, but I didn't test that.
-    ASSERT(_loadType != FrameLoadTypeSame);
-    
-    NSDictionary *action = [self actionInformationForLoadType:_loadType isFormSubmission:isFormSubmission event:event originalURL:URL];
+
+    ASSERT(newLoadType != FrameLoadTypeSame);
+
+    NSDictionary *action = actionInformation(newLoadType, isFormSubmission, event, URL);
     RefPtr<FormState> formState;
     if (form && values)
-        formState = FormState::create(form, values, frameBridge);
+        formState = FormState::create(form, values, bridge());
     
-    if (target != nil) {
-        WebCoreFrameBridge *targetFrame = [frameBridge findFrameNamed:target];
-        if (targetFrame != nil) {
-            [[targetFrame frameLoader] loadURL:URL referrer:referrer loadType:_loadType target:nil triggeringEvent:event form:form formValues:values];
-        } else {
-            [self checkNewWindowPolicyForRequest:request
-                                          action:action
-                                       frameName:target
-                                       formState:formState.release()
-                                         andCall:self
-                                    withSelector:@selector(continueLoadRequestAfterNewWindowPolicy:frameName:formState:)];
-        }
+    if (target) {
+        Frame* targetFrame = m_frame->tree()->find(target);
+        if (targetFrame)
+            [Mac(targetFrame)->bridge() frameLoader]->load(URL, referrer, newLoadType, nil, event, form, values);
+        else
+            checkNewWindowPolicy(request, action, target, formState.release());
         [request release];
         return;
     }
-    
-    WebDocumentLoader *oldDocumentLoader = [documentLoader retain];
-    
-    BOOL sameURL = [client _shouldTreatURLAsSameAsCurrent:URL];
+
+    WebDocumentLoader *oldDocumentLoader = [m_documentLoader.get() retain];
+
+    bool sameURL = [m_client _shouldTreatURLAsSameAsCurrent:URL];
     
     // Make sure to do scroll to anchor processing even if the URL is
     // exactly the same so pages with '#' links and DHTML side effects
     // work properly.
     if (!isFormSubmission
-        && _loadType != FrameLoadTypeReload
-        && _loadType != FrameLoadTypeSame
-        && ![self shouldReloadForCurrent:URL andDestination:[frameBridge URL]]
-        
+        && newLoadType != FrameLoadTypeReload
+        && newLoadType != FrameLoadTypeSame
+        && !shouldReload(URL, [bridge() URL])
         // We don't want to just scroll if a link from within a
         // frameset is trying to reload the frameset into _top.
-        && ![frameBridge isFrameSet]) {
-        
+        && ![bridge() isFrameSet]) {
+
         // Just do anchor navigation within the existing content.
         
         // We don't do this if we are submitting a form, explicitly reloading,
@@ -656,41 +588,39 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
         // FIXME: What about load types other than Standard and Reload?
         
         [oldDocumentLoader setTriggeringAction:action];
-        [self invalidatePendingPolicyDecisionCallingDefaultAction:YES];
-        [self checkNavigationPolicyForRequest:request
-                                   documentLoader:oldDocumentLoader formState:formState.release()
-                                      andCall:self withSelector:@selector(continueFragmentScrollAfterNavigationPolicy:formState:)];
+        invalidatePendingPolicyDecision(true);
+        checkNavigationPolicy(request, oldDocumentLoader, formState.release(),
+            asDelegate(), @selector(continueFragmentScrollAfterNavigationPolicy:formState:));
     } else {
         // must grab this now, since this load may stop the previous load and clear this flag
-        BOOL isRedirect = quickRedirectComing;
-        [self _loadRequest:request triggeringAction:action loadType:_loadType formState:formState.release()];
+        bool isRedirect = m_quickRedirectComing;
+        load(request, action, newLoadType, formState.release());
         if (isRedirect) {
-            quickRedirectComing = NO;
-            [provisionalDocumentLoader setIsClientRedirect:YES];
-        } else if (sameURL) {
+            m_quickRedirectComing = false;
+            [m_provisionalDocumentLoader.get() setIsClientRedirect:YES];
+        } else if (sameURL)
             // Example of this case are sites that reload the same URL with a different cookie
             // driving the generated content, or a master frame with links that drive a target
             // frame, where the user has clicked on the same link repeatedly.
-            [self setLoadType:FrameLoadTypeSame];
-        }            
+            m_loadType = FrameLoadTypeSame;
     }
     
     [request release];
     [oldDocumentLoader release];
 }
 
--(void)continueFragmentScrollAfterNavigationPolicy:(NSURLRequest *)request formState:(FormState *)formState
+void FrameLoader::continueFragmentScrollAfterNavigationPolicy(NSURLRequest *request)
 {
     if (!request)
         return;
     
     NSURL *URL = [request URL];
     
-    BOOL isRedirect = quickRedirectComing;
-    quickRedirectComing = NO;
+    bool isRedirect = m_quickRedirectComing;
+    m_quickRedirectComing = false;
     
-    [documentLoader replaceRequestURLForAnchorScrollWithURL:URL];
-    if (!isRedirect && ![client _shouldTreatURLAsSameAsCurrent:URL]) {
+    [m_documentLoader.get() replaceRequestURLForAnchorScrollWithURL:URL];
+    if (!isRedirect && ![m_client _shouldTreatURLAsSameAsCurrent:URL]) {
         // NB: must happen after _setURL, since we add based on the current request.
         // Must also happen before we openURL and displace the scroll position, since
         // adding the BF item will save away scroll state.
@@ -702,46 +632,45 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
         // we have already saved away the scroll and doc state for the long slow load,
         // but it's not an obvious case.
 
-        [client _addHistoryItemForFragmentScroll];
+        [m_client _addHistoryItemForFragmentScroll];
     }
     
-    [frameBridge scrollToAnchorWithURL:URL];
+    [bridge() scrollToAnchorWithURL:URL];
     
-    if (!isRedirect) {
+    if (!isRedirect)
         // This will clear previousItem from the rest of the frame tree tree that didn't
-        // doing any loading.  We need to make a pass on this now, since for anchor nav
-        // we'll not go through a real load and reach Completed state
-        [self checkLoadComplete];
-    }
+        // doing any loading. We need to make a pass on this now, since for anchor nav
+        // we'll not go through a real load and reach Completed state.
+        checkLoadComplete();
  
-    [client _dispatchDidChangeLocationWithinPageForFrame];
-    [client _didFinishLoad];
+    [m_client _dispatchDidChangeLocationWithinPageForFrame];
+    [m_client _didFinishLoad];
 }
 
-- (void)closeOldDataSources
+void FrameLoader::closeOldDataSources()
 {
-    // FIXME: is it important for this traversal to be postorder instead of preorder?
-    // FIXME: add helpers for postorder traversal?
-    for (WebCoreFrameBridge *child = [frameBridge firstChild]; child; child = [child nextSibling])
-        [[child frameLoader] closeOldDataSources];
+    // FIXME: Is it important for this traversal to be postorder instead of preorder?
+    // If so, add helpers for postorder traversal, and use them. If not, then lets not
+    // use a recursive algorithm here.
+    for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling())
+        [Mac(child)->bridge() frameLoader]->closeOldDataSources();
     
-    if (documentLoader)
-        [client _dispatchWillCloseFrame];
+    if (m_documentLoader)
+        [m_client _dispatchWillCloseFrame];
 
-    [client _setMainFrameDocumentReady:NO]; // stop giving out the actual DOMDocument to observers
+    [m_client _setMainFrameDocumentReady:NO]; // stop giving out the actual DOMDocument to observers
 }
 
-// Called after we send an openURL:... down to WebCore.
-- (void)opened
+void FrameLoader::opened()
 {
-    if ([self loadType] == FrameLoadTypeStandard && [documentLoader isClientRedirect])
-        [client _updateHistoryAfterClientRedirect];
+    if (m_loadType == FrameLoadTypeStandard && [m_documentLoader.get() isClientRedirect])
+        [m_client _updateHistoryAfterClientRedirect];
 
-    if ([client _isDocumentLoaderLoadingFromPageCache:documentLoader]) {
+    if ([m_client _isDocumentLoaderLoadingFromPageCache:m_documentLoader.get()]) {
         // Force a layout to update view size and thereby update scrollbars.
-        [client _forceLayout];
+        [m_client _forceLayout];
 
-        NSArray *responses = [[self documentLoader] responses];
+        NSArray *responses = [m_documentLoader.get() responses];
         NSURLResponse *response;
         int i, count = [responses count];
         for (i = 0; i < count; i++) {
@@ -750,45 +679,45 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
             NSError *error;
             id identifier;
             NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[response URL]];
-            [self requestFromDelegateForRequest:request identifier:&identifier error:&error];
-            [self sendRemainingDelegateMessagesWithIdentifier:identifier response:response length:(unsigned)[response expectedContentLength] error:error];
+            requestFromDelegate(request, identifier, error);
+            sendRemainingDelegateMessages(identifier, response, (unsigned)[response expectedContentLength], error);
             [request release];
         }
         
-        [client _loadedFromPageCache];
+        [m_client _loadedFromPageCache];
 
-        [[self documentLoader] setPrimaryLoadComplete:YES];
+        [m_documentLoader.get() setPrimaryLoadComplete:YES];
 
         // FIXME: Why only this frame and not parent frames?
-        [self checkLoadCompleteForThisFrame];
+        checkLoadCompleteForThisFrame();
     }
 }
 
-- (void)commitProvisionalLoad:(NSDictionary *)pageCache
+void FrameLoader::commitProvisionalLoad(NSDictionary *pageCache)
 {
-    bool reload = loadType == FrameLoadTypeReload || loadType == FrameLoadTypeReloadAllowingStaleData;
+    bool reload = m_loadType == FrameLoadTypeReload || m_loadType == FrameLoadTypeReloadAllowingStaleData;
     
-    WebDocumentLoader *pdl = [provisionalDocumentLoader retain];
+    WebDocumentLoader *pdl = [m_provisionalDocumentLoader.get() retain];
     
     NSURLResponse *response = [pdl response];
     
     NSDictionary *headers = [response isKindOfClass:[NSHTTPURLResponse class]]
         ? [(NSHTTPURLResponse *)response allHeaderFields] : nil;
     
-    if (loadType != FrameLoadTypeReplace)
-        [self closeOldDataSources];
+    if (m_loadType != FrameLoadTypeReplace)
+        closeOldDataSources();
     
     if (!pageCache)
-        [client _makeRepresentationForDocumentLoader:pdl];
+        [m_client _makeRepresentationForDocumentLoader:pdl];
     
-    [self transitionToCommitted:pageCache];
+    transitionToCommitted(pageCache);
     
     // Call -_clientRedirectCancelledOrFinished: here so that the frame load delegate is notified that the redirect's
     // status has changed, if there was a redirect.  The frame load delegate may have saved some state about
     // the redirect in its -webView:willPerformClientRedirectToURL:delay:fireDate:forFrame:.  Since we are
     // just about to commit a new page, there cannot possibly be a pending redirect at this point.
-    if (sentRedirectNotification)
-        [self clientRedirectCancelledOrFinished:NO];
+    if (m_sentRedirectNotification)
+        clientRedirectCancelledOrFinished(false);
     
     NSURL *baseURL = [[pdl request] _webDataRequestBaseURL];        
     NSURL *URL = baseURL ? baseURL : [response URL];
@@ -796,74 +725,73 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
     if (!URL || urlIsEmpty(URL))
         URL = [NSURL URLWithString:@"about:blank"];    
     
-    [frameBridge openURL:URL
-                     reload:reload 
-                contentType:[response MIMEType]
-                    refresh:[headers objectForKey:@"Refresh"]
-               lastModified:(pageCache ? nil : wkGetNSURLResponseLastModifiedDate(response))
-                  pageCache:pageCache];
+    [bridge() openURL:URL
+               reload:reload 
+          contentType:[response MIMEType]
+              refresh:[headers objectForKey:@"Refresh"]
+         lastModified:(pageCache ? nil : wkGetNSURLResponseLastModifiedDate(response))
+            pageCache:pageCache];
     
-    [self opened];
+    opened();
     
     [pdl release];
 }
 
-- (NSURLRequest *)initialRequest
+NSURLRequest *FrameLoader::initialRequest() const
 {
-    return [[self activeDocumentLoader] initialRequest];
+    return [activeDocumentLoader() initialRequest];
 }
 
-- (void)_receivedData:(NSData *)data
+void FrameLoader::receivedData(NSData *data)
 {
-    [[self activeDocumentLoader] receivedData:data];
+    [activeDocumentLoader() receivedData:data];
 }
 
-- (void)_setRequest:(NSURLRequest *)request
+void FrameLoader::setRequest(NSURLRequest *request)
 {
-    [[self activeDocumentLoader] setRequest:request];
+    [activeDocumentLoader() setRequest:request];
 }
 
-- (void)_downloadWithLoadingConnection:(NSURLConnection *)connection
-    request:(NSURLRequest *)request response:(NSURLResponse *)response proxy:(id)proxy
+void FrameLoader::download(NSURLConnection *connection, NSURLRequest *request, NSURLResponse *response, id proxy)
 {
-    [client _downloadWithLoadingConnection:connection request:request response:response proxy:proxy];
+    [m_client _downloadWithLoadingConnection:connection request:request response:response proxy:proxy];
 }
 
-- (WebCoreFrameBridge *)bridge
+WebCoreFrameBridge *FrameLoader::bridge() const
 {
-    return frameBridge;
+    return Mac(m_frame)->bridge();
 }
 
-- (void)_handleFallbackContent
+void FrameLoader::handleFallbackContent()
 {
-    [frameBridge handleFallbackContent];
+    [bridge() handleFallbackContent];
 }
 
-- (BOOL)_isStopping
+bool FrameLoader::isStopping() const
 {
-    return [[self activeDocumentLoader] isStopping];
+    return [activeDocumentLoader() isStopping];
 }
 
-- (void)_setupForReplaceByMIMEType:(NSString *)newMIMEType
+void FrameLoader::setupForReplaceByMIMEType(NSString *newMIMEType)
 {
-    [[self activeDocumentLoader] setupForReplaceByMIMEType:newMIMEType];
+    [activeDocumentLoader() setupForReplaceByMIMEType:newMIMEType];
 }
 
-- (void)_setResponse:(NSURLResponse *)response
+void FrameLoader::setResponse(NSURLResponse *response)
 {
-    [[self activeDocumentLoader] setResponse:response];
+    [activeDocumentLoader() setResponse:response];
 }
 
-- (void)_mainReceivedError:(NSError *)error complete:(BOOL)isComplete
+void FrameLoader::mainReceivedError(NSError *error, bool isComplete)
 {
-    [[self activeDocumentLoader] mainReceivedError:error complete:isComplete];
+    [activeDocumentLoader() mainReceivedError:error complete:isComplete];
 }
 
-- (void)_finishedLoading
+void FrameLoader::finishedLoading()
 {
-    WebDocumentLoader *dl = [self activeDocumentLoader];
+    WebDocumentLoader *dl = activeDocumentLoader();
     
-    WebCoreFrameBridge *bridge = frameBridge;
+    WebCoreFrameBridge *bridge = FrameLoader::bridge();
 
     [bridge retain];
     [dl finishedLoading];
@@ -874,216 +802,208 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
     }
 
     [dl setPrimaryLoadComplete:YES];
-    [client _dispatchDidLoadMainResourceForDocumentLoader:dl];
-    [self checkLoadComplete];
+    [m_client _dispatchDidLoadMainResourceForDocumentLoader:dl];
+    checkLoadComplete();
 
     [bridge release];
 }
 
-- (void)_notifyIconChanged:(NSURL *)iconURL
+void FrameLoader::notifyIconChanged(NSURL *iconURL)
 {
     ASSERT([[WebCoreIconDatabaseBridge sharedInstance] _isEnabled]);
     NSImage *icon = [[WebCoreIconDatabaseBridge sharedInstance]
-        iconForPageURL:urlOriginalDataAsString([[self activeDocumentLoader] URL])
+        iconForPageURL:urlOriginalDataAsString([activeDocumentLoader() URL])
         withSize:NSMakeSize(16, 16)];
-    [client _dispatchDidReceiveIcon:icon];
+    [m_client _dispatchDidReceiveIcon:icon];
 }
 
-- (NSURL *)_URL
+NSURL *FrameLoader::URL() const
 {
-    return [[self activeDocumentLoader] URL];
+    return [activeDocumentLoader() URL];
 }
 
-- (NSError *)cancelledErrorWithRequest:(NSURLRequest *)request
+NSError *FrameLoader::cancelledError(NSURLRequest *request) const
 {
-    return [client _cancelledErrorWithRequest:request];
+    return [m_client _cancelledErrorWithRequest:request];
 }
 
-- (NSError *)fileDoesNotExistErrorWithResponse:(NSURLResponse *)response
+NSError *FrameLoader::fileDoesNotExistError(NSURLResponse *response) const
 {
-    return [client _fileDoesNotExistErrorWithResponse:response];    
+    return [m_client _fileDoesNotExistErrorWithResponse:response];    
 }
 
-- (BOOL)willUseArchiveForRequest:(NSURLRequest *)request originalURL:(NSURL *)originalURL loader:(WebResourceLoader *)loader
+bool FrameLoader::willUseArchive(WebResourceLoader* loader, NSURLRequest *request, NSURL *originalURL) const
 {
-    return [client _willUseArchiveForRequest:request originalURL:originalURL loader:loader];
+    return [m_client _willUseArchiveForRequest:request originalURL:originalURL loader:loader];
 }
 
-- (BOOL)archiveLoadPendingForLoader:(WebResourceLoader *)loader
+bool FrameLoader::isArchiveLoadPending(WebResourceLoader* loader) const
 {
-    return [client _archiveLoadPendingForLoader:loader];
+    return [m_client _archiveLoadPendingForLoader:loader];
 }
 
-- (void)cancelPendingArchiveLoadForLoader:(WebResourceLoader *)loader
+void FrameLoader::cancelPendingArchiveLoad(WebResourceLoader* loader)
 {
-    [client _cancelPendingArchiveLoadForLoader:loader];
+    [m_client _cancelPendingArchiveLoadForLoader:loader];
 }
 
-- (void)handleUnimplementablePolicyWithError:(NSError *)error
+void FrameLoader::handleUnimplementablePolicy(NSError *error)
 {
-    delegateIsHandlingUnimplementablePolicy = YES;
-    [client _dispatchUnableToImplementPolicyWithError:error];
-    delegateIsHandlingUnimplementablePolicy = NO;
+    m_delegateIsHandlingUnimplementablePolicy = YES;
+    [m_client _dispatchUnableToImplementPolicyWithError:error];
+    m_delegateIsHandlingUnimplementablePolicy = NO;
 }
 
-- (void)cannotShowMIMETypeWithResponse:(NSURLResponse *)response
+void FrameLoader::cannotShowMIMEType(NSURLResponse *response)
 {
-    [self handleUnimplementablePolicyWithError:[client _cannotShowMIMETypeErrorWithResponse:response]];    
+    handleUnimplementablePolicy([m_client _cannotShowMIMETypeErrorWithResponse:response]);
 }
 
-- (NSError *)interruptForPolicyChangeErrorWithRequest:(NSURLRequest *)request
+NSError *FrameLoader::interruptionForPolicyChangeError(NSURLRequest *request)
 {
-    return [client _interruptForPolicyChangeErrorWithRequest:request];
+    return [m_client _interruptForPolicyChangeErrorWithRequest:request];
 }
 
-- (BOOL)isHostedByObjectElement
+bool FrameLoader::isHostedByObjectElement() const
 {
-    // Handle <object> fallback for error cases.            
-    DOMHTMLElement *hostElement = [frameBridge frameElement];
-    return hostElement && [hostElement isKindOfClass:[DOMHTMLObjectElement class]];
+    Element* owner = m_frame->ownerElement();
+    return owner && owner->hasTagName(objectTag);
 }
 
-- (BOOL)isLoadingMainFrame
+bool FrameLoader::isLoadingMainFrame() const
 {
-    return [frameBridge isMainFrame];
+    return [bridge() isMainFrame];
 }
 
-- (BOOL)_canShowMIMEType:(NSString *)MIMEType
+bool FrameLoader::canShowMIMEType(NSString *MIMEType) const
 {
-    return [client _canShowMIMEType:MIMEType];
+    return [m_client _canShowMIMEType:MIMEType];
 }
 
-- (BOOL)_representationExistsForURLScheme:(NSString *)URLScheme
+bool FrameLoader::representationExistsForURLScheme(NSString *URLScheme)
 {
-    return [client _representationExistsForURLScheme:URLScheme];
+    return [m_client _representationExistsForURLScheme:URLScheme];
 }
 
-- (NSString *)_generatedMIMETypeForURLScheme:(NSString *)URLScheme
+NSString *FrameLoader::generatedMIMETypeForURLScheme(NSString *URLScheme)
 {
-    return [client _generatedMIMETypeForURLScheme:URLScheme];
+    return [m_client _generatedMIMETypeForURLScheme:URLScheme];
 }
 
-- (void)_checkNavigationPolicyForRequest:(NSURLRequest *)newRequest andCall:(id)obj withSelector:(SEL)sel
+void FrameLoader::checkNavigationPolicy(NSURLRequest *newRequest, id obj, SEL sel)
 {
-    [self checkNavigationPolicyForRequest:newRequest
-                           documentLoader:[self activeDocumentLoader]
-                                formState:nil
-                                  andCall:obj
-                             withSelector:sel];
+    checkNavigationPolicy(newRequest, activeDocumentLoader(), 0, obj, sel);
 }
 
-- (void)_checkContentPolicyForMIMEType:(NSString *)MIMEType andCall:(id)obj withSelector:(SEL)sel
+void FrameLoader::checkContentPolicy(NSString *MIMEType, id obj, SEL sel)
 {
-    WebPolicyDecider *d = [client _createPolicyDeciderWithTarget:obj action:sel];
-    policyDecider = d;
-    
-    [d retain];
-
-    [client _dispatchDecidePolicyForMIMEType:MIMEType request:[[self activeDocumentLoader] request] decider:d];
-
+    WebPolicyDecider *d = [m_client _createPolicyDeciderWithTarget:obj action:sel];
+    m_policyDecider = d;
+    [m_client _dispatchDecidePolicyForMIMEType:MIMEType request:[activeDocumentLoader() request] decider:d];
     [d release];
 }
 
-- (void)cancelContentPolicy
+void FrameLoader::cancelContentPolicyCheck()
 {
-    [policyDecider invalidate];
-    [policyDecider release];
-    policyDecider = nil;
+    [m_policyDecider.get() invalidate];
+    m_policyDecider = nil;
 }
 
-- (BOOL)shouldReloadToHandleUnreachableURLFromRequest:(NSURLRequest *)request
+bool FrameLoader::shouldReloadToHandleUnreachableURL(NSURLRequest *request)
 {
     NSURL *unreachableURL = [request _webDataRequestUnreachableURL];
     if (unreachableURL == nil)
-        return NO;
-    
-    if (!isBackForwardLoadType(policyLoadType))
-        return NO;
-    
+        return false;
+
+    if (!isBackForwardLoadType(m_policyLoadType))
+        return false;
+
     // We only treat unreachableURLs specially during the delegate callbacks
     // for provisional load errors and navigation policy decisions. The former
     // case handles well-formed URLs that can't be loaded, and the latter
     // case handles malformed URLs and unknown schemes. Loading alternate content
     // at other times behaves like a standard load.
     WebDocumentLoader *compareDocumentLoader = nil;
-    if (delegateIsDecidingNavigationPolicy || delegateIsHandlingUnimplementablePolicy)
-        compareDocumentLoader = policyDocumentLoader;
-    else if (delegateIsHandlingProvisionalLoadError)
-        compareDocumentLoader = [self provisionalDocumentLoader];
-    
-    return compareDocumentLoader != nil && [unreachableURL isEqual:[[compareDocumentLoader request] URL]];
+    if (m_delegateIsDecidingNavigationPolicy || m_delegateIsHandlingUnimplementablePolicy)
+        compareDocumentLoader = m_policyDocumentLoader.get();
+    else if (m_delegateIsHandlingProvisionalLoadError)
+        compareDocumentLoader = m_provisionalDocumentLoader.get();
+
+    return compareDocumentLoader && [unreachableURL isEqual:[[compareDocumentLoader request] URL]];
 }
 
-- (void)loadDocumentLoader:(WebDocumentLoader *)newDocumentLoader
+void FrameLoader::load(WebDocumentLoader *newDocumentLoader)
 {
-    if (policyDocumentLoader)
-        [self invalidatePendingPolicyDecisionCallingDefaultAction:YES];
-    
-    [self setPolicyDocumentLoader:newDocumentLoader];
+    invalidatePendingPolicyDecision(true);
+    setPolicyDocumentLoader(newDocumentLoader);
 
-    NSMutableURLRequest *r = [policyDocumentLoader request];
-    [self addExtraFieldsToRequest:r mainResource:YES alwaysFromRequest:NO];
+    NSMutableURLRequest *r = [newDocumentLoader request];
+    addExtraFieldsToRequest(r, true, false);
     FrameLoadType type;
-    if ([client _shouldTreatURLAsSameAsCurrent:[[policyDocumentLoader originalRequest] URL]]) {
+    if ([m_client _shouldTreatURLAsSameAsCurrent:[[newDocumentLoader originalRequest] URL]]) {
         [r setCachePolicy:NSURLRequestReloadIgnoringCacheData];
         type = FrameLoadTypeSame;
     } else
         type = FrameLoadTypeStandard;
     
-    [policyDocumentLoader setOverrideEncoding:[[self documentLoader] overrideEncoding]];
+    [newDocumentLoader setOverrideEncoding:[documentLoader() overrideEncoding]];
     
     // When we loading alternate content for an unreachable URL that we're
     // visiting in the b/f list, we treat it as a reload so the b/f list 
     // is appropriately maintained.
-    if ([self shouldReloadToHandleUnreachableURLFromRequest:[policyDocumentLoader originalRequest]]) {
+    if (shouldReloadToHandleUnreachableURL([newDocumentLoader originalRequest])) {
         ASSERT(type == FrameLoadTypeStandard);
         type = FrameLoadTypeReload;
     }
-    
-    [self loadDocumentLoader:policyDocumentLoader withLoadType:type formState:nil];
+
+    load(newDocumentLoader, type, 0);
 }
 
-- (void)_loadRequest:(NSURLRequest *)request triggeringAction:(NSDictionary *)action loadType:(FrameLoadType)type formState:(PassRefPtr<FormState>)formState
+void FrameLoader::load(NSURLRequest *request, NSDictionary *action, FrameLoadType type, PassRefPtr<FormState> formState)
 {
-    ASSERT(!policyDocumentLoader);
-    policyDocumentLoader = [client _createDocumentLoaderWithRequest:request];
+    WebDocumentLoader *loader = [m_client _createDocumentLoaderWithRequest:request];
+    setPolicyDocumentLoader(loader);
+    [loader release];
 
-    [policyDocumentLoader setTriggeringAction:action];
-    [policyDocumentLoader setOverrideEncoding:[[self documentLoader] overrideEncoding]];
+    [loader setTriggeringAction:action];
+    [loader setOverrideEncoding:[m_documentLoader.get() overrideEncoding]];
 
-    [self loadDocumentLoader:policyDocumentLoader withLoadType:type formState:formState];
+    load(loader, type, formState);
 }
 
-- (void)_reloadAllowingStaleDataWithOverrideEncoding:(NSString *)encoding
+void FrameLoader::reloadAllowingStaleData(NSString *encoding)
 {
-    if (documentLoader == nil)
+    if (!m_documentLoader)
         return;
 
-    NSMutableURLRequest *request = [[documentLoader request] mutableCopy];
-    NSURL *unreachableURL = [documentLoader unreachableURL];
-    if (unreachableURL != nil)
+    NSMutableURLRequest *request = [[m_documentLoader.get() request] mutableCopy];
+    NSURL *unreachableURL = [m_documentLoader.get() unreachableURL];
+    if (unreachableURL)
         [request setURL:unreachableURL];
 
     [request setCachePolicy:NSURLRequestReturnCacheDataElseLoad];
-    ASSERT(!policyDocumentLoader);
-    policyDocumentLoader = [client _createDocumentLoaderWithRequest:request];
+
+    WebDocumentLoader *loader = [m_client _createDocumentLoaderWithRequest:request];
+    setPolicyDocumentLoader(loader);
+    [loader release];
+
     [request release];
-    
-    [policyDocumentLoader setOverrideEncoding:encoding];
 
-    [self loadDocumentLoader:policyDocumentLoader withLoadType:FrameLoadTypeReloadAllowingStaleData formState:nil];
+    [loader setOverrideEncoding:encoding];
+
+    load(loader, FrameLoadTypeReloadAllowingStaleData, 0);
 }
 
-- (void)reload
+void FrameLoader::reload()
 {
-    if (documentLoader == nil)
+    if (!m_documentLoader)
         return;
 
-    NSMutableURLRequest *initialRequest = [documentLoader request];
+    NSMutableURLRequest *initialRequest = [m_documentLoader.get() request];
     
     // If a window is created by javascript, its main frame can have an empty but non-nil URL.
     // Reloading in this case will lose the current contents (see 4151001).
-    if ([[[[documentLoader request] URL] absoluteString] length] == 0)
+    if ([[[initialRequest URL] absoluteString] length] == 0)
         return;
 
     // Replace error-page URL with the URL we were trying to reach.
@@ -1091,94 +1011,97 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
     if (unreachableURL != nil)
         initialRequest = [NSURLRequest requestWithURL:unreachableURL];
     
-    ASSERT(!policyDocumentLoader);
-    policyDocumentLoader = [client _createDocumentLoaderWithRequest:initialRequest];
-    NSMutableURLRequest *request = [policyDocumentLoader request];
+    WebDocumentLoader *loader = [m_client _createDocumentLoaderWithRequest:initialRequest];
+    setPolicyDocumentLoader(loader);
+    [loader release];
+
+    NSMutableURLRequest *request = [loader request];
 
     [request setCachePolicy:NSURLRequestReloadIgnoringCacheData];
 
     // If we're about to rePOST, set up action so the app can warn the user
     if (isCaseInsensitiveEqual([request HTTPMethod], @"POST")) {
-        NSDictionary *action = [self actionInformationForNavigationType:NavigationTypeFormResubmitted
-            event:nil originalURL:[request URL]];
-        [policyDocumentLoader setTriggeringAction:action];
+        NSDictionary *action = actionInformation(NavigationTypeFormResubmitted, nil, [request URL]);
+        [loader setTriggeringAction:action];
     }
 
-    [policyDocumentLoader setOverrideEncoding:[documentLoader overrideEncoding]];
+    [loader setOverrideEncoding:[m_documentLoader.get() overrideEncoding]];
     
-    [self loadDocumentLoader:policyDocumentLoader withLoadType:FrameLoadTypeReload formState:nil];
+    load(loader, FrameLoadTypeReload, 0);
 }
 
-- (void)didReceiveServerRedirectForProvisionalLoadForFrame
+void FrameLoader::didReceiveServerRedirectForProvisionalLoadForFrame()
 {
-    [client _dispatchDidReceiveServerRedirectForProvisionalLoadForFrame];
+    [m_client _dispatchDidReceiveServerRedirectForProvisionalLoadForFrame];
 }
 
-- (void)finishedLoadingDocument:(WebDocumentLoader *)loader
+void FrameLoader::finishedLoadingDocument(WebDocumentLoader *loader)
 {
-    [client _finishedLoadingDocument:loader];
+    [m_client _finishedLoadingDocument:loader];
 }
 
-- (void)committedLoadWithDocumentLoader:(WebDocumentLoader *)loader data:(NSData *)data
+void FrameLoader::committedLoad(WebDocumentLoader *loader, NSData *data)
 {
-    [client _committedLoadWithDocumentLoader:loader data:data];
+    [m_client _committedLoadWithDocumentLoader:loader data:data];
 }
 
-- (BOOL)isReplacing
+bool FrameLoader::isReplacing() const
 {
-    return loadType == FrameLoadTypeReplace;
+    return m_loadType == FrameLoadTypeReplace;
 }
 
-- (void)setReplacing
+void FrameLoader::setReplacing()
 {
-    loadType = FrameLoadTypeReplace;
+    m_loadType = FrameLoadTypeReplace;
 }
 
-- (void)revertToProvisionalWithDocumentLoader:(WebDocumentLoader *)loader
+void FrameLoader::revertToProvisional(WebDocumentLoader *loader)
 {
-    [client _revertToProvisionalStateForDocumentLoader:loader];
+    [m_client _revertToProvisionalStateForDocumentLoader:loader];
 }
 
-- (void)documentLoader:(WebDocumentLoader *)loader setMainDocumentError:(NSError *)error
+void FrameLoader::setMainDocumentError(WebDocumentLoader *loader, NSError *error)
 {
-    [client _setMainDocumentError:error forDocumentLoader:loader];
+    [m_client _setMainDocumentError:error forDocumentLoader:loader];
 }
 
-- (void)documentLoader:(WebDocumentLoader *)loader mainReceivedCompleteError:(NSError *)error
+void FrameLoader::mainReceivedCompleteError(WebDocumentLoader *loader, NSError *error)
 {
     [loader setPrimaryLoadComplete:YES];
-    [client _dispatchDidLoadMainResourceForDocumentLoader:[self activeDocumentLoader]];
-    [self checkLoadComplete];
+    [m_client _dispatchDidLoadMainResourceForDocumentLoader:activeDocumentLoader()];
+    checkLoadComplete();
 }
 
-- (void)finalSetupForReplaceWithDocumentLoader:(WebDocumentLoader *)loader
+void FrameLoader::finalSetupForReplace(WebDocumentLoader *loader)
 {
-    [client _clearUnarchivingStateForLoader:loader];
+    [m_client _clearUnarchivingStateForLoader:loader];
 }
 
-- (void)prepareForLoadStart
+void FrameLoader::prepareForLoadStart()
 {
-    [client _progressStarted];
-    [client _dispatchDidStartProvisionalLoadForFrame];
+    [m_client _progressStarted];
+    [m_client _dispatchDidStartProvisionalLoadForFrame];
 }
 
-- (BOOL)subframeIsLoading
+bool FrameLoader::subframeIsLoading() const
 {
     // It's most likely that the last added frame is the last to load so we walk backwards.
-    for (WebCoreFrameBridge *frame = [frameBridge lastChild]; frame; frame = [frame previousSibling])
-        if ([[[frame frameLoader] documentLoader] isLoadingInAPISense] || [[[frame frameLoader] provisionalDocumentLoader] isLoadingInAPISense])
-            return YES;
-    return NO;
+    for (Frame* child = m_frame->tree()->lastChild(); child; child = child->tree()->previousSibling()) {
+        FrameLoader* childLoader = [Mac(child)->bridge() frameLoader];
+        if ([childLoader->documentLoader() isLoadingInAPISense] || [childLoader->provisionalDocumentLoader() isLoadingInAPISense])
+            return true;
+    }
+    return false;
 }
 
-- (void)willChangeTitleForDocument:(WebDocumentLoader *)loader
+void FrameLoader::willChangeTitle(WebDocumentLoader *loader)
 {
-    [client _willChangeTitleForDocument:loader];
+    [m_client _willChangeTitleForDocument:loader];
 }
 
-- (void)didChangeTitleForDocument:(WebDocumentLoader *)loader
+void FrameLoader::didChangeTitle(WebDocumentLoader *loader)
 {
-    [client _didChangeTitleForDocument:loader];
+    [m_client _didChangeTitleForDocument:loader];
 
     // The title doesn't get communicated to the WebView until we are committed.
     if ([loader isCommitted]) {
@@ -1186,360 +1109,331 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
         if (URLForHistory != nil) {
             // Must update the entries in the back-forward list too.
             // This must go through the WebFrame because it has the right notion of the current b/f item.
-            [client _setTitle:[loader title] forURL:URLForHistory];
-            [client _setMainFrameDocumentReady:YES]; // update observers with new DOMDocument
-            [client _dispatchDidReceiveTitle:[loader title]];
+            [m_client _setTitle:[loader title] forURL:URLForHistory];
+            [m_client _setMainFrameDocumentReady:YES]; // update observers with new DOMDocument
+            [m_client _dispatchDidReceiveTitle:[loader title]];
         }
     }
 }
 
-- (FrameLoadType)loadType
-{
-    return loadType;
-}
-
-- (void)setLoadType:(FrameLoadType)type
+FrameLoadType FrameLoader::loadType() const
 {
-    loadType = type;
+    return m_loadType;
 }
 
-- (void)invalidatePendingPolicyDecisionCallingDefaultAction:(BOOL)call
+void FrameLoader::invalidatePendingPolicyDecision(bool callDefaultAction)
 {
-    [policyDecider invalidate];
-    [policyDecider release];
-    policyDecider = nil;
+    [m_policyDecider.get() invalidate];
+    m_policyDecider = nil;
 
-    NSURLRequest *request = policyRequest;
-    NSString *frameName = policyFrameName;
-    id target = policyTarget;
-    SEL selector = policySelector;
-    RefPtr<FormState> formState = adoptRef(policyFormState);
+    bool hadFrameName = m_policyFrameName;
+    RetainPtr<id> target = m_policyTarget;
+    SEL selector = m_policySelector;
 
-    policyRequest = nil;
-    policyFrameName = nil;
-    policyTarget = nil;
-    policySelector = nil;
-    policyFormState = 0;
+    m_policyRequest = nil;
+    m_policyFrameName = nil;
+    m_policyTarget = nil;
+    m_policyFormState = 0;
 
-    if (call) {
-        if (frameName)
-            objc_msgSend(target, selector, nil, nil, nil);
+    if (callDefaultAction) {
+        if (hadFrameName)
+            objc_msgSend(target.get(), selector, nil, nil, nil);
         else
-            objc_msgSend(target, selector, nil, nil);
+            objc_msgSend(target.get(), selector, nil, nil);
     }
-
-    [request release];
-    [frameName release];
-    [target release];
 }
 
-- (void)checkNewWindowPolicyForRequest:(NSURLRequest *)request action:(NSDictionary *)action frameName:(NSString *)frameName formState:(PassRefPtr<FormState>)formState andCall:(id)target withSelector:(SEL)selector
+void FrameLoader::checkNewWindowPolicy(NSURLRequest *request, NSDictionary *action,
+    NSString *frameName, PassRefPtr<FormState> formState)
 {
-    WebPolicyDecider *decider = [client _createPolicyDeciderWithTarget:self action:@selector(continueAfterNewWindowPolicy:)];
+    WebPolicyDecider *decider = [m_client _createPolicyDeciderWithTarget:asDelegate()
+        action:@selector(continueAfterNewWindowPolicy:)];
 
-    policyRequest = [request retain];
-    policyTarget = [target retain];
-    policyFrameName = [frameName retain];
-    policySelector = selector;
-    policyDecider = [decider retain];
-    ASSERT(!policyFormState);
-    policyFormState = formState.release();
+    m_policyRequest = request;
+    m_policyTarget = asDelegate();
+    m_policyFrameName = frameName;
+    m_policySelector = @selector(continueLoadRequestAfterNewWindowPolicy:frameName:formState:);
+    m_policyDecider = decider;
+    m_policyFormState = formState;
+
+    [m_client _dispatchDecidePolicyForNewWindowAction:action request:request
+        newFrameName:frameName decider:decider];
 
-    [client _dispatchDecidePolicyForNewWindowAction:action request:request newFrameName:frameName decider:decider];
-    
     [decider release];
 }
 
-- (void)continueAfterNewWindowPolicy:(WebPolicyAction)policy
+void FrameLoader::continueAfterNewWindowPolicy(WebPolicyAction policy)
 {
-    NSURLRequest *request = [[policyRequest retain] autorelease];
-    NSString *frameName = [[policyFrameName retain] autorelease];
-    id target = [[policyTarget retain] autorelease];
-    SEL selector = policySelector;
-    RefPtr<FormState> formState = policyFormState;
+    RetainPtr<NSURLRequest> request = m_policyRequest;
+    RetainPtr<NSString> frameName = m_policyFrameName;
+    RetainPtr<id> target = m_policyTarget;
+    SEL selector = m_policySelector;
+    RefPtr<FormState> formState = m_policyFormState;
 
-    // will release policy* objects, hence the above retains
-    [self invalidatePendingPolicyDecisionCallingDefaultAction:NO];
+    invalidatePendingPolicyDecision(false);
 
     switch (policy) {
         case WebPolicyIgnore:
             request = nil;
             break;
         case WebPolicyDownload:
-            [client _startDownloadWithRequest:request];
+            [m_client _startDownloadWithRequest:request.get()];
             request = nil;
             break;
         case WebPolicyUse:
             break;
     }
 
-    objc_msgSend(target, selector, request, frameName, formState.get());
+    objc_msgSend(target.get(), selector, request.get(), frameName.get(), formState.get());
 }
 
-- (void)checkNavigationPolicyForRequest:(NSURLRequest *)request
-                         documentLoader:(WebDocumentLoader *)loader
-                              formState:(PassRefPtr<FormState>)formState
-                                andCall:(id)target
-                           withSelector:(SEL)selector
+void FrameLoader::checkNavigationPolicy(NSURLRequest *request, WebDocumentLoader *loader,
+    PassRefPtr<FormState> formState, id target, SEL selector)
 {
     NSDictionary *action = [loader triggeringAction];
     if (action == nil) {
-        action = [self actionInformationForNavigationType:NavigationTypeOther
-            event:nil originalURL:[request URL]];
+        action = actionInformation(NavigationTypeOther, nil, [request URL]);
         [loader setTriggeringAction:action];
     }
         
     // Don't ask more than once for the same request or if we are loading an empty URL.
     // This avoids confusion on the part of the client.
     if ([request isEqual:[loader lastCheckedRequest]] || urlIsEmpty([request URL])) {
-        [target performSelector:selector withObject:request withObject:nil];
+        objc_msgSend(target, selector, request, nil);
         return;
     }
     
     // We are always willing to show alternate content for unreachable URLs;
     // treat it like a reload so it maintains the right state for b/f list.
     if ([request _webDataRequestUnreachableURL] != nil) {
-        if (isBackForwardLoadType(policyLoadType))
-            policyLoadType = FrameLoadTypeReload;
-        [target performSelector:selector withObject:request withObject:nil];
+        if (isBackForwardLoadType(m_policyLoadType))
+            m_policyLoadType = FrameLoadTypeReload;
+        objc_msgSend(target, selector, request, nil);
         return;
     }
     
     [loader setLastCheckedRequest:request];
 
-    WebPolicyDecider *decider = [client _createPolicyDeciderWithTarget:self action:@selector(continueAfterNavigationPolicy:)];
+    WebPolicyDecider *decider = [m_client _createPolicyDeciderWithTarget:asDelegate()
+        action:@selector(continueAfterNavigationPolicy:)];
     
-    ASSERT(policyRequest == nil);
-    policyRequest = [request retain];
-    ASSERT(policyTarget == nil);
-    policyTarget = [target retain];
-    policySelector = selector;
-    ASSERT(policyDecider == nil);
-    policyDecider = [decider retain];
-    ASSERT(!policyFormState);
-    policyFormState = formState.release();
-
-    delegateIsDecidingNavigationPolicy = YES;
-    [client _dispatchDecidePolicyForNavigationAction:action request:request decider:decider];
-    delegateIsDecidingNavigationPolicy = NO;
+    m_policyRequest = request;
+    m_policyTarget = target;
+    m_policySelector = selector;
+    m_policyDecider = decider;
+    m_policyFormState = formState;
+
+    m_delegateIsDecidingNavigationPolicy = true;
+    [m_client _dispatchDecidePolicyForNavigationAction:action request:request decider:decider];
+    m_delegateIsDecidingNavigationPolicy = false;
     
     [decider release];
 }
 
-- (void)continueAfterNavigationPolicy:(WebPolicyAction)policy
+void FrameLoader::continueAfterNavigationPolicy(WebPolicyAction policy)
 {
-    NSURLRequest *request = [[policyRequest retain] autorelease];
-    id target = [[policyTarget retain] autorelease];
-    SEL selector = policySelector;
-    RefPtr<FormState> formState = policyFormState;
+    RetainPtr<NSURLRequest> request = m_policyRequest;
+    RetainPtr<id> target = m_policyTarget;
+    SEL selector = m_policySelector;
+    RefPtr<FormState> formState = m_policyFormState.release();
     
-    // will release policy* objects, hence the above retains
-    [self invalidatePendingPolicyDecisionCallingDefaultAction:NO];
+    invalidatePendingPolicyDecision(false);
 
     switch (policy) {
         case WebPolicyIgnore:
             request = nil;
             break;
         case WebPolicyDownload:
-            [client _startDownloadWithRequest:request];
+            [m_client _startDownloadWithRequest:request.get()];
             request = nil;
             break;
         case WebPolicyUse:
-            if (![client _canHandleRequest:request]) {
-                [self handleUnimplementablePolicyWithError:[client _cannotShowURLErrorWithRequest:request]];
+            if (![m_client _canHandleRequest:request.get()]) {
+                handleUnimplementablePolicy([m_client _cannotShowURLErrorWithRequest:request.get()]);
                 request = nil;
             }
             break;
     }
 
-    objc_msgSend(target, selector, request, formState.get());
+    objc_msgSend(target.get(), selector, request.get(), formState.get());
 }
 
-// Called after the FormsDelegate is done processing willSubmitForm:
-- (void)continueAfterWillSubmitForm:(WebPolicyAction)policy
+void FrameLoader::continueAfterWillSubmitForm(WebPolicyAction policy)
 {
-    if (policyDecider) {
-        [policyDecider invalidate];
-        [policyDecider release];
-        policyDecider = nil;
+    if (m_policyDecider) {
+        [m_policyDecider.get() invalidate];
+        m_policyDecider = nil;
     }
-    [self startLoading];
+    startLoading();
 }
 
-- (void)continueLoadRequestAfterNavigationPolicy:(NSURLRequest *)request formState:(FormState *)formState
+void FrameLoader::continueLoadRequestAfterNavigationPolicy(NSURLRequest *request, FormState* formState)
 {
     // If we loaded an alternate page to replace an unreachableURL, we'll get in here with a
     // nil policyDataSource because loading the alternate page will have passed
     // through this method already, nested; otherwise, policyDataSource should still be set.
-    ASSERT(policyDocumentLoader || [provisionalDocumentLoader unreachableURL] != nil);
+    ASSERT(m_policyDocumentLoader || [m_provisionalDocumentLoader.get() unreachableURL] != nil);
 
-    BOOL isTargetItem = [client _provisionalItemIsTarget];
+    BOOL isTargetItem = [m_client _provisionalItemIsTarget];
 
     // Two reasons we can't continue:
     //    1) Navigation policy delegate said we can't so request is nil. A primary case of this 
     //       is the user responding Cancel to the form repost nag sheet.
     //    2) User responded Cancel to an alert popped up by the before unload event handler.
     // The "before unload" event handler runs only for the main frame.
-    BOOL canContinue = request && (![self isLoadingMainFrame] || [frameBridge shouldClose]);
+    bool canContinue = request && (!isLoadingMainFrame() || [bridge() shouldClose]);
 
     if (!canContinue) {
         // If we were waiting for a quick redirect, but the policy delegate decided to ignore it, then we 
         // need to report that the client redirect was cancelled.
-        if (quickRedirectComing)
-            [self clientRedirectCancelledOrFinished:NO];
+        if (m_quickRedirectComing)
+            clientRedirectCancelledOrFinished(false);
 
-        [self setPolicyDocumentLoader:nil];
+        setPolicyDocumentLoader(nil);
 
         // If the navigation request came from the back/forward menu, and we punt on it, we have the 
         // problem that we have optimistically moved the b/f cursor already, so move it back.  For sanity, 
         // we only do this when punting a navigation for the target frame or top-level frame.  
-        if ((isTargetItem || [self isLoadingMainFrame]) && isBackForwardLoadType(policyLoadType))
-            [client _resetBackForwardList];
+        if ((isTargetItem || isLoadingMainFrame()) && isBackForwardLoadType(m_policyLoadType))
+            [m_client _resetBackForwardList];
 
         return;
     }
-    
-    FrameLoadType type = policyLoadType;
-    WebDocumentLoader *dl = [policyDocumentLoader retain];
-    
-    [self stopLoading];
-    loadType = type;
 
-    [self startProvisionalLoad:dl];
+    FrameLoadType type = m_policyLoadType;
+    stopLoading();
+    setProvisionalDocumentLoader(m_policyDocumentLoader.get());
+    m_loadType = type;
+    setState(WebFrameStateProvisional);
 
-    [dl release];
-    [self setPolicyDocumentLoader:nil];
-    
-    if (isBackForwardLoadType(type) && [client _loadProvisionalItemFromPageCache])
+    setPolicyDocumentLoader(nil);
+
+    if (isBackForwardLoadType(type) && [m_client _loadProvisionalItemFromPageCache])
         return;
 
     if (formState) {
         // It's a bit of a hack to reuse the WebPolicyDecisionListener for the continuation
         // mechanism across the willSubmitForm callout.
-        policyDecider = [client _createPolicyDeciderWithTarget:self action:@selector(continueAfterWillSubmitForm:)];
-        [client _dispatchSourceFrame:Mac(formState->sourceFrame())->bridge()
+        WebPolicyDecider *decider = [m_client _createPolicyDeciderWithTarget:asDelegate() action:@selector(continueAfterWillSubmitForm:)];
+        m_policyDecider = decider;
+        [m_client _dispatchSourceFrame:Mac(formState->sourceFrame())->bridge()
             willSubmitForm:[DOMElement _elementWith:formState->form()]
-            withValues:formState->valuesAsNSDictionary() submissionDecider:policyDecider];
+            withValues:formState->valuesAsNSDictionary() submissionDecider:decider];
+        [decider release];
     } else
-        [self continueAfterWillSubmitForm:WebPolicyUse];
+        continueAfterWillSubmitForm(WebPolicyUse);
 }
 
-- (void)loadDocumentLoader:(WebDocumentLoader *)loader withLoadType:(FrameLoadType)type formState:(PassRefPtr<FormState>)formState
+void FrameLoader::load(WebDocumentLoader *loader, FrameLoadType type, PassRefPtr<FormState> formState)
 {
-    ASSERT([client _hasWebView]);
+    ASSERT([m_client _hasWebView]);
 
     // Unfortunately the view must be non-nil, this is ultimately due
     // to parser requiring a FrameView.  We should fix this dependency.
 
-    ASSERT([client _hasFrameView]);
-
-    policyLoadType = type;
-
-    WebCoreFrameBridge *parentFrame = [[self bridge] parent];
-    if (parentFrame)
-        [loader setOverrideEncoding:[[[parentFrame frameLoader] documentLoader] overrideEncoding]];
+    ASSERT([m_client _hasFrameView]);
 
-    [loader setFrameLoader:self];
+    m_policyLoadType = type;
 
-    [self invalidatePendingPolicyDecisionCallingDefaultAction:YES];
+    if (Frame* parent = m_frame->tree()->parent())
+        [loader setOverrideEncoding:[[Mac(parent)->bridge() frameLoader]->documentLoader() overrideEncoding]];
 
-    [self setPolicyDocumentLoader:loader];
+    invalidatePendingPolicyDecision(true);
+    setPolicyDocumentLoader(loader);
 
-    [self checkNavigationPolicyForRequest:[loader request]
-                           documentLoader:loader
-                                formState:formState
-                                  andCall:self
-                             withSelector:@selector(continueLoadRequestAfterNavigationPolicy:formState:)];
+    checkNavigationPolicy([loader request], loader, formState,
+        asDelegate(), @selector(continueLoadRequestAfterNavigationPolicy:formState:));
 }
 
-- (void)didFirstLayout
+void FrameLoader::didFirstLayout()
 {
-    if (isBackForwardLoadType(loadType) && [client _hasBackForwardList])
-        [client _restoreScrollPositionAndViewState];
+    if (isBackForwardLoadType(m_loadType) && [m_client _hasBackForwardList])
+        [m_client _restoreScrollPositionAndViewState];
 
-    firstLayoutDone = YES;
-    [client _dispatchDidFirstLayoutInFrame];
+    m_firstLayoutDone = true;
+    [m_client _dispatchDidFirstLayoutInFrame];
 }
 
-- (void)frameLoadCompleted
+void FrameLoader::frameLoadCompleted()
 {
-    [client _frameLoadCompleted];
+    [m_client _frameLoadCompleted];
 
-    // After a canceled provisional load, firstLayoutDone is NO. Reset it to YES if we're displaying a page.
-    if (documentLoader)
-        firstLayoutDone = YES;
+    // After a canceled provisional load, firstLayoutDone is false.
+    // Reset it to YES if we're displaying a page.
+    if (m_documentLoader)
+        m_firstLayoutDone = true;
 }
 
-- (BOOL)firstLayoutDone
+bool FrameLoader::firstLayoutDone() const
 {
-    return firstLayoutDone;
+    return m_firstLayoutDone;
 }
 
-- (BOOL)isQuickRedirectComing
+bool FrameLoader::isQuickRedirectComing() const
 {
-    return quickRedirectComing;
+    return m_quickRedirectComing;
 }
 
-- (void)transitionToCommitted:(NSDictionary *)pageCache
+void FrameLoader::transitionToCommitted(NSDictionary *pageCache)
 {
-    ASSERT([client _hasWebView]);
-    ASSERT([self state] == WebFrameStateProvisional);
+    ASSERT([m_client _hasWebView]);
+    ASSERT(m_state == WebFrameStateProvisional);
 
-    if ([self state] != WebFrameStateProvisional)
+    if (m_state != WebFrameStateProvisional)
         return;
 
-    [client _setCopiesOnScroll];
-    [client _updateHistoryForCommit];
+    [m_client _setCopiesOnScroll];
+    [m_client _updateHistoryForCommit];
 
     // The call to closeURL invokes the unload event handler, which can execute arbitrary
     // JavaScript. If the script initiates a new load, we need to abandon the current load,
     // or the two will stomp each other.
-    WebDocumentLoader *pdl = provisionalDocumentLoader;
-    [frameBridge closeURL];
-    if (pdl != provisionalDocumentLoader)
+    WebDocumentLoader *pdl = m_provisionalDocumentLoader.get();
+    [bridge() closeURL];
+    if (pdl != m_provisionalDocumentLoader)
         return;
 
-    [self commitProvisionalLoad];
+    commitProvisionalLoad();
 
     // Handle adding the URL to the back/forward list.
-    WebDocumentLoader *dl = documentLoader;
+    WebDocumentLoader *dl = m_documentLoader.get();
     NSString *ptitle = [dl title];
 
-    switch (loadType) {
+    switch (m_loadType) {
     case FrameLoadTypeForward:
     case FrameLoadTypeBack:
     case FrameLoadTypeIndexedBackForward:
-        if ([client _hasBackForwardList]) {
-            [client _updateHistoryForBackForwardNavigation];
+        if ([m_client _hasBackForwardList]) {
+            [m_client _updateHistoryForBackForwardNavigation];
 
             // Create a document view for this document, or used the cached view.
             if (pageCache)
-                [client _setDocumentViewFromPageCache:pageCache];
+                [m_client _setDocumentViewFromPageCache:pageCache];
             else
-                [client _makeDocumentView];
+                [m_client _makeDocumentView];
         }
         break;
 
     case FrameLoadTypeReload:
     case FrameLoadTypeSame:
     case FrameLoadTypeReplace:
-        [client _updateHistoryForReload];
-        [client _makeDocumentView];
+        [m_client _updateHistoryForReload];
+        [m_client _makeDocumentView];
         break;
 
     // FIXME - just get rid of this case, and merge FrameLoadTypeReloadAllowingStaleData with the above case
     case FrameLoadTypeReloadAllowingStaleData:
-        [client _makeDocumentView];
+        [m_client _makeDocumentView];
         break;
 
     case FrameLoadTypeStandard:
-        [client _updateHistoryForStandardLoad];
-        [client _makeDocumentView];
+        [m_client _updateHistoryForStandardLoad];
+        [m_client _makeDocumentView];
         break;
 
     case FrameLoadTypeInternal:
-        [client _updateHistoryForInternalLoad];
-        [client _makeDocumentView];
+        [m_client _updateHistoryForInternalLoad];
+        [m_client _makeDocumentView];
         break;
 
     // FIXME Remove this check when dummy ds is removed (whatever "dummy ds" is).
@@ -1549,190 +1443,181 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
     }
 
     // Tell the client we've committed this URL.
-    ASSERT([client _hasFrameView]);
-    [client _dispatchDidCommitLoadForFrame];
+    ASSERT([m_client _hasFrameView]);
+    [m_client _dispatchDidCommitLoadForFrame];
     
     // If we have a title let the WebView know about it.
     if (ptitle)
-        [client _dispatchDidReceiveTitle:ptitle];
+        [m_client _dispatchDidReceiveTitle:ptitle];
 }
 
-- (void)checkLoadCompleteForThisFrame
+void FrameLoader::checkLoadCompleteForThisFrame()
 {
-    ASSERT([client _hasWebView]);
+    ASSERT([m_client _hasWebView]);
 
-    switch ([self state]) {
+    switch (m_state) {
         case WebFrameStateProvisional: {
-            if (delegateIsHandlingProvisionalLoadError)
+            if (m_delegateIsHandlingProvisionalLoadError)
                 return;
 
-            WebDocumentLoader *pdl = [provisionalDocumentLoader retain];
+            WebDocumentLoader *pdl = m_provisionalDocumentLoader.get();
 
             // If we've received any errors we may be stuck in the provisional state and actually complete.
             NSError *error = [pdl mainDocumentError];
-            if (error != nil) {
-                // Check all children first.
-                LoadErrorResetToken *resetToken = [client _tokenForLoadErrorReset];
-                BOOL shouldReset = YES;
-                if (![pdl isLoadingInAPISense]) {
-                    delegateIsHandlingProvisionalLoadError = YES;
-                    [client _dispatchDidFailProvisionalLoadWithError:error];
-                    delegateIsHandlingProvisionalLoadError = NO;
-
-                    // FIXME: can stopping loading here possibly have
-                    // any effect, if isLoading is false, which it
-                    // must be, to be in this branch of the if? And is it ok to just do 
-                    // a full-on stopLoading?
-                    [self stopLoadingSubframes];
-                    [pdl stopLoading];
-
-                    // Finish resetting the load state, but only if another load hasn't been started by the
-                    // delegate callback.
-                    if (pdl == provisionalDocumentLoader)
-                        [self clearProvisionalLoad];
-                    else {
-                        NSURL *unreachableURL = [provisionalDocumentLoader unreachableURL];
-                        if (unreachableURL != nil && [unreachableURL isEqual:[[pdl request] URL]])
-                            shouldReset = NO;
-                    }
+            if (!error)
+                return;
+
+            [pdl retain];
+
+            // Check all children first.
+            LoadErrorResetToken *resetToken = [m_client _tokenForLoadErrorReset];
+            bool shouldReset = true;
+            if (![pdl isLoadingInAPISense]) {
+                m_delegateIsHandlingProvisionalLoadError = true;
+                [m_client _dispatchDidFailProvisionalLoadWithError:error];
+                m_delegateIsHandlingProvisionalLoadError = false;
+
+                // FIXME: can stopping loading here possibly have any effect, if isLoading is false,
+                // which it must be to be in this branch of the if? And is it OK to just do a full-on
+                // stopLoading instead of stopLoadingSubframes?
+                stopLoadingSubframes();
+                [pdl stopLoading];
+
+                // Finish resetting the load state, but only if another load hasn't been started by the
+                // delegate callback.
+                if (pdl == m_provisionalDocumentLoader)
+                    clearProvisionalLoad();
+                else {
+                    NSURL *unreachableURL = [m_provisionalDocumentLoader.get() unreachableURL];
+                    if (unreachableURL != nil && [unreachableURL isEqual:[[pdl request] URL]])
+                        shouldReset = false;
                 }
-                if (shouldReset)
-                    [client _resetAfterLoadError:resetToken];
-                else
-                    [client _doNotResetAfterLoadError:resetToken];
             }
+            if (shouldReset)
+                [m_client _resetAfterLoadError:resetToken];
+            else
+                [m_client _doNotResetAfterLoadError:resetToken];
             [pdl release];
             return;
         }
         
         case WebFrameStateCommittedPage: {
-            WebDocumentLoader *dl = documentLoader;
-            
-            if (![dl isLoadingInAPISense]) {
-                [self markLoadComplete];
-
-                // FIXME: Is this subsequent work important if we already navigated away?
-                // Maybe there are bugs because of that, or extra work we can skip because
-                // the new page is ready.
-
-                [client _forceLayoutForNonHTML];
-                 
-                // If the user had a scroll point, scroll to it, overriding the anchor point if any.
-                if ((isBackForwardLoadType([self loadType]) || [self loadType] == FrameLoadTypeReload)
-                        && [client _hasBackForwardList])
-                    [client _restoreScrollPositionAndViewState];
-
-                NSError *error = [dl mainDocumentError];
-                if (error != nil)
-                    [client _dispatchDidFailLoadWithError:error];
-                else
-                    [client _dispatchDidFinishLoadForFrame];
-                
-                [client _progressCompleted];
+            WebDocumentLoader *dl = m_documentLoader.get();            
+            if ([dl isLoadingInAPISense])
                 return;
-            }
+
+            markLoadComplete();
+
+            // FIXME: Is this subsequent work important if we already navigated away?
+            // Maybe there are bugs because of that, or extra work we can skip because
+            // the new page is ready.
+
+            [m_client _forceLayoutForNonHTML];
+             
+            // If the user had a scroll point, scroll to it, overriding the anchor point if any.
+            if ((isBackForwardLoadType(m_loadType) || m_loadType == FrameLoadTypeReload)
+                    && [m_client _hasBackForwardList])
+                [m_client _restoreScrollPositionAndViewState];
+
+            NSError *error = [dl mainDocumentError];
+            if (error)
+                [m_client _dispatchDidFailLoadWithError:error];
+            else
+                [m_client _dispatchDidFinishLoadForFrame];
+
+            [m_client _progressCompleted];
             return;
         }
         
         case WebFrameStateComplete:
             // Even if already complete, we might have set a previous item on a frame that
             // didn't do any data loading on the past transaction. Make sure to clear these out.
-            [client _frameLoadCompleted];
+            [m_client _frameLoadCompleted];
             return;
     }
 
     ASSERT_NOT_REACHED();
 }
 
-- (void)continueLoadRequestAfterNewWindowPolicy:(NSURLRequest *)request frameName:(NSString *)frameName formState:(FormState *)formState
+void FrameLoader::continueLoadRequestAfterNewWindowPolicy(NSURLRequest *request, NSString *frameName, FormState* formState)
 {
     if (!request)
         return;
 
-    WebCoreFrameBridge <WebCoreFrameBridge> *bridge = frameBridge;
-    [bridge retain];
+    RefPtr<Frame> frame = m_frame;
 
-    WebCoreFrameBridge *mainBridge = [client _dispatchCreateWebViewWithRequest:nil];
+    WebCoreFrameBridge *mainBridge = [m_client _dispatchCreateWebViewWithRequest:nil];
     if (!mainBridge)
-        goto exit;
+        return;
 
     [mainBridge retain];
 
     [mainBridge setName:frameName];
-
-    [[[mainBridge frameLoader] client] _dispatchShow];
-
-    [mainBridge setOpener:bridge];
-    [[mainBridge frameLoader] _loadRequest:request triggeringAction:nil loadType:FrameLoadTypeStandard formState:formState];
+    [[mainBridge frameLoader]->client() _dispatchShow];
+    [mainBridge impl]->setOpener(frame.get());
+    [mainBridge frameLoader]->load(request, nil, FrameLoadTypeStandard, formState);
 
     [mainBridge release];
-
-exit:
-    [bridge release];
 }
 
-- (void)sendRemainingDelegateMessagesWithIdentifier:(id)identifier response:(NSURLResponse *)response length:(unsigned)length error:(NSError *)error 
+void FrameLoader::sendRemainingDelegateMessages(id identifier, NSURLResponse *response, unsigned length, NSError *error)
 {    
-    if (response != nil)
-        [client _dispatchResource:identifier didReceiveResponse:response fromDocumentLoader:documentLoader];
+    if (response)
+        [m_client _dispatchResource:identifier didReceiveResponse:response fromDocumentLoader:m_documentLoader.get()];
     
     if (length > 0)
-        [client _dispatchResource:identifier didReceiveContentLength:length fromDocumentLoader:documentLoader];
+        [m_client _dispatchResource:identifier didReceiveContentLength:length fromDocumentLoader:m_documentLoader.get()];
     
-    if (error == nil)
-        [client _dispatchResource:identifier didFinishLoadingFromDocumentLoader:documentLoader];
+    if (!error)
+        [m_client _dispatchResource:identifier didFinishLoadingFromDocumentLoader:m_documentLoader.get()];
     else
-        [client _dispatchResource:identifier didFailLoadingWithError:error fromDocumentLoader:documentLoader];
+        [m_client _dispatchResource:identifier didFailLoadingWithError:error fromDocumentLoader:m_documentLoader.get()];
 }
 
-- (NSURLRequest *)requestFromDelegateForRequest:(NSURLRequest *)request identifier:(id *)identifier error:(NSError **)error
+NSURLRequest *FrameLoader::requestFromDelegate(NSURLRequest *request, id& identifier, NSError *& error)
 {
     ASSERT(request != nil);
-    
-    *identifier = [client _dispatchIdentifierForInitialRequest:request fromDocumentLoader:documentLoader]; 
-    NSURLRequest *newRequest = [client _dispatchResource:*identifier willSendRequest:request redirectResponse:nil fromDocumentLoader:documentLoader];
-    
+
+    identifier = [m_client _dispatchIdentifierForInitialRequest:request fromDocumentLoader:m_documentLoader.get()]; 
+    NSURLRequest *newRequest = [m_client _dispatchResource:identifier
+        willSendRequest:request redirectResponse:nil fromDocumentLoader:m_documentLoader.get()];
+
     if (newRequest == nil)
-        *error = [client _cancelledErrorWithRequest:request];
+        error = [m_client _cancelledErrorWithRequest:request];
     else
-        *error = nil;
-    
+        error = nil;
+
     return newRequest;
 }
 
-- (void)loadRequest:(NSURLRequest *)request
+void FrameLoader::load(NSURLRequest *request)
 {
-    // FIXME: is this the right place to reset loadType? Perhaps this should be done
-    // after loading is finished or aborted.
-    [self setLoadType:FrameLoadTypeStandard];
-    WebDocumentLoader *dl = [client _createDocumentLoaderWithRequest:request];
-    [self loadDocumentLoader:dl];
+    // FIXME: is this the right place to reset loadType? Perhaps this should be done after loading is finished or aborted.
+    m_loadType = FrameLoadTypeStandard;
+    WebDocumentLoader *dl = [m_client _createDocumentLoaderWithRequest:request];
+    load(dl);
     [dl release];
 }
 
-- (void)loadRequest:(NSURLRequest *)request inFrameNamed:(NSString *)frameName
+void FrameLoader::load(NSURLRequest *request, NSString *frameName)
 {
-    if (frameName == nil) {
-        [self loadRequest:request];
+    if (!frameName) {
+        load(request);
         return;
     }
 
-    WebCoreFrameBridge *frame = [frameBridge findFrameNamed:frameName];
-    if (frame != nil) {
-        [[frame frameLoader] loadRequest:request];
+    Frame* frame = m_frame->tree()->find(frameName);
+    if (frame) {
+        [Mac(frame)->bridge() frameLoader]->load(request);
         return;
     }
 
-    NSDictionary *action = [self actionInformationForNavigationType:NavigationTypeOther
-        event:nil originalURL:[request URL]];
-    [self checkNewWindowPolicyForRequest:request action:action frameName:frameName formState:nil
-        andCall:self withSelector:@selector(continueLoadRequestAfterNewWindowPolicy:frameName:formState:)];
+    NSDictionary *action = actionInformation(NavigationTypeOther, nil, [request URL]);
+    checkNewWindowPolicy(request, action, frameName, 0);
 }
 
-- (void)postWithURL:(NSURL *)URL referrer:(NSString *)referrer target:(NSString *)target
-    data:(NSArray *)postData contentType:(NSString *)contentType
-    triggeringEvent:(NSEvent *)event form:(DOMElement *)form formValues:(NSDictionary *)values
+void FrameLoader::post(NSURL *URL, NSString *referrer, NSString *target, NSArray *postData,
+    NSString *contentType, NSEvent *event, DOMElement *form, NSDictionary *formValues)
 {
     // When posting, use the NSURLRequestReloadIgnoringCacheData load flag.
     // This prevents a potential bug which may cause a page with a form that uses itself
@@ -1741,157 +1626,212 @@ exit:
     // FIXME: Where's the code that implements what the comment above says?
 
     NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:URL];
-    [self addExtraFieldsToRequest:request mainResource:YES alwaysFromRequest:YES];
+    addExtraFieldsToRequest(request, true, true);
 
     setHTTPReferrer(request, referrer);
     [request setHTTPMethod:@"POST"];
     webSetHTTPBody(request, postData);
     [request setValue:contentType forHTTPHeaderField:@"Content-Type"];
 
-    NSDictionary *action = [self actionInformationForLoadType:FrameLoadTypeStandard isFormSubmission:YES event:event originalURL:URL];
+    NSDictionary *action = actionInformation(FrameLoadTypeStandard, true, event, URL);
     RefPtr<FormState> formState;
-    if (form && values)
-        formState = FormState::create(form, values, frameBridge);
+    if (form && formValues)
+        formState = FormState::create(form, formValues, bridge());
 
     if (target != nil) {
-        WebCoreFrameBridge *targetFrame = [frameBridge findFrameNamed:target];
-        if (targetFrame != nil)
-            [[targetFrame frameLoader] _loadRequest:request triggeringAction:action loadType:FrameLoadTypeStandard formState:formState.release()];
+        Frame* targetFrame = m_frame->tree()->find(target);
+        if (targetFrame)
+            [Mac(targetFrame)->bridge() frameLoader]->load(request, action, FrameLoadTypeStandard, formState.release());
         else
-            [self checkNewWindowPolicyForRequest:request action:action frameName:target formState:formState.release()
-                andCall:self withSelector:@selector(continueLoadRequestAfterNewWindowPolicy:frameName:formState:)];
+            checkNewWindowPolicy(request, action, target, formState.release());
     } else
-        [self _loadRequest:request triggeringAction:action loadType:FrameLoadTypeStandard formState:formState.release()];
+        load(request, action, FrameLoadTypeStandard, formState.release());
 
     [request release];
 }
 
-- (void)detachChildren
+void FrameLoader::detachChildren()
 {
-    // FIXME: is it really necessary to do this in reverse order any more?
-    WebCoreFrameBridge *child = [frameBridge lastChild];
-    WebCoreFrameBridge *prev = [child previousSibling];
-    for (; child; child = prev, prev = [child previousSibling])
-        [[child frameLoader] detachFromParent];
+    // FIXME: Is it really necessary to do this in reverse order?
+    Frame* previous;
+    for (Frame* child = m_frame->tree()->lastChild(); child; child = previous) {
+        previous = child->tree()->previousSibling();
+        [Mac(child)->bridge() frameLoader]->detachFromParent();
+    }
 }
 
-- (void)detachFromParent
+void FrameLoader::detachFromParent()
 {
-    WebCoreFrameBridge *bridge = [frameBridge retain];
+    WebCoreFrameBridge *bridge = [FrameLoader::bridge() retain];
+    id <WebFrameLoaderClient> client = [m_client retain];
 
     [bridge closeURL];
-    [self stopLoading];
+    stopLoading();
     [client _detachedFromParent1];
-    [self detachChildren];
+    detachChildren();
     [client _detachedFromParent2];
-    [self setDocumentLoader:nil];
+    setDocumentLoader(nil);
     [client _detachedFromParent3];
-    [[frameBridge parent] removeChild:bridge];
-
-    id<WebFrameLoaderClient> c = [client retain];
+    if (Frame* parent = m_frame->tree()->parent())
+        parent->tree()->removeChild(m_frame);
     [bridge close];
-    [c _detachedFromParent4];
-    [c release];
+    [client _detachedFromParent4];
 
+    [client release];
     [bridge release];
 }
 
-- (void)addExtraFieldsToRequest:(NSMutableURLRequest *)request mainResource:(BOOL)mainResource alwaysFromRequest:(BOOL)f
+void FrameLoader::addExtraFieldsToRequest(NSMutableURLRequest *request, bool mainResource, bool alwaysFromRequest)
 {
-    [request setValue:[frameBridge userAgentForURL:[request URL]] forHTTPHeaderField:@"User-Agent"];
+    [request setValue:[bridge() userAgentForURL:[request URL]] forHTTPHeaderField:@"User-Agent"];
     
-    if ([self loadType] == FrameLoadTypeReload)
+    if (m_loadType == FrameLoadTypeReload)
         [request setValue:@"max-age=0" forHTTPHeaderField:@"Cache-Control"];
     
     // Don't set the cookie policy URL if it's already been set.
     if ([request mainDocumentURL] == nil) {
-        if (mainResource && ([self isLoadingMainFrame] || f))
+        if (mainResource && (isLoadingMainFrame() || alwaysFromRequest))
             [request setMainDocumentURL:[request URL]];
         else
-            [request setMainDocumentURL:[client _mainFrameURL]];
+            [request setMainDocumentURL:[m_client _mainFrameURL]];
     }
     
     if (mainResource)
         [request setValue:@"text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5" forHTTPHeaderField:@"Accept"];
 }
 
-- (void)safeLoadURL:(NSURL *)URL
+void FrameLoader::safeLoad(NSURL *URL)
 {
-   // Call the bridge because this is where our security checks are made.
-    [frameBridge loadURL:URL 
-                  referrer:urlOriginalDataAsString([[documentLoader request] URL])
-                    reload:NO
-               userGesture:YES       
-                    target:nil
-           triggeringEvent:[NSApp currentEvent]
-                      form:nil 
-                formValues:nil];
+    [bridge() loadURL:URL 
+             referrer:urlOriginalDataAsString([[m_documentLoader.get() request] URL])
+               reload:NO
+          userGesture:YES       
+               target:nil
+      triggeringEvent:[NSApp currentEvent]
+                 form:nil 
+           formValues:nil];
 }
 
-- (NSDictionary *)actionInformationForLoadType:(FrameLoadType)type isFormSubmission:(BOOL)isFormSubmission event:(NSEvent *)event originalURL:(NSURL *)URL
+NSDictionary *FrameLoader::actionInformation(FrameLoadType type, bool isFormSubmission, NSEvent *event, NSURL *originalURL)
 {
     NavigationType navType;
-    if (isFormSubmission) {
+    if (isFormSubmission)
         navType = NavigationTypeFormSubmitted;
-    } else if (event == nil) {
-        if (type == FrameLoadTypeReload)
-            navType = NavigationTypeReload;
-        else if (isBackForwardLoadType(type))
-            navType = NavigationTypeBackForward;
-        else
-            navType = NavigationTypeOther;
-    } else {
+    else if (event)
         navType = NavigationTypeLinkClicked;
-    }
-    return [self actionInformationForNavigationType:navType event:event originalURL:URL];
+    else if (type == FrameLoadTypeReload)
+        navType = NavigationTypeReload;
+    else if (isBackForwardLoadType(type))
+        navType = NavigationTypeBackForward;
+    else
+        navType = NavigationTypeOther;
+    return actionInformation(navType, event, originalURL);
 }
  
-NSString *ActionNavigationTypeKey = @"WebActionNavigationTypeKey";
-NSString *ActionElementKey = @"WebActionElementKey";
-NSString *ActionButtonKey = @"WebActionButtonKey"; 
-NSString *ActionModifierFlagsKey = @"WebActionModifierFlagsKey";
-NSString *ActionOriginalURLKey = @"WebActionOriginalURLKey";
-
-- (NSDictionary *)actionInformationForNavigationType:(NavigationType)navigationType event:(NSEvent *)event originalURL:(NSURL *)URL
-{
-    NSDictionary *elementInfo = [client _elementForEvent:event];
+NSDictionary *FrameLoader::actionInformation(NavigationType navigationType, NSEvent *event, NSURL *originalURL)
+{
+    NSString *ActionNavigationTypeKey = @"WebActionNavigationTypeKey";
+    NSString *ActionElementKey = @"WebActionElementKey";
+    NSString *ActionButtonKey = @"WebActionButtonKey"; 
+    NSString *ActionModifierFlagsKey = @"WebActionModifierFlagsKey";
+    NSString *ActionOriginalURLKey = @"WebActionOriginalURLKey";
+    NSDictionary *elementInfo = [m_client _elementForEvent:event];
     if (elementInfo)
         return [NSDictionary dictionaryWithObjectsAndKeys:
             [NSNumber numberWithInt:navigationType], ActionNavigationTypeKey,
             elementInfo, ActionElementKey,
             [NSNumber numberWithInt:[event buttonNumber]], ActionButtonKey,
             [NSNumber numberWithInt:[event modifierFlags]], ActionModifierFlagsKey,
-            URL, ActionOriginalURLKey,
+            originalURL, ActionOriginalURLKey,
             nil];
     return [NSDictionary dictionaryWithObjectsAndKeys:
         [NSNumber numberWithInt:navigationType], ActionNavigationTypeKey,
         [NSNumber numberWithInt:[event modifierFlags]], ActionModifierFlagsKey,
-        URL, ActionOriginalURLKey,
+        originalURL, ActionOriginalURLKey,
         nil];
 }
 
 // Called every time a resource is completely loaded, or an error is received.
-- (void)checkLoadComplete
+void FrameLoader::checkLoadComplete()
+{
+    ASSERT([m_client _hasWebView]);
+
+    for (RefPtr<Frame> frame = m_frame; frame; frame = frame->tree()->parent())
+        [Mac(frame.get())->bridge() frameLoader]->checkLoadCompleteForThisFrame();
+}
+
+void FrameLoader::setFrameLoaderClient(id <WebFrameLoaderClient> client)
 {
-    ASSERT([client _hasWebView]);
+    m_client = client;
+}
+
+id <WebFrameLoaderClient> FrameLoader::client() const
+{
+    return m_client;
+}
 
-    WebCoreFrameBridge *parent;
-    for (WebCoreFrameBridge *frame = frameBridge; frame; frame = parent) {
-        [frame retain];
-        [[frame frameLoader] checkLoadCompleteForThisFrame];
-        parent = [frame parent];
-        [frame release];
+WebCoreFrameLoaderAsDelegate *FrameLoader::asDelegate()
+{
+    if (!m_asDelegate) {
+        WebCoreFrameLoaderAsDelegate *d = [[WebCoreFrameLoaderAsDelegate alloc] initWithLoader:this];
+        m_asDelegate = d;
+        [d release];
     }
+    return m_asDelegate.get();
+}
+
 }
 
-- (void)setFrameLoaderClient:(id<WebFrameLoaderClient>)cli
+@implementation WebCoreFrameLoaderAsDelegate
+
+- (id)initWithLoader:(FrameLoader*)loader
+{
+    self = [self init];
+    if (!self)
+        return nil;
+    m_loader = loader;
+    return self;
+}
+
+- (void)detachFromLoader
+{
+    m_loader = 0;
+}
+
+- (void)continueFragmentScrollAfterNavigationPolicy:(NSURLRequest *)request formState:(FormState*)formState
+{
+    if (m_loader)
+        m_loader->continueFragmentScrollAfterNavigationPolicy(request);
+}
+
+- (void)continueAfterNewWindowPolicy:(WebPolicyAction)policy
 {
-    client = cli;
+    if (m_loader)
+        m_loader->continueAfterNewWindowPolicy(policy);
 }
 
-- (id<WebFrameLoaderClient>)client
+- (void)continueAfterNavigationPolicy:(WebPolicyAction)policy
+{
+    if (m_loader)
+        m_loader->continueAfterNavigationPolicy(policy);
+}
+
+- (void)continueAfterWillSubmitForm:(WebPolicyAction)policy
+{
+    if (m_loader)
+        m_loader->continueAfterWillSubmitForm(policy);
+}
+
+- (void)continueLoadRequestAfterNavigationPolicy:(NSURLRequest *)request formState:(FormState*)formState
+{
+    if (m_loader)
+        m_loader->continueLoadRequestAfterNavigationPolicy(request, formState);
+}
+
+- (void)continueLoadRequestAfterNewWindowPolicy:(NSURLRequest *)request frameName:(NSString *)frameName formState:(FormState *)formState
 {
-    return client;
+    if (m_loader)
+        m_loader->continueLoadRequestAfterNewWindowPolicy(request, frameName, formState);
 }
 
 @end
index 3b732f5de98e7df82d8907c9c75a9af518f5ec4b..a5bd9544f6d056586e956eea0a217849eca2bdfd 100644 (file)
 
 #include "RetainPtr.h"
 #include "Shared.h"
+#include <wtf/RefPtr.h>
 
 @class NSError;
 @class NSURLAuthenticationChallenge;
 @class NSURLConnection;
 @class NSURLRequest;
 @class NSURLResponse;
-@class WebFrameLoader;
-@class WebCoreResourceLoaderDelegate;
+@class WebCoreResourceLoaderAsDelegate;
 
 namespace WebCore {
 
+    class Frame;
+    class FrameLoader;
+
     // FIXME: Rename to ResourceLoader after resolving conflict with existing class of that name.
     class WebResourceLoader : public Shared<WebResourceLoader> {
     public:
@@ -46,19 +49,16 @@ namespace WebCore {
 
         virtual bool load(NSURLRequest *);
 
-        virtual void signalFinish();
-
-        void setFrameLoader(WebFrameLoader *);
-        WebFrameLoader *frameLoader() const;
+        FrameLoader *frameLoader() const;
 
-        virtual void cancel();
-        virtual void cancel(NSError *);
+        virtual void cancel(NSError * = nil);
         NSError *cancelledError();
 
         virtual void setDefersCallbacks(bool);
         bool defersCallbacks() const;
 
         void setIdentifier(id);
+        id identifier() const { return m_identifier.get(); }
 
         virtual void releaseResources();
         NSURLResponse *response() const;
@@ -85,26 +85,27 @@ namespace WebCore {
         static bool inConnectionCallback();
 
     protected:
-        WebResourceLoader(WebFrameLoader *);
-        WebCoreResourceLoaderDelegate *delegate();
+        WebResourceLoader(Frame*);
+        WebCoreResourceLoaderAsDelegate *delegate();
         virtual void releaseDelegate();
 
+        virtual void didCancel(NSError *);
+        void didFinishLoadingOnePart();
+
         NSURLConnection *connection() const { return m_connection.get(); }
         NSURLRequest *request() const { return m_request.get(); }
         bool reachedTerminalState() const { return m_reachedTerminalState; }
-        bool signalledFinish() const { return m_signalledFinish; }
         bool cancelled() const { return m_cancelled; }
-        id identifier() const { return m_identifier.get(); }
 
         RetainPtr<NSURLConnection> m_connection;
 
     private:
         RetainPtr<NSURLRequest> m_request;
         bool m_reachedTerminalState;
-        bool m_signalledFinish;
         bool m_cancelled;
+        bool m_calledDidFinishLoad;
 
-        RetainPtr<WebFrameLoader> m_frameLoader;
+        RefPtr<Frame> m_frame;
         RetainPtr<id> m_identifier;
         RetainPtr<NSURLResponse> m_response;
         NSURLAuthenticationChallenge *m_currentConnectionChallenge;
@@ -112,7 +113,7 @@ namespace WebCore {
         bool m_defersCallbacks;
         RetainPtr<NSURL> m_originalURL;
         RetainPtr<NSMutableData> m_resourceData;
-        RetainPtr<WebCoreResourceLoaderDelegate> m_delegate;
+        RetainPtr<WebCoreResourceLoaderAsDelegate> m_delegate;
     };
 
 }
index eb9ab20bc611daeab2bde9b2429da9163495e045..735de323a27200963918dddd61dc7165afb04673 100644 (file)
@@ -29,6 +29,8 @@
 #import "config.h"
 #import "WebLoader.h"
 
+#import "FrameMac.h"
+#import "WebCoreFrameBridge.h"
 #import "WebCoreSystemInterface.h"
 #import "WebDataProtocol.h"
 #import "WebFrameLoader.h"
@@ -41,7 +43,7 @@
 
 using namespace WebCore;
 
-@interface WebCoreResourceLoaderDelegate : NSObject <NSURLAuthenticationChallengeSender>
+@interface WebCoreResourceLoaderAsDelegate : NSObject <NSURLAuthenticationChallengeSender>
 {
     WebResourceLoader* m_loader;
 }
@@ -66,13 +68,13 @@ static bool NSURLConnectionSupportsBufferedData;
 static bool isInitializingConnection;
 #endif
 
-WebResourceLoader::WebResourceLoader(WebFrameLoader *frameLoader)
+WebResourceLoader::WebResourceLoader(Frame* frame)
     : m_reachedTerminalState(false)
-    , m_signalledFinish(false)
     , m_cancelled(false)
-    , m_frameLoader(frameLoader)
+    , m_calledDidFinishLoad(false)
+    , m_frame(frame)
     , m_currentConnectionChallenge(nil)
-    , m_defersCallbacks([frameLoader defersCallbacks])
+    , m_defersCallbacks(frameLoader()->defersCallbacks())
 {
     static bool initialized = false;
     if (!initialized) {
@@ -97,13 +99,14 @@ void WebResourceLoader::releaseResources()
     // has been deallocated and also to avoid reentering this method.
     RefPtr<WebResourceLoader> protector(this);
 
+    m_frame = 0;
+
     // We need to set reachedTerminalState to true before we release
     // the resources to prevent a double dealloc of WebView <rdar://problem/4372628>
     m_reachedTerminalState = true;
 
     m_identifier = nil;
     m_connection = nil;
-    m_frameLoader = nil;
     m_resourceData = nil;
 
     releaseDelegate();
@@ -112,18 +115,18 @@ void WebResourceLoader::releaseResources()
 bool WebResourceLoader::load(NSURLRequest *r)
 {
     ASSERT(m_connection == nil);
-    ASSERT(![m_frameLoader.get() archiveLoadPendingForLoader:this]);
+    ASSERT(!frameLoader()->isArchiveLoadPending(this));
     
     m_originalURL = [r URL];
     
     NSURLRequest *clientRequest = willSendRequest(r, nil);
     if (clientRequest == nil) {
-        didFail([m_frameLoader.get() cancelledErrorWithRequest:r]);
+        didFail(frameLoader()->cancelledError(r));
         return false;
     }
     r = clientRequest;
     
-    if ([m_frameLoader.get() willUseArchiveForRequest:r originalURL:m_originalURL.get() loader:this])
+    if (frameLoader()->willUseArchive(this, r, m_originalURL.get()))
         return true;
     
 #ifndef NDEBUG
@@ -152,16 +155,11 @@ bool WebResourceLoader::defersCallbacks() const
     return m_defersCallbacks;
 }
 
-void WebResourceLoader::setFrameLoader(WebFrameLoader *fl)
-{
-    ASSERT(fl);
-    m_frameLoader = fl;
-    setDefersCallbacks([fl defersCallbacks]);
-}
-
-WebFrameLoader *WebResourceLoader::frameLoader() const
+FrameLoader* WebResourceLoader::frameLoader() const
 {
-    return m_frameLoader.get();
+    if (!m_frame)
+        return 0;
+    return [Mac(m_frame.get())->bridge() frameLoader];
 }
 
 void WebResourceLoader::addData(NSData *data, bool allAtOnce)
@@ -224,14 +222,10 @@ NSURLRequest *WebResourceLoader::willSendRequest(NSURLRequest *newRequest, NSURL
     else
         haveDataSchemeRequest = true;
     
-    if (!m_identifier) {
-        id identifier = [m_frameLoader.get() _identifierForInitialRequest:clientRequest];
-        m_identifier = identifier;
-        [identifier release];
-    }
+    if (!m_identifier)
+        m_identifier = frameLoader()->identifierForInitialRequest(clientRequest);
 
-    NSURLRequest *updatedRequest = [m_frameLoader.get() _willSendRequest:clientRequest
-        forResource:m_identifier.get() redirectResponse:redirectResponse];
+    NSURLRequest *updatedRequest = frameLoader()->willSendRequest(this, clientRequest, redirectResponse);
 
     if (!haveDataSchemeRequest)
         newRequest = updatedRequest;
@@ -278,7 +272,7 @@ void WebResourceLoader::didReceiveAuthenticationChallenge(NSURLAuthenticationCha
     NSURLAuthenticationChallenge *webChallenge = [[NSURLAuthenticationChallenge alloc] initWithAuthenticationChallenge:challenge sender:delegate()];
     m_currentWebChallenge = webChallenge;
 
-    [m_frameLoader.get() _didReceiveAuthenticationChallenge:webChallenge forResource:m_identifier.get()];
+    frameLoader()->didReceiveAuthenticationChallenge(this, webChallenge);
 
     [webChallenge release];
 }
@@ -294,8 +288,7 @@ void WebResourceLoader::didCancelAuthenticationChallenge(NSURLAuthenticationChal
     // anything including possibly derefing this; one example of this is Radar 3266216.
     RefPtr<WebResourceLoader> protector(this);
 
-    [m_frameLoader.get() _didCancelAuthenticationChallenge:m_currentWebChallenge.get()
-        forResource:m_identifier.get()];
+    frameLoader()->didCancelAuthenticationChallenge(this, m_currentWebChallenge.get());
 }
 
 void WebResourceLoader::didReceiveResponse(NSURLResponse *r)
@@ -314,7 +307,7 @@ void WebResourceLoader::didReceiveResponse(NSURLResponse *r)
 
     m_response = r;
 
-    [m_frameLoader.get() _didReceiveResponse:r forResource:m_identifier.get()];
+    frameLoader()->didReceiveResponse(this, r);
 }
 
 void WebResourceLoader::didReceiveData(NSData *data, long long lengthReceived, bool allAtOnce)
@@ -328,10 +321,10 @@ void WebResourceLoader::didReceiveData(NSData *data, long long lengthReceived, b
     // Protect this in this delegate method since the additional processing can do
     // anything including possibly derefing this; one example of this is Radar 3266216.
     RefPtr<WebResourceLoader> protector(this);
-    
+
     addData(data, allAtOnce);
-    
-    [m_frameLoader.get() _didReceiveData:data contentLength:(int)lengthReceived forResource:m_identifier.get()];
+    if (m_frame)
+        frameLoader()->didReceiveData(this, data, lengthReceived);
 }
 
 void WebResourceLoader::willStopBufferingData(NSData *data)
@@ -342,39 +335,41 @@ void WebResourceLoader::willStopBufferingData(NSData *data)
     [copy release];
 }
 
-void WebResourceLoader::signalFinish()
-{
-    m_signalledFinish = true;
-    [m_frameLoader.get() _didFinishLoadingForResource:m_identifier.get()];
-}
-
 void WebResourceLoader::didFinishLoading()
 {
     // If load has been cancelled after finishing (which could happen with a 
-    // javascript that changes the window location), do nothing.
+    // JavaScript that changes the window location), do nothing.
     if (m_cancelled)
         return;
-    
     ASSERT(!m_reachedTerminalState);
 
-    if (!m_signalledFinish)
-        signalFinish();
-
+    didFinishLoadingOnePart();
     releaseResources();
 }
 
+void WebResourceLoader::didFinishLoadingOnePart()
+{
+    if (m_cancelled)
+        return;
+    ASSERT(!m_reachedTerminalState);
+
+    if (m_calledDidFinishLoad)
+        return;
+    m_calledDidFinishLoad = true;
+    frameLoader()->didFinishLoad(this);
+}
+
 void WebResourceLoader::didFail(NSError *error)
 {
     if (m_cancelled)
         return;
-    
     ASSERT(!m_reachedTerminalState);
 
     // Protect this in this delegate method since the additional processing can do
     // anything including possibly derefing this; one example of this is Radar 3266216.
     RefPtr<WebResourceLoader> protector(this);
 
-    [m_frameLoader.get() _didFailLoadingWithError:error forResource:m_identifier.get()];
+    frameLoader()->didFailToLoad(this, error);
 
     releaseResources();
 }
@@ -382,17 +377,17 @@ void WebResourceLoader::didFail(NSError *error)
 NSCachedURLResponse *WebResourceLoader::willCacheResponse(NSCachedURLResponse *cachedResponse)
 {
     // When in private browsing mode, prevent caching to disk
-    if ([cachedResponse storagePolicy] == NSURLCacheStorageAllowed && [m_frameLoader.get() _privateBrowsingEnabled]) {
+    if ([cachedResponse storagePolicy] == NSURLCacheStorageAllowed && frameLoader()->privateBrowsingEnabled())
         cachedResponse = [[[NSCachedURLResponse alloc] initWithResponse:[cachedResponse response]
                                                                    data:[cachedResponse data]
                                                                userInfo:[cachedResponse userInfo]
                                                           storagePolicy:NSURLCacheStorageAllowedInMemoryOnly] autorelease];
-    }
     return cachedResponse;
 }
 
-void WebResourceLoader::cancel(NSError *error)
+void WebResourceLoader::didCancel(NSError *error)
 {
+    ASSERT(!m_cancelled);
     ASSERT(!m_reachedTerminalState);
 
     // This flag prevents bad behavior when loads that finish cause the
@@ -405,18 +400,22 @@ void WebResourceLoader::cancel(NSError *error)
     m_currentConnectionChallenge = nil;
     m_currentWebChallenge = nil;
 
-    [m_frameLoader.get() cancelPendingArchiveLoadForLoader:this];
+    frameLoader()->cancelPendingArchiveLoad(this);
     [m_connection.get() cancel];
 
-    [m_frameLoader.get() _didFailLoadingWithError:error forResource:m_identifier.get()];
+    frameLoader()->didFailToLoad(this, error);
 
     releaseResources();
 }
 
-void WebResourceLoader::cancel()
+void WebResourceLoader::cancel(NSError *error)
 {
-    if (!m_reachedTerminalState)
-        cancel(cancelledError());
+    if (m_reachedTerminalState)
+        return;
+    if (error)
+        didCancel(error);
+    else
+        didCancel(cancelledError());
 }
 
 void WebResourceLoader::setIdentifier(id identifier)
@@ -436,7 +435,7 @@ bool WebResourceLoader::inConnectionCallback()
 
 NSError *WebResourceLoader::cancelledError()
 {
-    return [m_frameLoader.get() cancelledErrorWithRequest:m_request.get()];
+    return frameLoader()->cancelledError(m_request.get());
 }
 
 void WebResourceLoader::receivedCredential(NSURLAuthenticationChallenge *challenge, NSURLCredential *credential)
@@ -471,10 +470,10 @@ void WebResourceLoader::receivedCancellation(NSURLAuthenticationChallenge *chall
     cancel();
 }
 
-WebCoreResourceLoaderDelegate *WebResourceLoader::delegate()
+WebCoreResourceLoaderAsDelegate *WebResourceLoader::delegate()
 {
     if (!m_delegate) {
-        WebCoreResourceLoaderDelegate *d = [[WebCoreResourceLoaderDelegate alloc] initWithLoader:this];
+        WebCoreResourceLoaderAsDelegate *d = [[WebCoreResourceLoaderAsDelegate alloc] initWithLoader:this];
         m_delegate = d;
         [d release];
     }
@@ -491,7 +490,7 @@ void WebResourceLoader::releaseDelegate()
 
 }
 
-@implementation WebCoreResourceLoaderDelegate
+@implementation WebCoreResourceLoaderAsDelegate
 
 - (id)initWithLoader:(WebResourceLoader*)loader
 {
index 029d907fe781fcbd4a630691bd0bfdff9b7b9e13..aabf0a859387ab0e0a1506cf0c3228a422d38c53 100644 (file)
 #import "WebLoader.h"
 #import <wtf/Forward.h>
 
-@class WebCoreMainResourceLoaderPolicyDelegate;
+@class WebCoreMainResourceLoaderAsPolicyDelegate;
 
 namespace WebCore {
 
     class MainResourceLoader : public WebResourceLoader {
     public:
-        static PassRefPtr<MainResourceLoader> create(WebFrameLoader *);
+        static PassRefPtr<MainResourceLoader> create(Frame*);
 
         virtual ~MainResourceLoader();
 
         virtual bool load(NSURLRequest *);
 
-        using WebResourceLoader::cancel;
-        virtual void cancel(NSError *);
-
         virtual void setDefersCallbacks(bool);
 
         virtual void addData(NSData *, bool allAtOnce);
@@ -59,11 +56,13 @@ namespace WebCore {
         void continueAfterContentPolicy(WebPolicyAction);
 
     private:
-        MainResourceLoader(WebFrameLoader *);
+        virtual void didCancel(NSError *);
+
+        MainResourceLoader(Frame*);
 
         virtual void releaseDelegate();
 
-        WebCoreMainResourceLoaderPolicyDelegate *policyDelegate();
+        WebCoreMainResourceLoaderAsPolicyDelegate *policyDelegate();
         void releasePolicyDelegate();
 
         NSURLRequest *loadNow(NSURLRequest *);
@@ -80,7 +79,7 @@ namespace WebCore {
         RetainPtr<NSURLResponse> m_response;
         RetainPtr<id> m_proxy;
         RetainPtr<NSURLRequest> m_initialRequest;
-        RetainPtr<WebCoreMainResourceLoaderPolicyDelegate> m_policyDelegate;
+        RetainPtr<WebCoreMainResourceLoaderAsPolicyDelegate> m_policyDelegate;
         bool m_loadingMultipartContent;
     };
 
index 00a7fc00302d9588ccf0339853902f03f4e66d75..ba3cd89ec6733ab68ce8cd84c32627cc6ab5d155 100644 (file)
 #import <Foundation/NSURLResponse.h>
 #import <wtf/Assertions.h>
 #import <wtf/PassRefPtr.h>
+#import <wtf/Vector.h>
 
 // FIXME: More that is in common with SubresourceLoader should move up into WebResourceLoader.
 
 using namespace WebCore;
 
-@interface WebCoreMainResourceLoaderPolicyDelegate : NSObject
+@interface WebCoreMainResourceLoaderAsPolicyDelegate : NSObject
 {
     MainResourceLoader* m_loader;
 }
@@ -55,8 +56,8 @@ namespace WebCore {
 
 const size_t URLBufferLength = 2048;
 
-MainResourceLoader::MainResourceLoader(WebFrameLoader *fl)
-    : WebResourceLoader(fl)
+MainResourceLoader::MainResourceLoader(Frame* frame)
+    : WebResourceLoader(frame)
     , m_contentLength(0)
     , m_bytesReceived(0)
     , m_proxy(wkCreateNSURLConnectionDelegateProxy())
@@ -77,49 +78,42 @@ void MainResourceLoader::releaseDelegate()
     WebResourceLoader::releaseDelegate();
 }
 
-PassRefPtr<MainResourceLoader> MainResourceLoader::create(WebFrameLoader *fl)
+PassRefPtr<MainResourceLoader> MainResourceLoader::create(Frame* frame)
 {
-    return new MainResourceLoader(fl);
+    return new MainResourceLoader(frame);
 }
 
 void MainResourceLoader::receivedError(NSError *error)
 {
-    // Calling _receivedMainResourceError will likely result in the last reference to this object to go away.
+    // Calling receivedMainResourceError will likely result in the last reference to this object to go away.
     RefPtr<MainResourceLoader> protect(this);
 
-    WebFrameLoader *fl = [frameLoader() retain]; // WebResourceLoader::didFailWithError will release the frameLoader
-
     if (!cancelled()) {
         ASSERT(!reachedTerminalState());
-        [fl _didFailLoadingWithError:error forResource:identifier()];
+        frameLoader()->didFailToLoad(this, error);
     }
 
-    [fl _receivedMainResourceError:error complete:YES];
+    frameLoader()->receivedMainResourceError(error, true);
 
     if (!cancelled())
         releaseResources();
 
     ASSERT(reachedTerminalState());
-
-    [fl release];
 }
 
-void MainResourceLoader::cancel(NSError *error)
+void MainResourceLoader::didCancel(NSError *error)
 {
-    // Calling _receivedMainResourceError will likely result in the last reference to this class to go away.
+    // Calling receivedMainResourceError will likely result in the last reference to this object to go away.
     RefPtr<MainResourceLoader> protect(this);
 
-    [frameLoader() cancelContentPolicy];
-    [frameLoader() retain];
-    [frameLoader() _receivedMainResourceError:error complete:YES];
-    [frameLoader() release];
-
-    WebResourceLoader::cancel(error);
+    frameLoader()->cancelContentPolicyCheck();
+    frameLoader()->receivedMainResourceError(error, true);
+    WebResourceLoader::didCancel(error);
 }
 
 NSError *MainResourceLoader::interruptionForPolicyChangeError() const
 {
-    return [frameLoader() interruptForPolicyChangeErrorWithRequest:request()];
+    return frameLoader()->interruptionForPolicyChangeError(request());
 }
 
 void MainResourceLoader::stopLoadingForPolicyChange()
@@ -141,7 +135,7 @@ bool MainResourceLoader::isPostOrRedirectAfterPost(NSURLRequest *newRequest, NSU
     if (redirectResponse && [redirectResponse isKindOfClass:[NSHTTPURLResponse class]]) {
         int status = [(NSHTTPURLResponse *)redirectResponse statusCode];
         if (((status >= 301 && status <= 303) || status == 307)
-                && [[[frameLoader() initialRequest] HTTPMethod] isEqualToString:@"POST"])
+                && [[frameLoader()->initialRequest() HTTPMethod] isEqualToString:@"POST"])
             return true;
     }
     
@@ -151,7 +145,7 @@ bool MainResourceLoader::isPostOrRedirectAfterPost(NSURLRequest *newRequest, NSU
 void MainResourceLoader::addData(NSData *data, bool allAtOnce)
 {
     WebResourceLoader::addData(data, allAtOnce);
-    [frameLoader() _receivedData:data];
+    frameLoader()->receivedData(data);
 }
 
 NSURLRequest *MainResourceLoader::willSendRequest(NSURLRequest *newRequest, NSURLResponse *redirectResponse)
@@ -171,7 +165,7 @@ NSURLRequest *MainResourceLoader::willSendRequest(NSURLRequest *newRequest, NSUR
     NSMutableURLRequest *mutableRequest = nil;
     // Update cookie policy base URL as URL changes, except for subframes, which use the
     // URL of the main frame which doesn't change when we redirect.
-    if ([frameLoader() isLoadingMainFrame]) {
+    if (frameLoader()->isLoadingMainFrame()) {
         mutableRequest = [newRequest mutableCopy];
         [mutableRequest setMainDocumentURL:URL];
     }
@@ -194,10 +188,9 @@ NSURLRequest *MainResourceLoader::willSendRequest(NSURLRequest *newRequest, NSUR
     newRequest = [[WebResourceLoader::willSendRequest(newRequest, redirectResponse) retain] autorelease];
 
     // Don't set this on the first request. It is set when the main load was started.
-    [frameLoader() _setRequest:newRequest];
+    frameLoader()->setRequest(newRequest);
 
-    [frameLoader() _checkNavigationPolicyForRequest:newRequest
-        andCall:policyDelegate() withSelector:@selector(continueAfterNavigationPolicy:formState:)];
+    frameLoader()->checkNavigationPolicy(newRequest, policyDelegate(), @selector(continueAfterNavigationPolicy:formState:));
 
     return newRequest;
 }
@@ -231,8 +224,8 @@ void MainResourceLoader::continueAfterContentPolicy(WebPolicyAction contentPolic
         // Prevent remote web archives from loading because they can claim to be from any domain and thus avoid cross-domain security checks (4120255).
         bool isRemote = ![URL isFileURL] && ![WebDataProtocol _webIsDataProtocolURL:URL];
         bool isRemoteWebArchive = isRemote && isCaseInsensitiveEqual(@"application/x-webarchive", MIMEType);
-        if (![frameLoader() _canShowMIMEType:MIMEType] || isRemoteWebArchive) {
-            [frameLoader() cannotShowMIMETypeWithResponse:r];
+        if (!frameLoader()->canShowMIMEType(MIMEType) || isRemoteWebArchive) {
+            frameLoader()->cannotShowMIMEType(r);
             // Check reachedTerminalState since the load may have already been cancelled inside of _handleUnimplementablePolicyWithErrorCode::.
             if (!reachedTerminalState())
                 stopLoadingForPolicyChange();
@@ -240,9 +233,10 @@ void MainResourceLoader::continueAfterContentPolicy(WebPolicyAction contentPolic
         }
         break;
     }
+
     case WebPolicyDownload:
         [m_proxy.get() setDelegate:nil];
-        [frameLoader() _downloadWithLoadingConnection:connection() request:request() response:r proxy:m_proxy.get()];
+        frameLoader()->download(connection(), request(), r, m_proxy.get());
         m_proxy = nil;
         receivedError(interruptionForPolicyChangeError());
         return;
@@ -260,9 +254,9 @@ void MainResourceLoader::continueAfterContentPolicy(WebPolicyAction contentPolic
     if ([r isKindOfClass:[NSHTTPURLResponse class]]) {
         int status = [(NSHTTPURLResponse *)r statusCode];
         if (status < 200 || status >= 300) {
-            bool hostedByObject = [frameLoader() isHostedByObjectElement];
+            bool hostedByObject = frameLoader()->isHostedByObjectElement();
 
-            [frameLoader() _handleFallbackContent];
+            frameLoader()->handleFallbackContent();
             // object elements are no longer rendered after we fallback, so don't
             // keep trying to process data from their load
 
@@ -275,14 +269,14 @@ void MainResourceLoader::continueAfterContentPolicy(WebPolicyAction contentPolic
     if (!reachedTerminalState())
         WebResourceLoader::didReceiveResponse(r);
 
-    if (![frameLoader() _isStopping] && (shouldLoadAsEmptyDocument(URL) || [frameLoader() _representationExistsForURLScheme:[URL scheme]]))
+    if (frameLoader() && !frameLoader()->isStopping() && (shouldLoadAsEmptyDocument(URL) || frameLoader()->representationExistsForURLScheme([URL scheme])))
         didFinishLoading();
 }
 
 void MainResourceLoader::continueAfterContentPolicy(WebPolicyAction policy)
 {
-    bool isStopping = [frameLoader() _isStopping];
-    [frameLoader() cancelContentPolicy];
+    bool isStopping = frameLoader()->isStopping();
+    frameLoader()->cancelContentPolicyCheck();
     if (!isStopping)
         continueAfterContentPolicy(policy, m_response.get());
 }
@@ -290,10 +284,10 @@ void MainResourceLoader::continueAfterContentPolicy(WebPolicyAction policy)
 void MainResourceLoader::didReceiveResponse(NSURLResponse *r)
 {
     ASSERT(shouldLoadAsEmptyDocument([r URL]) || !defersCallbacks());
-    ASSERT(shouldLoadAsEmptyDocument([r URL]) || ![frameLoader() defersCallbacks]);
+    ASSERT(shouldLoadAsEmptyDocument([r URL]) || !frameLoader()->defersCallbacks());
 
     if (m_loadingMultipartContent) {
-        [frameLoader() _setupForReplaceByMIMEType:[r MIMEType]];
+        frameLoader()->setupForReplaceByMIMEType([r MIMEType]);
         clearResourceData();
     }
     
@@ -304,12 +298,11 @@ void MainResourceLoader::didReceiveResponse(NSURLResponse *r)
     // reference to this object; one example of this is 3266216.
     RefPtr<MainResourceLoader> protect(this);
 
-    [frameLoader() _setResponse:r];
+    frameLoader()->setResponse(r);
     m_contentLength = (int)[r expectedContentLength];
 
     m_response = r;
-    [frameLoader() _checkContentPolicyForMIMEType:[m_response.get() MIMEType]
-        andCall:policyDelegate() withSelector:@selector(continueAfterContentPolicy:)];
+    frameLoader()->checkContentPolicy([m_response.get() MIMEType], policyDelegate(), @selector(continueAfterContentPolicy:));
 }
 
 void MainResourceLoader::didReceiveData(NSData *data, long long lengthReceived, bool allAtOnce)
@@ -317,7 +310,7 @@ void MainResourceLoader::didReceiveData(NSData *data, long long lengthReceived,
     ASSERT(data);
     ASSERT([data length] != 0);
     ASSERT(!defersCallbacks());
-    ASSERT(![frameLoader() defersCallbacks]);
+    ASSERT(!frameLoader()->defersCallbacks());
  
     // The additional processing can do anything including possibly removing the last
     // reference to this object; one example of this is 3266216.
@@ -329,21 +322,21 @@ void MainResourceLoader::didReceiveData(NSData *data, long long lengthReceived,
 
 void MainResourceLoader::didFinishLoading()
 {
-    ASSERT(shouldLoadAsEmptyDocument([frameLoader() _URL]) || !defersCallbacks());
-    ASSERT(shouldLoadAsEmptyDocument([frameLoader() _URL]) || ![frameLoader() defersCallbacks]);
+    ASSERT(shouldLoadAsEmptyDocument(frameLoader()->URL()) || !defersCallbacks());
+    ASSERT(shouldLoadAsEmptyDocument(frameLoader()->URL()) || !frameLoader()->defersCallbacks());
 
     // The additional processing can do anything including possibly removing the last
     // reference to this object.
     RefPtr<MainResourceLoader> protect(this);
 
-    [frameLoader() _finishedLoading];
+    frameLoader()->finishedLoading();
     WebResourceLoader::didFinishLoading();
 }
 
 void MainResourceLoader::didFail(NSError *error)
 {
     ASSERT(!defersCallbacks());
-    ASSERT(![frameLoader() defersCallbacks]);
+    ASSERT(!frameLoader()->defersCallbacks());
 
     receivedError(error);
 }
@@ -354,7 +347,7 @@ NSURLRequest *MainResourceLoader::loadNow(NSURLRequest *r)
 
     ASSERT(!connection());
     ASSERT(shouldLoadEmptyBeforeRedirect || !defersCallbacks());
-    ASSERT(shouldLoadEmptyBeforeRedirect || ![frameLoader() defersCallbacks]);
+    ASSERT(shouldLoadEmptyBeforeRedirect || !frameLoader()->defersCallbacks());
 
     // Send this synthetic delegate callback since clients expect it, and
     // we no longer send the callback from within NSURLConnection for
@@ -366,12 +359,12 @@ NSURLRequest *MainResourceLoader::loadNow(NSURLRequest *r)
     if (shouldLoadEmptyBeforeRedirect && !shouldLoadEmpty && defersCallbacks())
         return r;
 
-    if (shouldLoadEmpty || [frameLoader() _representationExistsForURLScheme:[URL scheme]]) {
+    if (shouldLoadEmpty || frameLoader()->representationExistsForURLScheme([URL scheme])) {
         NSString *MIMEType;
         if (shouldLoadEmpty)
             MIMEType = @"text/html";
         else
-            MIMEType = [frameLoader() _generatedMIMETypeForURLScheme:[URL scheme]];
+            MIMEType = frameLoader()->generatedMIMETypeForURLScheme([URL scheme]);
 
         NSURLResponse *resp = [[NSURLResponse alloc] initWithURL:URL MIMEType:MIMEType
             expectedContentLength:0 textEncodingName:nil];
@@ -425,10 +418,10 @@ void MainResourceLoader::setDefersCallbacks(bool defers)
     }
 }
 
-WebCoreMainResourceLoaderPolicyDelegate *MainResourceLoader::policyDelegate()
+WebCoreMainResourceLoaderAsPolicyDelegate *MainResourceLoader::policyDelegate()
 {
     if (!m_policyDelegate) {
-        WebCoreMainResourceLoaderPolicyDelegate *d = [[WebCoreMainResourceLoaderPolicyDelegate alloc] initWithLoader:this];
+        WebCoreMainResourceLoaderAsPolicyDelegate *d = [[WebCoreMainResourceLoaderAsPolicyDelegate alloc] initWithLoader:this];
         m_policyDelegate = d;
         [d release];
     }
@@ -445,7 +438,7 @@ void MainResourceLoader::releasePolicyDelegate()
 
 }
 
-@implementation WebCoreMainResourceLoaderPolicyDelegate
+@implementation WebCoreMainResourceLoaderAsPolicyDelegate
 
 - (id)initWithLoader:(MainResourceLoader*)loader
 {
index f5b79cb370603917e2b342bbbe48cb0bd887c865..b31655857318663982cf634983e00dd8f89bbbcc 100644 (file)
@@ -34,7 +34,7 @@ namespace WebCore {
 
     class NetscapePlugInStreamLoader : public WebResourceLoader {
     public:
-        static PassRefPtr<NetscapePlugInStreamLoader> create(WebFrameLoader*, id <WebPlugInStreamLoaderDelegate>);
+        static PassRefPtr<NetscapePlugInStreamLoader> create(Frame*, id <WebPlugInStreamLoaderDelegate>);
         virtual ~NetscapePlugInStreamLoader();
 
         bool isDone() const;
@@ -43,12 +43,13 @@ namespace WebCore {
         virtual void didReceiveData(NSData *, long long lengthReceived, bool allAtOnce);
         virtual void didFinishLoading();
         virtual void didFail(NSError *);
-        virtual void cancel(NSError *);
 
         virtual void releaseResources();
 
     private:
-        NetscapePlugInStreamLoader(WebFrameLoader*, id <WebPlugInStreamLoaderDelegate>);
+        NetscapePlugInStreamLoader(Frame*, id <WebPlugInStreamLoaderDelegate>);
+
+        virtual void didCancel(NSError *);
 
         RetainPtr<id <WebPlugInStreamLoaderDelegate> > m_stream;
     };
index bc8163f04a60a88d72d64c61bee4c522ac41daf1..63e977c868e11a8c227e49f77f42f5dba8be50ca 100644 (file)
@@ -34,8 +34,8 @@
 
 namespace WebCore {
 
-NetscapePlugInStreamLoader::NetscapePlugInStreamLoader(WebFrameLoader *fl, id <WebPlugInStreamLoaderDelegate> stream)
-    : WebResourceLoader(fl)
+NetscapePlugInStreamLoader::NetscapePlugInStreamLoader(Frame* frame, id <WebPlugInStreamLoaderDelegate> stream)
+    : WebResourceLoader(frame)
     , m_stream(stream)
 {
 }
@@ -44,9 +44,9 @@ NetscapePlugInStreamLoader::~NetscapePlugInStreamLoader()
 {
 }
 
-PassRefPtr<NetscapePlugInStreamLoader> NetscapePlugInStreamLoader::create(WebFrameLoader* fl, id <WebPlugInStreamLoaderDelegate> d)
+PassRefPtr<NetscapePlugInStreamLoader> NetscapePlugInStreamLoader::create(Frame* frame, id <WebPlugInStreamLoaderDelegate> d)
 {
-    return new NetscapePlugInStreamLoader(fl, d);
+    return new NetscapePlugInStreamLoader(frame, d);
 }
 
 bool NetscapePlugInStreamLoader::isDone() const
@@ -77,7 +77,7 @@ void NetscapePlugInStreamLoader::didReceiveResponse(NSURLResponse *theResponse)
         return;
     if ([theResponse isKindOfClass:[NSHTTPURLResponse class]] &&
         ([(NSHTTPURLResponse *)theResponse statusCode] >= 400 || [(NSHTTPURLResponse *)theResponse statusCode] < 100)) {
-        NSError *error = [frameLoader() fileDoesNotExistErrorWithResponse:theResponse];
+        NSError *error = frameLoader()->fileDoesNotExistError(theResponse);
         [m_stream.get() cancelLoadAndDestroyStreamWithError:error];
     }
 }
@@ -98,8 +98,7 @@ void NetscapePlugInStreamLoader::didFinishLoading()
     // Calling removePlugInStreamLoader will likely result in a call to deref, so we must protect.
     RefPtr<NetscapePlugInStreamLoader> protect(this);
 
-    [frameLoader() removePlugInStreamLoader:this];
-    [frameLoader() _finishedLoadingResource];
+    frameLoader()->removePlugInStreamLoader(this);
     [m_stream.get() finishedLoadingWithData:resourceData()];
     WebResourceLoader::didFinishLoading();
 }
@@ -109,21 +108,21 @@ void NetscapePlugInStreamLoader::didFail(NSError *error)
     // Protect self in this delegate method since the additional processing can do
     // anything including possibly getting rid of the last reference to this object.
     // One example of this is Radar 3266216.
+    RefPtr<NetscapePlugInStreamLoader> protect(this);
 
-    [frameLoader() removePlugInStreamLoader:this];
-    [frameLoader() _receivedError:error];
+    frameLoader()->removePlugInStreamLoader(this);
     [m_stream.get() destroyStreamWithError:error];
     WebResourceLoader::didFail(error);
 }
 
-void NetscapePlugInStreamLoader::cancel(NSError *error)
+void NetscapePlugInStreamLoader::didCancel(NSError *error)
 {
     // Calling removePlugInStreamLoader will likely result in a call to deref, so we must protect.
     RefPtr<NetscapePlugInStreamLoader> protect(this);
 
-    [frameLoader() removePlugInStreamLoader:this];
+    frameLoader()->removePlugInStreamLoader(this);
     [m_stream.get() destroyStreamWithError:error];
-    WebResourceLoader::cancel(error);
+    WebResourceLoader::didCancel(error);
 }
 
 }
index 812b6e267232dd1b425a72ccded54c87a5401950..b65b2db2d46a5b54335050167b082044df5c8eed 100644 (file)
@@ -33,16 +33,13 @@ namespace WebCore {
 
     class SubresourceLoader : public WebResourceLoader {
     public:
-        static id <WebCoreResourceHandle> create(WebFrameLoader *, id <WebCoreResourceLoader>,
+        static id <WebCoreResourceHandle> create(Frame*, id <WebCoreResourceLoader>,
             NSString *method, NSURL *URL, NSDictionary *customHeaders, NSString *referrer);
-        static id <WebCoreResourceHandle> create(WebFrameLoader *, id <WebCoreResourceLoader>,
+        static id <WebCoreResourceHandle> create(Frame*, id <WebCoreResourceLoader>,
             NSString *method, NSURL *URL, NSDictionary *customHeaders, NSArray *postData, NSString *referrer);
 
         virtual ~SubresourceLoader();
 
-        virtual void signalFinish();
-        virtual void cancel();
-
         virtual NSURLRequest *willSendRequest(NSURLRequest *, NSURLResponse *redirectResponse);
         virtual void didReceiveResponse(NSURLResponse *);
         virtual void didReceiveData(NSData *, long long lengthReceived, bool allAtOnce);
@@ -50,13 +47,13 @@ namespace WebCore {
         virtual void didFail(NSError *);
 
     private:
-        static id <WebCoreResourceHandle> create(WebFrameLoader *, id <WebCoreResourceLoader>,
+        static id <WebCoreResourceHandle> create(Frame*, id <WebCoreResourceLoader>,
             NSMutableURLRequest *, NSString *method, NSDictionary *customHeaders, NSString *referrer);
 
-        SubresourceLoader(WebFrameLoader *, id <WebCoreResourceLoader>);
+        SubresourceLoader(Frame*, id <WebCoreResourceLoader>);
         id <WebCoreResourceHandle> handle();
 
-        void receivedError(NSError *error);
+        virtual void didCancel(NSError *);
 
         RetainPtr<id <WebCoreResourceLoader> > m_coreLoader;
         bool m_loadingMultipartContent;
index f30f42f4a564e69e18b2bba1f41185739e613e4d..dfba261082e43ee18e0cc26c7d29cbde9c26c547 100644 (file)
@@ -31,6 +31,8 @@
 
 #import "LoaderNSURLExtras.h"
 #import "LoaderNSURLRequestExtras.h"
+#import "FrameMac.h"
+#import "WebCoreFrameBridge.h"
 #import "WebCoreResourceLoader.h"
 #import "WebCoreSystemInterface.h"
 #import "WebFormDataStream.h"
@@ -49,22 +51,23 @@ using namespace WebCore;
 
 namespace WebCore {
 
-SubresourceLoader::SubresourceLoader(WebFrameLoader *fl, id <WebCoreResourceLoader> l)
-    : WebResourceLoader(fl)
+SubresourceLoader::SubresourceLoader(Frame* frame, id <WebCoreResourceLoader> l)
+    : WebResourceLoader(frame)
     , m_coreLoader(l)
     , m_loadingMultipartContent(false)
 {
-    [fl addSubresourceLoader:this];
+    frameLoader()->addSubresourceLoader(this);
 }
 
 SubresourceLoader::~SubresourceLoader()
 {
 }
 
-id <WebCoreResourceHandle> SubresourceLoader::create(WebFrameLoader *fl, id <WebCoreResourceLoader> rLoader,
+id <WebCoreResourceHandle> SubresourceLoader::create(Frame* frame, id <WebCoreResourceLoader> rLoader,
     NSMutableURLRequest *newRequest, NSString *method, NSDictionary *customHeaders, NSString *referrer)
 {
-    if ([fl state] == WebFrameStateProvisional)
+    FrameLoader* fl = [Mac(frame)->bridge() frameLoader];
+    if (fl->state() == WebFrameStateProvisional)
         return nil;
 
     // setHTTPMethod is not called for GET requests to work around <rdar://4464032>.
@@ -87,41 +90,36 @@ id <WebCoreResourceHandle> SubresourceLoader::create(WebFrameLoader *fl, id <Web
     if (isConditionalRequest(newRequest))
         [newRequest setCachePolicy:NSURLRequestReloadIgnoringCacheData];
     else
-        [newRequest setCachePolicy:[[fl _originalRequest] cachePolicy]];
+        [newRequest setCachePolicy:[fl->originalRequest() cachePolicy]];
     setHTTPReferrer(newRequest, referrer);
     
-    [fl addExtraFieldsToRequest:newRequest mainResource:NO alwaysFromRequest:NO];
+    fl->addExtraFieldsToRequest(newRequest, false, false);
 
-    RefPtr<SubresourceLoader> loader(new SubresourceLoader(fl, rLoader));
+    RefPtr<SubresourceLoader> loader(new SubresourceLoader(frame, rLoader));
     if (!loader->load(newRequest))
         return nil;
     return loader->handle();
 }
 
-id <WebCoreResourceHandle> SubresourceLoader::create(WebFrameLoader *fl, id <WebCoreResourceLoader> rLoader,
+id <WebCoreResourceHandle> SubresourceLoader::create(Frame* frame, id <WebCoreResourceLoader> rLoader,
     NSString *method, NSURL *URL, NSDictionary *customHeaders, NSString *referrer)
 {
     NSMutableURLRequest *newRequest = [[NSMutableURLRequest alloc] initWithURL:URL];
-    id <WebCoreResourceHandle> handle = create(fl, rLoader, newRequest, method, customHeaders, referrer);
+    id <WebCoreResourceHandle> handle = create(frame, rLoader, newRequest, method, customHeaders, referrer);
     [newRequest release];
     return handle;
 }
 
-id <WebCoreResourceHandle> SubresourceLoader::create(WebFrameLoader *fl, id <WebCoreResourceLoader> rLoader,
+id <WebCoreResourceHandle> SubresourceLoader::create(Frame* frame, id <WebCoreResourceLoader> rLoader,
     NSString *method, NSURL *URL, NSDictionary *customHeaders, NSArray *postData, NSString *referrer)
 {
     NSMutableURLRequest *newRequest = [[NSMutableURLRequest alloc] initWithURL:URL];
     webSetHTTPBody(newRequest, postData);
-    id <WebCoreResourceHandle> handle = create(fl, rLoader, newRequest, method, customHeaders, referrer);
+    id <WebCoreResourceHandle> handle = create(frame, rLoader, newRequest, method, customHeaders, referrer);
     [newRequest release];
     return handle;
 }
 
-void SubresourceLoader::receivedError(NSError *error)
-{
-    [frameLoader() _receivedError:error];
-}
-
 NSURLRequest *SubresourceLoader::willSendRequest(NSURLRequest *newRequest, NSURLResponse *redirectResponse)
 {
     NSURL *oldURL = [request() URL];
@@ -149,15 +147,14 @@ void SubresourceLoader::didReceiveResponse(NSURLResponse *r)
     WebResourceLoader::didReceiveResponse(r);
     
     if (m_loadingMultipartContent && [resourceData() length]) {
-        // A subresource loader does not load multipart sections progressively, deliver the previously received data to the coreLoader all at once
+        // Since a subresource loader does not load multipart sections progressively,
+        // deliver the previously received data to the coreLoader all at once now.
+        // Then clear the data to make way for the next multipart section.
         [m_coreLoader.get() addData:resourceData()];
-
-        // Clears the data to make way for the next multipart section
         clearResourceData();
         
         // After the first multipart section is complete, signal to delegates that this load is "finished" 
-        if (!signalledFinish())
-            signalFinish();
+        didFinishLoadingOnePart();
     }
 }
 
@@ -167,52 +164,57 @@ void SubresourceLoader::didReceiveData(NSData *data, long long lengthReceived, b
     // anything including removing the last reference to this object; one example of this is 3266216.
     RefPtr<SubresourceLoader> protect(this);
 
-    // A subresource loader does not load multipart sections progressively, don't deliver any data to the coreLoader yet
+    // A subresource loader does not load multipart sections progressively.
+    // So don't deliver any data to the coreLoader yet.
     if (!m_loadingMultipartContent)
         [m_coreLoader.get() addData:data];
     WebResourceLoader::didReceiveData(data, lengthReceived, allAtOnce);
 }
 
-void SubresourceLoader::signalFinish()
-{
-    [frameLoader() removeSubresourceLoader:this];
-    [frameLoader() _finishedLoadingResource];
-    WebResourceLoader::signalFinish();
-}
-
 void SubresourceLoader::didFinishLoading()
 {
+    if (cancelled())
+        return;
+    ASSERT(!reachedTerminalState());
+
     // Calling removeSubresourceLoader will likely result in a call to deref, so we must protect ourselves.
     RefPtr<SubresourceLoader> protect(this);
-    
+
     [m_coreLoader.get() finishWithData:resourceData()];
-    
-    if (!signalledFinish())
-        signalFinish();
-        
+    if (cancelled())
+        return;
+    frameLoader()->removeSubresourceLoader(this);
     WebResourceLoader::didFinishLoading();
 }
 
 void SubresourceLoader::didFail(NSError *error)
 {
+    if (cancelled())
+        return;
+    ASSERT(!reachedTerminalState());
+
     // Calling removeSubresourceLoader will likely result in a call to deref, so we must protect ourselves.
     RefPtr<SubresourceLoader> protect(this);
-    
+
     [m_coreLoader.get() reportError];
-    [frameLoader() removeSubresourceLoader:this];
-    receivedError(error);
+    if (cancelled())
+        return;
+    frameLoader()->removeSubresourceLoader(this);
     WebResourceLoader::didFail(error);
 }
 
-void SubresourceLoader::cancel()
+void SubresourceLoader::didCancel(NSError *error)
 {
+    ASSERT(!reachedTerminalState());
+
     // Calling removeSubresourceLoader will likely result in a call to deref, so we must protect ourselves.
     RefPtr<SubresourceLoader> protect(this);
-        
+
     [m_coreLoader.get() cancel];
-    [frameLoader() removeSubresourceLoader:this];
-    receivedError(cancelledError());
-    WebResourceLoader::cancel();
+    if (cancelled())
+        return;
+    frameLoader()->removeSubresourceLoader(this);
+    WebResourceLoader::didCancel(error);
 }
 
 id <WebCoreResourceHandle> SubresourceLoader::handle()
index 1618271c4c7b2573f20c034f31c48d5d4b1eb6c4..310a7fb4eedfca89dbc1ad1b928262060cfcc830 100644 (file)
@@ -1,3 +1,71 @@
+2006-10-23  Darin Adler  <darin@apple.com>
+
+        Reviewed by Maciej.
+
+        - converted WebFrameLoader to C++
+
+        * History/WebHistoryItem.m:
+        (+[WebHistoryItem _closeObjectsInPendingPageCaches]):
+        * Plugins/WebBaseNetscapePluginView.mm:
+        (-[WebBaseNetscapePluginView loadRequest:inTarget:withNotifyData:sendNotification:]):
+        * Plugins/WebNetscapePluginStream.mm:
+        (-[WebNetscapePluginStream start]):
+        (-[WebNetscapePluginStream stop]):
+        * Plugins/WebPluginController.mm:
+        (-[WebPluginController webPlugInContainerLoadRequest:inFrame:]):
+        (-[WebPluginController pluginView:receivedResponse:]):
+        * WebCoreSupport/WebFrameBridge.h:
+        * WebKit.xcodeproj/project.pbxproj:
+        * WebView/WebDataSource.mm:
+        (-[WebDataSource _loadFromPageCache:]):
+        (-[WebDataSource _webView]):
+        (-[WebDataSource webFrame]):
+        * WebView/WebDocumentLoaderMac.h:
+        * WebView/WebDocumentLoaderMac.m:
+        (-[WebDocumentLoaderMac dealloc]):
+        (-[WebDocumentLoaderMac attachToFrame]):
+        (-[WebDocumentLoaderMac detachFromFrame]):
+        * WebView/WebFrame.mm:
+        (+[WebFrame _timeOfLastCompletedLoad]):
+        (-[WebFrame _loadItem:withLoadType:]):
+        (-[WebFrame _loadURL:referrer:intoChild:]):
+        (-[WebFrame _currentBackForwardListItemToResetTo]):
+        (-[WebFrame _itemForRestoringDocState]):
+        (-[WebFrame _frameLoader]):
+        (-[WebFrame _firstLayoutDone]):
+        (-[WebFrame _loadType]):
+        (-[WebFrame provisionalDataSource]):
+        (-[WebFrame dataSource]):
+        (-[WebFrame loadRequest:]):
+        (-[WebFrame loadArchive:]):
+        (-[WebFrame stopLoading]):
+        (-[WebFrame reload]):
+        (-[WebFrame _updateHistoryForCommit]):
+        (-[WebFrame _updateHistoryForReload]):
+        (-[WebFrame _updateHistoryForInternalLoad]):
+        (-[WebFrame _deliverArchivedResourcesAfterDelay]):
+        (-[WebFrame _willUseArchiveForRequest:originalURL:loader:]):
+        (-[WebFrame _deliverArchivedResources]):
+        (-[WebFrame _prepareForDataSourceReplacement]):
+        (-[WebFrame _provisionalLoadStarted]):
+        * WebView/WebFrameInternal.h:
+        * WebView/WebHTMLView.m:
+        (-[WebHTMLView _clearLastHitViewIfSelf]):
+        (-[WebHTMLView _updateMouseoverWithEvent:]):
+        (-[NSArray removeMouseMovedObserverUnconditionally]):
+        (-[NSArray removeMouseMovedObserver]):
+        (-[NSArray viewWillMoveToWindow:]):
+        (-[NSArray viewDidMoveToWindow]):
+        (-[WebHTMLView _canMakeTextSmaller]):
+        (-[WebHTMLView _canMakeTextLarger]):
+        (-[WebHTMLView _canMakeTextStandardSize]):
+        * WebView/WebPDFView.mm:
+        (-[WebPDFView PDFViewWillClickOnLink:withURL:]):
+        * WebView/WebView.mm:
+        (-[WebView _close]):
+        (-[WebView setDefersCallbacks:]):
+        (-[WebView setCustomTextEncodingName:]):
+
 2006-10-23  Geoffrey Garen  <ggaren@apple.com>
 
         Reviewed by Bradee.
index a492e2330bbb0774256f7cf11b9428171743f7ac..89e32a7799a5b04162a8a3fd0eddd3bed414d757 100644 (file)
@@ -714,7 +714,7 @@ static NSTimer *_pageCacheReleaseTimer = nil;
         WebHTMLView *HTMLView = [pageCache objectForKey:WebPageCacheDocumentViewKey];
         if ([HTMLView isKindOfClass:[WebHTMLView class]]) {
             // To avoid any possible retain cycles, call close on all the WebHTMLView.
-            // Don't close the WebHTMLVIew that is currently being viewed.
+            // Don't close the WebHTMLView that is currently being viewed.
             if ([[[HTMLView _frame] frameView] documentView] != HTMLView)
                 [HTMLView close];
         }
index 12546b64927fe51c0fb3085a884c0e7d4cf66ecb..923cc0203a4366c9a726a3ba90b968da978fd6f6 100644 (file)
@@ -1894,7 +1894,7 @@ static OSStatus TSMEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEve
 
     // don't let a plugin start any loads if it is no longer part of a document that is being
     // displayed
-    if ([[self dataSource] _documentLoader] !=  [[[self webFrame] _frameLoader] activeDocumentLoader])
+    if ([[self dataSource] _documentLoader] != [[self webFrame] _frameLoader]->activeDocumentLoader())
         return NPERR_GENERIC_ERROR;
     
     NSString *JSString = [URL _webkit_scriptIfJavaScriptURL];
index 0d9d16aca57cf285ae8cc1a28e5f9a9701811693..895c8aa51288dda6e534d3bf1223bc896ddf159f 100644 (file)
@@ -29,6 +29,7 @@
 #import <WebKit/WebNetscapePluginStream.h>
 
 #import <Foundation/NSURLConnection.h>
+#import <WebCore/FrameMac.h>
 #import <WebCore/WebFrameLoader.h>
 #import <WebCore/WebNetscapePlugInStreamLoader.h>
 #import <WebKit/WebDataSourceInternal.h>
@@ -72,7 +73,7 @@ using namespace WebCore;
     if (hideReferrer)
         [(NSMutableURLRequest *)request _web_setHTTPReferrer:nil];
 
-    _loader = NetscapePlugInStreamLoader::create([[view webFrame] _frameLoader], self).release();
+    _loader = NetscapePlugInStreamLoader::create([bridge impl], self).release();
     
     isTerminated = NO;
 
@@ -98,10 +99,9 @@ using namespace WebCore;
 {
     ASSERT(request);
 
-    [_loader->frameLoader() addPlugInStreamLoader:_loader];
-
+    _loader->frameLoader()->addPlugInStreamLoader(_loader);
     if (!_loader->load(request))
-        [_loader->frameLoader() removePlugInStreamLoader:_loader];
+        _loader->frameLoader()->removePlugInStreamLoader(_loader);
 }
 
 - (void)cancelLoadWithError:(NSError *)error
@@ -112,7 +112,8 @@ using namespace WebCore;
 
 - (void)stop
 {
-    [self cancelLoadAndDestroyStreamWithError:_loader->cancelledError()];
+    if (!_loader->isDone())
+        [self cancelLoadAndDestroyStreamWithError:_loader->cancelledError()];
 }
 
 @end
index 4768c3c4bb5ef9cf870c5154f7ae52428dabe5b2..6d16c95c66a4ff7429ad2b933458b739abc8ea20 100644 (file)
@@ -300,7 +300,7 @@ static void cancelOutstandingCheck(const void *item, void *context)
             LOG_ERROR("could not load URL %@", [request URL]);
             return;
         }
-        [[frame _frameLoader] loadRequest:request inFrameNamed:target];
+        [frame _frameLoader]->load(request, target);
     }
 }
 
@@ -375,7 +375,7 @@ static void cancelOutstandingCheck(const void *item, void *context)
                                                      pluginPageURL:nil
                                                         pluginName:nil // FIXME: Get this from somewhere
                                                           MIMEType:[response MIMEType]];
-        [[[_dataSource _documentLoader] frameLoader] stopLoadingWithError:error];
+        [[_dataSource _documentLoader] frameLoader]->stopLoading(error);
         [error release];
     }        
 }
index 56af0c0105b153abb5060a51fa9f922340fa8c09..7089f0c7b3973d923c3b2666247f88a6de79f472 100644 (file)
@@ -29,9 +29,7 @@
 #import <WebCore/WebCoreFrameBridge.h>
 
 @class WebPageBridge;
-@class WebCoreRenderPart;
 @class WebFrame;
-@class WebFrameLoader;
 @class WebFrameView;
 
 @protocol WebOpenPanelResultListener;
index 8ecc7e3ef1dcc350ead1e51ac1ea34586dcc4bf0..aa6fc14e9f85806bd5a91a71b9a96d925985546c 100644 (file)
                65EEDE55084FFC9E0002DB25 /* WebNSFileManagerExtras.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebNSFileManagerExtras.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                65EEDE56084FFC9E0002DB25 /* WebNSFileManagerExtras.m */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebNSFileManagerExtras.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                65FFB7FA0AD0B7D30048CD05 /* WebDocumentLoaderMac.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebDocumentLoaderMac.h; sourceTree = "<group>"; };
-               65FFB7FB0AD0B7D30048CD05 /* WebDocumentLoaderMac.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = WebDocumentLoaderMac.m; sourceTree = "<group>"; };
+               65FFB7FB0AD0B7D30048CD05 /* WebDocumentLoaderMac.m */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; path = WebDocumentLoaderMac.m; sourceTree = "<group>"; };
                700BC50B04144DA100A80182 /* WebDefaultResourceLoadDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebDefaultResourceLoadDelegate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                700BC50C04144DA100A80182 /* WebDefaultResourceLoadDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebDefaultResourceLoadDelegate.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                7082F56F038EADAA00A80180 /* WebKitNSStringExtras.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebKitNSStringExtras.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
index 5a74bfd692d9cae8981d38e4993a3a84b1be11e6..51ca1ddc121eaddbb199fcd17a307cc0dde30fa3 100644 (file)
@@ -55,6 +55,8 @@
 #import <WebKitSystemInterface.h>
 #import "WebDocumentLoaderMac.h"
 
+using namespace WebCore;
+
 @interface WebDataSourcePrivate : NSObject
 {
     @public
@@ -288,7 +290,7 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl
     [_private->loader prepareForLoadStart];
     _private->loadingFromPageCache = YES;
     [_private->loader setCommitted:YES];
-    [[_private->loader frameLoader] commitProvisionalLoad:pageCache];
+    [_private->loader frameLoader]->commitProvisionalLoad(pageCache);
 }
 
 - (WebArchive *)_popSubframeArchiveWithName:(NSString *)frameName
@@ -304,7 +306,7 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl
 
 - (WebView *)_webView
 {
-    return [(WebFrame *)[[_private->loader frameLoader] client] webView];
+    return [[self webFrame] webView];
 }
 
 - (BOOL)_isDocumentHTML
@@ -404,7 +406,10 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl
 
 - (WebFrame *)webFrame
 {
-    return (WebFrame *)[[_private->loader frameLoader] client];
+    FrameLoader* frameLoader = [_private->loader frameLoader];
+    if (!frameLoader)
+        return nil;
+    return (WebFrame *)frameLoader->client();
 }
 
 -(NSURLRequest *)initialRequest
index b782b87e0c223c0f04304e221a02e98f2b739695..d28172ec9a732c66219e539851acb4aff98bb240 100644 (file)
@@ -20,7 +20,7 @@
  * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
   * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 @interface WebDocumentLoaderMac : WebDocumentLoader
 {
-    @public
     WebDataSource *dataSource;
     WebDataSource *detachedDataSource; // not retained
 }
-
-- (id)initWithRequest:(NSURLRequest *)request;
 - (void)setDataSource:(WebDataSource *)dataSource;
 - (WebDataSource *)dataSource;
-
 @end
index 9dd3da7e16b229379ef5fb0f73ad34d23f09292c..bc59354398dcc554f6477bde5452ea56d105d29f 100644 (file)
 
 #import <JavaScriptCore/Assertions.h>
 
-#import <WebKitSystemInterface.h>
-
 @implementation WebDocumentLoaderMac
 
-
-- (id)initWithRequest:(NSURLRequest *)req
-{
-    self = [super initWithRequest:req];
-    return self;
-}
-
 - (void)dealloc
 {
     [dataSource release];
-    
     [super dealloc];
 }    
 
@@ -60,9 +50,9 @@
     return dataSource;
 }
 
-- (void)setFrameLoader:(WebFrameLoader *)fl
+- (void)attachToFrame
 {
-    [super setFrameLoader:fl];
+    [super attachToFrame];
     if (detachedDataSource) {
         ASSERT(!dataSource);
         [self setDataSource:detachedDataSource];
     }
 }
 
-- (void)detachFromFrameLoader
+- (void)detachFromFrame
 {
-    [super detachFromFrameLoader];
+    [super detachFromFrame];
     detachedDataSource = dataSource;
     [self setDataSource:nil];
 }
 
 @end
-
-
-
-
index 00f08a10f35c17b4371cd09bf23e7ad7eade6e12..87ed8399e714d11357aa8b2b01b7cfdc58ec6c41 100644 (file)
@@ -391,7 +391,7 @@ static inline WebFrame *frame(WebCoreFrameBridge *bridge)
 
 + (CFAbsoluteTime)_timeOfLastCompletedLoad
 {
-    return [WebFrameLoader timeOfLastCompletedLoad];
+    return FrameLoader::timeOfLastCompletedLoad();
 }
 
 - (BOOL)_createPageCacheForItem:(WebHistoryItem *)item
@@ -477,8 +477,7 @@ static inline WebFrame *frame(WebCoreFrameBridge *bridge)
     
     // FIXME: These checks don't match the ones in _loadURL:referrer:loadType:target:triggeringEvent:isFormSubmission:
     // Perhaps they should.
-    if (!formData && ![[self _frameLoader] shouldReloadForCurrent:itemURL andDestination:currentURL] && [self _URLsMatchItem:item] )
-    {
+    if (!formData && ![self _frameLoader]->shouldReload(itemURL, currentURL) && [self _URLsMatchItem:item]) {
 #if 0
         // FIXME:  We need to normalize the code paths for anchor navigation.  Something
         // like the following line of code should be done, but also accounting for correct
@@ -500,7 +499,7 @@ static inline WebFrame *frame(WebCoreFrameBridge *bridge)
 
         // Fake the URL change by updating the data source's request.  This will no longer
         // be necessary if we do the better fix described above.
-        [[[self _frameLoader] documentLoader] replaceRequestURLForAnchorScrollWithURL:itemURL];
+        [[self _frameLoader]->documentLoader() replaceRequestURLForAnchorScrollWithURL:itemURL];
         
         [[[self webView] _frameLoadDelegateForwarder] webView:[self webView]
                                didChangeLocationWithinPageForFrame:self];
@@ -521,7 +520,7 @@ static inline WebFrame *frame(WebCoreFrameBridge *bridge)
             NSTimeInterval delta = [[NSDate date] timeIntervalSinceDate: cacheDate];
             if (delta <= [[[self webView] preferences] _backForwardCacheExpirationInterval]) {
                 newDataSource = [pageCache objectForKey: WebPageCacheDataSourceKey];
-                [[self _frameLoader] loadDocumentLoader:[newDataSource _documentLoader] withLoadType:loadType formState:0];   
+                [self _frameLoader]->load([newDataSource _documentLoader], loadType, 0);   
                 inPageCache = YES;
             } else {
                 LOG (PageCache, "Not restoring page from back/forward cache because cache entry has expired, %@ (%3.5f > %3.5f seconds)\n", [_private->provisionalItem URL], delta, [[[self webView] preferences] _backForwardCacheExpirationInterval]);
@@ -531,7 +530,7 @@ static inline WebFrame *frame(WebCoreFrameBridge *bridge)
         
         if (!inPageCache) {
             NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:itemURL];
-            [[self _frameLoader] addExtraFieldsToRequest:request mainResource:YES alwaysFromRequest:(formData != nil) ? YES : NO];
+            [self _frameLoader]->addExtraFieldsToRequest(request, true, (formData != nil));
 
             // If this was a repost that failed the page cache, we might try to repost the form.
             NSDictionary *action;
@@ -541,7 +540,7 @@ static inline WebFrame *frame(WebCoreFrameBridge *bridge)
                 webSetHTTPBody(request, formData);
                 [request _web_setHTTPContentType:[item formContentType]];
 
-                // Slight hack to test if the WF cache contains the page we're going to.  We want
+                // Slight hack to test if the NSURL cache contains the page we're going to.  We want
                 // to know this before talking to the policy delegate, since it affects whether we
                 // show the DoYouReallyWantToRepost nag.
                 //
@@ -552,13 +551,12 @@ static inline WebFrame *frame(WebCoreFrameBridge *bridge)
                 NSURLResponse *synchResponse = nil;
                 [NSURLConnection sendSynchronousRequest:request returningResponse:&synchResponse error:nil];
                 if (synchResponse == nil) { 
-                    // Not in WF cache
+                    // Not in the NSURL cache
                     [request setCachePolicy:NSURLRequestReloadIgnoringCacheData];
-                    action = [[self _frameLoader] actionInformationForNavigationType:NavigationTypeFormResubmitted event:nil originalURL:itemURL];
-                } else {
+                    action = [self _frameLoader]->actionInformation(NavigationTypeFormResubmitted, nil, itemURL);
+                } else
                     // We can use the cache, don't use navType=resubmit
-                    action = [[self _frameLoader] actionInformationForLoadType:loadType isFormSubmission:NO event:nil originalURL:itemURL];
-                }
+                    action = [self _frameLoader]->actionInformation(loadType, false, nil, itemURL);
             } else {
                 switch (loadType) {
                     case FrameLoadTypeReload:
@@ -581,10 +579,10 @@ static inline WebFrame *frame(WebCoreFrameBridge *bridge)
                         ASSERT_NOT_REACHED();
                 }
 
-                action = [[self _frameLoader] actionInformationForLoadType:loadType isFormSubmission:NO event:nil originalURL:itemOriginalURL];
+                action = [self _frameLoader]->actionInformation(loadType, false, nil, itemOriginalURL);
             }
 
-            [[self _frameLoader] _loadRequest:request triggeringAction:action loadType:loadType formState:0];
+            [self _frameLoader]->load(request, action, loadType, 0);
             [request release];
         }
     }
@@ -666,7 +664,7 @@ static inline WebFrame *frame(WebCoreFrameBridge *bridge)
 {
     WebHistoryItem *parentItem = _private->currentItem;
     NSArray *childItems = [parentItem children];
-    FrameLoadType loadType = [[self _frameLoader] loadType];
+    FrameLoadType loadType = [self _frameLoader]->loadType();
     FrameLoadType childLoadType = FrameLoadTypeInternal;
     WebHistoryItem *childItem = nil;
 
@@ -700,7 +698,7 @@ static inline WebFrame *frame(WebCoreFrameBridge *bridge)
     if (archive)
         [childFrame loadArchive:archive];
     else
-        [[childFrame _frameLoader] loadURL:URL referrer:referrer loadType:childLoadType target:nil triggeringEvent:nil form:nil formValues:nil];
+        [childFrame _frameLoader]->load(URL, referrer, childLoadType, nil, nil, nil, nil);
 }
 
 - (void)_saveScrollPositionAndViewStateToItem:(WebHistoryItem *)item
@@ -751,7 +749,7 @@ static inline WebFrame *frame(WebCoreFrameBridge *bridge)
 // Return the item that we would reset to, so we can decide later whether to actually reset.
 - (WebHistoryItem *)_currentBackForwardListItemToResetTo
 {
-    if (isBackForwardLoadType([[self _frameLoader] loadType]) && [self _isMainFrame])
+    if (isBackForwardLoadType([self _frameLoader]->loadType()) && [self _isMainFrame])
         return _private->currentItem;
     return nil;
 }
@@ -774,7 +772,7 @@ static inline WebFrame *frame(WebCoreFrameBridge *bridge)
 
 - (WebHistoryItem *)_itemForRestoringDocState
 {
-    switch ([[self _frameLoader] loadType]) {
+    switch ([self _frameLoader]->loadType()) {
         case FrameLoadTypeReload:
         case FrameLoadTypeReloadAllowingStaleData:
         case FrameLoadTypeSame:
@@ -1048,7 +1046,7 @@ static inline WebFrame *frame(WebCoreFrameBridge *bridge)
     [_private->inspectors removeObject:inspector];
 }
 
-- (WebFrameLoader *)_frameLoader
+- (FrameLoader*)_frameLoader
 {
     return [_private->bridge frameLoader];
 }
@@ -1100,12 +1098,12 @@ static inline WebDataSource *dataSource(WebDocumentLoader *loader)
 
 - (BOOL)_firstLayoutDone
 {
-    return [[self _frameLoader] firstLayoutDone];
+    return [self _frameLoader]->firstLayoutDone();
 }
 
 - (WebFrameLoadType)_loadType
 {
-    return (WebFrameLoadType)[[self _frameLoader] loadType];
+    return (WebFrameLoadType)[self _frameLoader]->loadType();
 }
 
 @end
@@ -1169,17 +1167,17 @@ static inline WebDataSource *dataSource(WebDocumentLoader *loader)
 
 - (WebDataSource *)provisionalDataSource
 {
-    return dataSource([[self _frameLoader] provisionalDocumentLoader]);
+    return dataSource([self _frameLoader]->provisionalDocumentLoader());
 }
 
 - (WebDataSource *)dataSource
 {
-    return dataSource([[self _frameLoader] documentLoader]);
+    return dataSource([self _frameLoader]->documentLoader());
 }
 
 - (void)loadRequest:(NSURLRequest *)request
 {
-    [[self _frameLoader] loadRequest:request];
+    [self _frameLoader]->load(request);
 }
 
 - (void)_loadData:(NSData *)data MIMEType:(NSString *)MIMEType textEncodingName:(NSString *)encodingName baseURL:(NSURL *)URL unreachableURL:(NSURL *)unreachableURL
@@ -1225,18 +1223,18 @@ static inline WebDataSource *dataSource(WebDocumentLoader *loader)
                                               unreachableURL:nil];
         WebDocumentLoader *documentLoader = [self _createDocumentLoaderWithRequest:request];
         [dataSource(documentLoader) _addToUnarchiveState:archive];
-        [[self _frameLoader] loadDocumentLoader:documentLoader];
+        [self _frameLoader]->load(documentLoader);
     }
 }
 
 - (void)stopLoading
 {
-    [[self _frameLoader] stopLoading];
+    [self _frameLoader]->stopLoading();
 }
 
 - (void)reload
 {
-    [[self _frameLoader] reload];
+    [self _frameLoader]->reload();
 }
 
 - (WebFrame *)findFrameNamed:(NSString *)name
@@ -1339,7 +1337,7 @@ static inline WebDataSource *dataSource(WebDocumentLoader *loader)
 
 - (void)_updateHistoryForCommit
 {
-    FrameLoadType type = [[self _frameLoader] loadType];
+    FrameLoadType type = [self _frameLoader]->loadType();
     if (isBackForwardLoadType(type) ||
         (type == FrameLoadTypeReload && [[self provisionalDataSource] unreachableURL] != nil)) {
         // Once committed, we want to use current item for saving DocState, and
@@ -1358,7 +1356,7 @@ static inline WebDataSource *dataSource(WebDocumentLoader *loader)
     WebHistoryItem *currItem = _private->currentItem;
     LOG(PageCache, "Clearing back/forward cache, %@\n", [currItem URL]);
     [currItem setHasPageCache:NO];
-    if ([[self _frameLoader] loadType] == FrameLoadTypeReload)
+    if ([self _frameLoader]->loadType() == FrameLoadTypeReload)
         [self _saveScrollPositionAndViewStateToItem:currItem];
     WebDataSource *dataSource = [self dataSource];
     NSURLRequest *request = [dataSource request];
@@ -1415,7 +1413,7 @@ static inline WebDataSource *dataSource(WebDocumentLoader *loader)
 - (void)_updateHistoryForInternalLoad
 {
     // Add an item to the item tree for this frame
-    ASSERT(![[[self _frameLoader] documentLoader] isClientRedirect]);
+    ASSERT(![[self _frameLoader]->documentLoader() isClientRedirect]);
     WebFrame *parentFrame = [self parentFrame];
     if (parentFrame) {
         WebHistoryItem *parentItem = parentFrame->_private->currentItem;
@@ -1966,7 +1964,7 @@ static inline WebPolicyDecisionListener *decisionListener(WebPolicyDecider *deci
         return;
     if (_private->pendingArchivedResources->isEmpty())
         return;
-    if ([[self _frameLoader] defersCallbacks])
+    if ([self _frameLoader]->defersCallbacks())
         return;
     
     [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(_deliverArchivedResources) object:nil];
@@ -1979,7 +1977,7 @@ static inline WebPolicyDecisionListener *decisionListener(WebPolicyDecider *deci
         return NO;
     if (![self _canUseResourceForRequest:r])
         return NO;
-    WebResource *resource = [dataSource([[self _frameLoader] activeDocumentLoader]) _archivedSubresourceForURL:originalURL];
+    WebResource *resource = [dataSource([self _frameLoader]->activeDocumentLoader()) _archivedSubresourceForURL:originalURL];
     if (!resource)
         return NO;
     if (![self _canUseResourceWithResponse:[resource _response]])
@@ -2023,7 +2021,7 @@ static inline WebPolicyDecisionListener *decisionListener(WebPolicyDecider *deci
         return;
     if (_private->pendingArchivedResources->isEmpty())
         return;
-    if ([[self _frameLoader] defersCallbacks])
+    if ([self _frameLoader]->defersCallbacks())
         return;
 
     const ResourceMap copy = *_private->pendingArchivedResources;
@@ -2172,13 +2170,10 @@ static inline WebPolicyDecisionListener *decisionListener(WebPolicyDecider *deci
     NSView *frameView = [self frameView];
     NSWindow *window = [frameView window];
     NSResponder *firstResp = [window firstResponder];
-    if ([firstResp isKindOfClass:[NSView class]]
-        && [(NSView *)firstResp isDescendantOf:frameView])
-    {
+    if ([firstResp isKindOfClass:[NSView class]] && [(NSView *)firstResp isDescendantOf:frameView])
         [window endEditingFor:firstResp];
-    }
     
-    [[self _frameLoader] detachChildren];
+    [self _frameLoader]->detachChildren();
 }
 
 - (void)_didFinishLoad
@@ -2200,7 +2195,7 @@ static inline WebPolicyDecisionListener *decisionListener(WebPolicyDecider *deci
 
 - (void)_provisionalLoadStarted
 {
-    FrameLoadType loadType = [[self _frameLoader] loadType];
+    FrameLoadType loadType = [self _frameLoader]->loadType();
     
     // FIXME: This is OK as long as no one resizes the window,
     // but in the case where someone does, it means garbage outside
@@ -2216,12 +2211,12 @@ static inline WebPolicyDecisionListener *decisionListener(WebPolicyDecider *deci
     if ([self _canCachePage]
         && [_private->bridge canCachePage]
         && item
-        && ![[self _frameLoader] isQuickRedirectComing]
+        && ![self _frameLoader]->isQuickRedirectComing()
         && loadType != FrameLoadTypeReload 
         && loadType != FrameLoadTypeReloadAllowingStaleData
         && loadType != FrameLoadTypeSame
         && ![[self dataSource] isLoading]
-        && ![[[self _frameLoader] documentLoader] isStopping]) {
+        && ![[self _frameLoader]->documentLoader() isStopping]) {
         if ([[[self dataSource] representation] isKindOfClass:[WebHTMLRepresentation class]]) {
             if (![item pageCache]){
                 // Add the items to this page's cache.
index ddc7b84d79b05092f4e1c1c9512864d25c370ace..de5bce0d61544f6455576771ab62aac5b11727f4 100644 (file)
 
 @class WebDocumentLoader;
 @class WebInspector;
-@class WebFrameLoader;
 @class WebFrameView;
 @class WebFrameBridge;
 
+#ifdef __cplusplus
+namespace WebCore {
+    class FrameLoader;
+}
+typedef WebCore::FrameLoader WebCoreFrameLoader;
+#else
+@class WebCoreFrameLoader;
+#endif
+
 @interface WebFrame (WebInternal)
 
 - (void)_updateBackground;
@@ -64,7 +72,7 @@
 - (void)_addInspector:(WebInspector *)inspector;
 - (void)_removeInspector:(WebInspector *)inspector;
 
-- (WebFrameLoader *)_frameLoader;
+- (WebCoreFrameLoader*)_frameLoader;
 - (WebDataSource *)_dataSourceForDocumentLoader:(WebDocumentLoader *)loader;
 
 - (NSURLRequest *)_webDataRequestForData:(NSData *)data MIMEType:(NSString *)MIMEType textEncodingName:(NSString *)encodingName baseURL:(NSURL *)URL unreachableURL:(NSURL *)unreachableURL;
index 15032ba565a149fd04116261ea588ac9978e8b1f..223f09e1583b5082a5b7b9646168e259bbfa2f9d 100644 (file)
@@ -1024,9 +1024,8 @@ static WebHTMLView *lastHitView = nil;
 
 - (void)_clearLastHitViewIfSelf
 {
-    if (lastHitView == self) {
+    if (lastHitView == self)
         lastHitView = nil;
-    }
 }
 
 - (NSTrackingRectTag)addTrackingRect:(NSRect)rect owner:(id)owner userData:(void *)data assumeInside:(BOOL)assumeInside
@@ -1166,7 +1165,7 @@ static WebHTMLView *lastHitView = nil;
     if (view)
         [view retain];
 
-    if (lastHitView != view && lastHitView != nil) {
+    if (lastHitView != view && lastHitView && [lastHitView _frame]) {
         // If we are moving out of a view (or frame), let's pretend the mouse moved
         // all the way out of that view. But we have to account for scrolling, because
         // khtml doesn't understand our clipping.
@@ -2320,16 +2319,20 @@ static WebHTMLView *lastHitView = nil;
     [self _frameOrBoundsChanged];
 }
 
+- (void)removeMouseMovedObserverUnconditionally
+{
+    [[NSNotificationCenter defaultCenter] removeObserver:self
+        name:WKMouseMovedNotification() object:nil];
+}
+
 - (void)removeMouseMovedObserver
 {
     // Don't remove the observer if we're running the Dashboard.
-    // FIXME: Right for the windowDidResignKey: case, but wrong for the viewWillMoveToWindow: case.
     if ([[self _webView] _dashboardBehavior:WebDashboardBehaviorAlwaysSendMouseEventsToAllWindows])
         return;
 
     [[self _webView] _mouseDidMoveOverElement:nil modifierFlags:0];
-    [[NSNotificationCenter defaultCenter] removeObserver:self
-        name:WKMouseMovedNotification() object:nil];
+    [self removeMouseMovedObserverUnconditionally];
 }
 
 - (void)addSuperviewObservers
@@ -2416,15 +2419,16 @@ static WebHTMLView *lastHitView = nil;
     // when decoding a WebView.  When WebViews are decoded their subviews
     // are created by initWithCoder: and so won't be normally
     // initialized.  The stub views are discarded by WebView.
-    if (_private) {
-        // FIXME: Some of these calls may not work because this view may be already removed from it's superview.
-        [self removeMouseMovedObserver];
-        [self removeWindowObservers];
-        [self removeSuperviewObservers];
-        [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(_updateMouseoverWithFakeEvent) object:nil];
-    
-        [[self _pluginController] stopAllPlugins];
-    }
+    if (!_private)
+        return;
+
+    // FIXME: Some of these calls may not work because this view may be already removed from it's superview.
+    [self removeMouseMovedObserverUnconditionally];
+    [self removeWindowObservers];
+    [self removeSuperviewObservers];
+    [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(_updateMouseoverWithFakeEvent) object:nil];
+
+    [[self _pluginController] stopAllPlugins];
 }
 
 - (void)viewDidMoveToWindow
@@ -2433,26 +2437,27 @@ static WebHTMLView *lastHitView = nil;
     // when decoding a WebView.  When WebViews are decoded their subviews
     // are created by initWithCoder: and so won't be normally
     // initialized.  The stub views are discarded by WebView.
-    if (_private) {
-        [self _stopAutoscrollTimer];
-        if ([self window]) {
-            _private->lastScrollPosition = [[self superview] bounds].origin;
-            [self addWindowObservers];
-            [self addSuperviewObservers];
-            [self addMouseMovedObserver];
-
-            // Schedule this update, rather than making the call right now.
-            // The reason is that placing the caret in the just-installed view requires
-            // the HTML/XML document to be available on the WebCore side, but it is not
-            // at the time this code is running. However, it will be there on the next
-            // crank of the run loop. Doing this helps to make a blinking caret appear 
-            // in a new, empty window "automatic".
-            [self performSelector:@selector(_updateActiveState) withObject:nil afterDelay:0];
-
-            [[self _pluginController] startAllPlugins];
-    
-            _private->lastScrollPosition = NSZeroPoint;
-        }
+    if (!_private)
+        return;
+        
+    [self _stopAutoscrollTimer];
+    if ([self window]) {
+        _private->lastScrollPosition = [[self superview] bounds].origin;
+        [self addWindowObservers];
+        [self addSuperviewObservers];
+        [self addMouseMovedObserver];
+
+        // Schedule this update, rather than making the call right now.
+        // The reason is that placing the caret in the just-installed view requires
+        // the HTML/XML document to be available on the WebCore side, but it is not
+        // at the time this code is running. However, it will be there on the next
+        // crank of the run loop. Doing this helps to make a blinking caret appear 
+        // in a new, empty window "automatic".
+        [self performSelector:@selector(_updateActiveState) withObject:nil afterDelay:0];
+
+        [[self _pluginController] startAllPlugins];
+
+        _private->lastScrollPosition = NSZeroPoint;
     }
 }
 
@@ -4833,9 +4838,23 @@ static DOMRange *unionDOMRanges(DOMRange *a, DOMRange *b)
 }
 
 // never sent because we track the common size factor
-- (BOOL)_canMakeTextSmaller          {   ASSERT_NOT_REACHED(); return NO;    }
-- (BOOL)_canMakeTextLarger           {   ASSERT_NOT_REACHED(); return NO;    }
-- (BOOL)_canMakeTextStandardSize     {   ASSERT_NOT_REACHED(); return NO;    }
+- (BOOL)_canMakeTextSmaller
+{
+    ASSERT_NOT_REACHED();
+    return NO;
+}
+
+- (BOOL)_canMakeTextLarger
+{
+    ASSERT_NOT_REACHED();
+    return NO;
+}
+
+- (BOOL)_canMakeTextStandardSize
+{
+    ASSERT_NOT_REACHED();
+    return NO;
+}
 
 @end
 
index e85be49d62254a2637116e4fc103dd5c88b94cdd..18d8486ceade3a46523e488e9c21b7ad0cd66683 100644 (file)
@@ -816,8 +816,8 @@ static BOOL _PDFSelectionsAreEqual(PDFSelection *selectionA, PDFSelection *selec
 // links within the PDFView.  
 - (void)PDFViewWillClickOnLink:(PDFView *)sender withURL:(NSURL *)URL
 {
-    if (URL != nil)
-        [[[dataSource webFrame] _frameLoader] safeLoadURL:URL];
+    if (URL)
+        [[dataSource webFrame] _frameLoader]->safeLoad(URL);
 }
 
 @end
index 9f2bb05d4feef31cac5c901f1d59728930eb0ee5..564b39c812f2e861b1d0bb556e1137e23854dd73 100644 (file)
 
 #import "WebViewInternal.h"
 
-#import <JavaScriptCore/Assertions.h>
 #import "WebBackForwardList.h"
 #import "WebBaseNetscapePluginView.h"
 #import "WebDOMOperationsPrivate.h"
 #import "WebDashboardRegion.h"
-#import <WebCore/WebDataProtocol.h>
 #import "WebDataSourceInternal.h"
 #import "WebDefaultEditingDelegate.h"
 #import "WebDefaultFrameLoadDelegate.h"
@@ -44,7 +42,6 @@
 #import "WebDefaultUIDelegate.h"
 #import "WebDocument.h"
 #import "WebDocumentInternal.h"
-#import <WebCore/WebDocumentLoader.h>
 #import "WebDownload.h"
 #import "WebDownloadInternal.h"
 #import "WebDynamicScrollBarsView.h"
@@ -52,7 +49,6 @@
 #import "WebFormDelegatePrivate.h"
 #import "WebFrameBridge.h"
 #import "WebFrameInternal.h"
-#import <WebCore/WebFrameLoader.h>
 #import "WebFrameViewInternal.h"
 #import "WebHTMLRepresentation.h"
 #import "WebHTMLViewInternal.h"
 #import "WebNSURLRequestExtras.h"
 #import "WebNSUserDefaultsExtras.h"
 #import "WebNSViewExtras.h"
-#import "WebPageBridge.h"
 #import "WebPDFView.h"
+#import "WebPageBridge.h"
 #import "WebPluginDatabase.h"
 #import "WebPolicyDelegate.h"
-#import "WebPreferencesPrivate.h"
 #import "WebPreferenceKeysPrivate.h"
+#import "WebPreferencesPrivate.h"
 #import "WebResourceLoadDelegate.h"
 #import "WebScriptDebugDelegatePrivate.h"
 #import "WebScriptDebugServerPrivate.h"
 #import "WebUIDelegatePrivate.h"
 #import <CoreFoundation/CFSet.h>
 #import <Foundation/NSURLConnection.h>
+#import <JavaScriptCore/Assertions.h>
 #import <WebCore/WebCoreEncodings.h>
 #import <WebCore/WebCoreFrameBridge.h>
 #import <WebCore/WebCoreSettings.h>
+#import <WebCore/WebCoreTextRenderer.h>
 #import <WebCore/WebCoreView.h>
+#import <WebCore/WebDataProtocol.h>
+#import <WebCore/WebDocumentLoader.h>
+#import <WebCore/WebFrameLoader.h>
 #import <WebKit/DOM.h>
-#import <WebKit/DOMPrivate.h>
 #import <WebKit/DOMExtensions.h>
+#import <WebKit/DOMPrivate.h>
 #import <WebKitSystemInterface.h>
 #import <objc/objc-runtime.h>
 
-#import <WebCore/WebCoreTextRenderer.h>
+using namespace WebCore;
 
 #if defined(__ppc__) || defined(__ppc64__)
 #define PROCESSOR "PPC"
@@ -621,7 +622,9 @@ static bool debugWidget = true;
     // To avoid leaks, call removeDragCaret in case it wasn't called after moveDragCaretToPoint.
     [self removeDragCaret];
 
-    [[[self mainFrame] _frameLoader] detachFromParent];
+    FrameLoader* mainFrameLoader = [[self mainFrame] _frameLoader];
+    if (mainFrameLoader)
+        mainFrameLoader->detachFromParent();
     [_private->_pageBridge close];
     [_private->_pageBridge release];
     _private->_pageBridge = nil;
@@ -694,12 +697,13 @@ static bool debugWidget = true;
 
 - (void)setDefersCallbacks:(BOOL)defers
 {
-    if (defers == _private->defersCallbacks) {
+    if (defers == _private->defersCallbacks)
         return;
-    }
 
     _private->defersCallbacks = defers;
-    [[[self mainFrame] _frameLoader] defersCallbacksChanged];
+    FrameLoader* mainFrameLoader = [[self mainFrame] _frameLoader];
+    if (mainFrameLoader)
+        mainFrameLoader->defersCallbacksChanged();
 }
 
 - (WebView *)_openNewWindowWithRequest:(NSURLRequest *)request
@@ -2185,10 +2189,11 @@ NS_ENDHANDLER
 - (void)setCustomTextEncodingName:(NSString *)encoding
 {
     NSString *oldEncoding = [self customTextEncodingName];
-    if (encoding == oldEncoding || [encoding isEqualToString:oldEncoding]) {
+    if (encoding == oldEncoding || [encoding isEqualToString:oldEncoding])
         return;
-    }
-    [[[self mainFrame] _frameLoader] _reloadAllowingStaleDataWithOverrideEncoding:encoding];
+    FrameLoader* mainFrameLoader = [[self mainFrame] _frameLoader];
+    if (mainFrameLoader)
+        mainFrameLoader->reloadAllowingStaleData(encoding);
 }
 
 - (NSString *)_mainFrameOverrideEncoding