Commit 19e78ee4 authored by bfulgham@apple.com's avatar bfulgham@apple.com

[Windows] Refactor WebFrame to compose with WebFrameLoaderClient

https://bugs.webkit.org/show_bug.cgi?id=120092

Reviewed by Anders Carlsson.

Revise WebFrame implementation on Windows to no longer subclass from
WebFrameLoaderClient, instead using a fully-functional WebFrameLoaderClient
as a helper object to perform the tasks, as is done in the other
ports. This is a step towards completing
https://bugs.webkit.org/show_bug.cgi?id=119964.

* WebCoreSupport/WebFrameLoaderClient.cpp: Add a new 'private data'
object to house the policy delegate and function.
(WebFrameLoaderClient::WebFramePolicyListenerPrivate::WebFramePolicyListenerPrivate):
Create the new private data object.
(WebFrameLoaderClient::WebFramePolicyListenerPrivate::~WebFramePolicyListenerPrivate):
Destroy the new private data object.
(WebFrameLoaderClient::WebFrameLoaderClient): Moved from WebFrame.cpp
(WebFrameLoaderClient::frameLoaderDestroyed): Ditto
(WebFrameLoaderClient::makeRepresentation): Ditto
(WebFrameLoaderClient::forceLayoutForNonHTML): Ditto
(WebFrameLoaderClient::setCopiesOnScroll): Ditto
(WebFrameLoaderClient::detachedFromParent2): Ditto
(WebFrameLoaderClient::detachedFromParent3): Ditto
(WebFrameLoaderClient::convertMainResourceLoadToDownload): Ditto
(WebFrameLoaderClient::dispatchDidLoadResourceFromMemoryCache): Ditto
(WebFrameLoaderClient::dispatchDidFailProvisionalLoad): Ditto
(WebFrameLoaderClient::dispatchDidFailLoad): Ditto
(WebFrameLoaderClient::dispatchDecidePolicyForResponse): Ditto
(WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction): Ditto
(WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction): Ditto
(WebFrameLoaderClient::dispatchUnableToImplementPolicy): Ditto
(WebFrameLoaderClient::dispatchWillSendSubmitEvent): Ditto
(WebFrameLoaderClient::dispatchWillSubmitForm): Ditto
(WebFrameLoaderClient::startDownload): Ditto
(WebFrameLoaderClient::willChangeTitle): Ditto
(WebFrameLoaderClient::didChangeTitle): Ditto
(WebFrameLoaderClient::cancelledError): Ditto
(WebFrameLoaderClient::blockedError): Ditto
(WebFrameLoaderClient::cannotShowURLError): Ditto
(WebFrameLoaderClient::interruptedForPolicyChangeError): Ditto
(WebFrameLoaderClient::cannotShowMIMETypeError): Ditto
(WebFrameLoaderClient::fileDoesNotExistError): Ditto
(WebFrameLoaderClient::pluginWillHandleLoadError): Ditto
(WebFrameLoaderClient::shouldFallBack): Ditto
(WebFrameLoaderClient::canHandleRequest): Ditto
(WebFrameLoaderClient::canShowMIMEType): Ditto
(WebFrameLoaderClient::canShowMIMETypeAsHTML): Ditto
(WebFrameLoaderClient::representationExistsForURLScheme): Ditto
(WebFrameLoaderClient::generatedMIMETypeForURLScheme): Ditto
(WebFrameLoaderClient::frameLoadCompleted): Ditto
(WebFrameLoaderClient::saveViewStateToItem): Ditto
(WebFrameLoaderClient::restoreViewState): Ditto
(WebFrameLoaderClient::provisionalLoadStarted): Ditto
(WebFrameLoaderClient::didFinishLoad): Ditto
(WebFrameLoaderClient::prepareForDataSourceReplacement): Ditto
(WebFrameLoaderClient::userAgent): Ditto
(WebFrameLoaderClient::objectContentType): Ditto
(WebFrameLoaderClient::createJavaAppletWidget): Ditto
(WebFrameLoaderClient::overrideMediaType): Ditto
(WebFrameLoaderClient::documentElementAvailable): Ditto
(WebFrameLoaderClient::dispatchDidClearWindowObjectInWorld): Ditto
(WebFrameLoaderClient::registerForIconNotification): Ditto
(WebFrameLoaderClient::didPerformFirstNavigation): Ditto
(WebFrameLoaderClient::createNetworkingContext): Ditto
(WebFrameLoaderClient::shouldAlwaysUsePluginDocument): Ditto
(WebFrameLoaderClient::revertToProvisionalState): Ditto
(WebFrameLoaderClient::setMainFrameDocumentReady): Ditto
(WebFrameLoaderClient::cancelPolicyCheck): Ditto
(WebFrameLoaderClient::setUpPolicyListener): Ditto
(WebFrameLoaderClient::receivedPolicyDecision): Ditto
* WebCoreSupport/WebFrameLoaderClient.h:
(WebFrameLoaderClient::webFrame): Add accessor method
* WebDataSource.cpp:
(WebDataSource::representation): Loader client is now
a WebFrameLoaderClient (not a WebFrame).
(WebDataSource::webFrame): Ditto
* WebElementPropertyBag.cpp:
(WebElementPropertyBag::Read): Loader client is now
a WebFrameLoaderClient (not a WebFrame)
* WebFrame.cpp:
(kit): Revise for WebFrameLoaderClient use.
(WebFrame::WebFramePrivate::WebFramePrivate): Remove
WebFramePolicyListener and FramePolicyFunction, since
they are no longer needed here. They were moved to
the WebFrameLoaderClient object.
(WebFrame::WebFrame): No longer inheriting from
WebFramePolicyListener.
(WebFrame::init): Frame::create now needs to be supplied
with a new WebFramePolicyListener, rather than 'this'
* WebFrame.h:
* WebFramePolicyListener.cpp:
(WebFramePolicyListener::receivedPolicyDecision): Loader
client is now a WebFramePolicyClient, not a WebFrame.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154508 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 25e0e999
2013-08-23 Brent Fulgham <bfulgham@apple.com>
[Windows] Refactor WebFrame to compose with WebFrameLoaderClient
https://bugs.webkit.org/show_bug.cgi?id=120092
Reviewed by Anders Carlsson.
Revise WebFrame implementation on Windows to no longer subclass from
WebFrameLoaderClient, instead using a fully-functional WebFrameLoaderClient
as a helper object to perform the tasks, as is done in the other
ports. This is a step towards completing
https://bugs.webkit.org/show_bug.cgi?id=119964.
* WebCoreSupport/WebFrameLoaderClient.cpp: Add a new 'private data'
object to house the policy delegate and function.
(WebFrameLoaderClient::WebFramePolicyListenerPrivate::WebFramePolicyListenerPrivate):
Create the new private data object.
(WebFrameLoaderClient::WebFramePolicyListenerPrivate::~WebFramePolicyListenerPrivate):
Destroy the new private data object.
(WebFrameLoaderClient::WebFrameLoaderClient): Moved from WebFrame.cpp
(WebFrameLoaderClient::frameLoaderDestroyed): Ditto
(WebFrameLoaderClient::makeRepresentation): Ditto
(WebFrameLoaderClient::forceLayoutForNonHTML): Ditto
(WebFrameLoaderClient::setCopiesOnScroll): Ditto
(WebFrameLoaderClient::detachedFromParent2): Ditto
(WebFrameLoaderClient::detachedFromParent3): Ditto
(WebFrameLoaderClient::convertMainResourceLoadToDownload): Ditto
(WebFrameLoaderClient::dispatchDidLoadResourceFromMemoryCache): Ditto
(WebFrameLoaderClient::dispatchDidFailProvisionalLoad): Ditto
(WebFrameLoaderClient::dispatchDidFailLoad): Ditto
(WebFrameLoaderClient::dispatchDecidePolicyForResponse): Ditto
(WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction): Ditto
(WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction): Ditto
(WebFrameLoaderClient::dispatchUnableToImplementPolicy): Ditto
(WebFrameLoaderClient::dispatchWillSendSubmitEvent): Ditto
(WebFrameLoaderClient::dispatchWillSubmitForm): Ditto
(WebFrameLoaderClient::startDownload): Ditto
(WebFrameLoaderClient::willChangeTitle): Ditto
(WebFrameLoaderClient::didChangeTitle): Ditto
(WebFrameLoaderClient::cancelledError): Ditto
(WebFrameLoaderClient::blockedError): Ditto
(WebFrameLoaderClient::cannotShowURLError): Ditto
(WebFrameLoaderClient::interruptedForPolicyChangeError): Ditto
(WebFrameLoaderClient::cannotShowMIMETypeError): Ditto
(WebFrameLoaderClient::fileDoesNotExistError): Ditto
(WebFrameLoaderClient::pluginWillHandleLoadError): Ditto
(WebFrameLoaderClient::shouldFallBack): Ditto
(WebFrameLoaderClient::canHandleRequest): Ditto
(WebFrameLoaderClient::canShowMIMEType): Ditto
(WebFrameLoaderClient::canShowMIMETypeAsHTML): Ditto
(WebFrameLoaderClient::representationExistsForURLScheme): Ditto
(WebFrameLoaderClient::generatedMIMETypeForURLScheme): Ditto
(WebFrameLoaderClient::frameLoadCompleted): Ditto
(WebFrameLoaderClient::saveViewStateToItem): Ditto
(WebFrameLoaderClient::restoreViewState): Ditto
(WebFrameLoaderClient::provisionalLoadStarted): Ditto
(WebFrameLoaderClient::didFinishLoad): Ditto
(WebFrameLoaderClient::prepareForDataSourceReplacement): Ditto
(WebFrameLoaderClient::userAgent): Ditto
(WebFrameLoaderClient::objectContentType): Ditto
(WebFrameLoaderClient::createJavaAppletWidget): Ditto
(WebFrameLoaderClient::overrideMediaType): Ditto
(WebFrameLoaderClient::documentElementAvailable): Ditto
(WebFrameLoaderClient::dispatchDidClearWindowObjectInWorld): Ditto
(WebFrameLoaderClient::registerForIconNotification): Ditto
(WebFrameLoaderClient::didPerformFirstNavigation): Ditto
(WebFrameLoaderClient::createNetworkingContext): Ditto
(WebFrameLoaderClient::shouldAlwaysUsePluginDocument): Ditto
(WebFrameLoaderClient::revertToProvisionalState): Ditto
(WebFrameLoaderClient::setMainFrameDocumentReady): Ditto
(WebFrameLoaderClient::cancelPolicyCheck): Ditto
(WebFrameLoaderClient::setUpPolicyListener): Ditto
(WebFrameLoaderClient::receivedPolicyDecision): Ditto
* WebCoreSupport/WebFrameLoaderClient.h:
(WebFrameLoaderClient::webFrame): Add accessor method
* WebDataSource.cpp:
(WebDataSource::representation): Loader client is now
a WebFrameLoaderClient (not a WebFrame).
(WebDataSource::webFrame): Ditto
* WebElementPropertyBag.cpp:
(WebElementPropertyBag::Read): Loader client is now
a WebFrameLoaderClient (not a WebFrame)
* WebFrame.cpp:
(kit): Revise for WebFrameLoaderClient use.
(WebFrame::WebFramePrivate::WebFramePrivate): Remove
WebFramePolicyListener and FramePolicyFunction, since
they are no longer needed here. They were moved to
the WebFrameLoaderClient object.
(WebFrame::WebFrame): No longer inheriting from
WebFramePolicyListener.
(WebFrame::init): Frame::create now needs to be supplied
with a new WebFramePolicyListener, rather than 'this'
* WebFrame.h:
* WebFramePolicyListener.cpp:
(WebFramePolicyListener::receivedPolicyDecision): Loader
client is now a WebFramePolicyClient, not a WebFrame.
2013-08-22 Andreas Kling <akling@apple.com>
Another Windows build fix.
......
/*
* Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
* Copyright (C) 2006, 2007, 2008, 2013 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -29,6 +29,7 @@
#ifndef WebFrameLoaderClient_h
#define WebFrameLoaderClient_h
#include <WebCore/COMPtr.h>
#include <WebCore/FrameLoaderClient.h>
namespace WebCore {
......@@ -36,95 +37,172 @@ namespace WebCore {
class PluginView;
}
template <typename T> class COMPtr;
class WebFrame;
class WebFramePolicyListener;
class WebHistory;
class WebFrameLoaderClient : public WebCore::FrameLoaderClient {
public:
WebFrameLoaderClient(WebFrame*);
~WebFrameLoaderClient();
WebFrame* webFrame() const { return m_webFrame; }
virtual bool hasWebView() const;
virtual void forceLayout();
virtual void forceLayout() OVERRIDE;
virtual PassRefPtr<WebCore::FrameNetworkingContext> createNetworkingContext();
virtual void frameLoaderDestroyed() OVERRIDE;
virtual void makeRepresentation(WebCore::DocumentLoader*) OVERRIDE;
virtual void forceLayoutForNonHTML() OVERRIDE;
virtual void setCopiesOnScroll() OVERRIDE;
virtual void detachedFromParent2() OVERRIDE;
virtual void detachedFromParent3() OVERRIDE;
virtual void convertMainResourceLoadToDownload(WebCore::DocumentLoader*, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&) OVERRIDE;
virtual void assignIdentifierToInitialRequest(unsigned long identifier, WebCore::DocumentLoader*, const WebCore::ResourceRequest&);
virtual void dispatchWillSendRequest(WebCore::DocumentLoader*, unsigned long identifier, WebCore::ResourceRequest&, const WebCore::ResourceResponse& redirectResponse);
virtual bool shouldUseCredentialStorage(WebCore::DocumentLoader*, unsigned long identifier);
virtual void dispatchDidReceiveAuthenticationChallenge(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::AuthenticationChallenge&);
virtual void dispatchDidCancelAuthenticationChallenge(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::AuthenticationChallenge&);
virtual void dispatchDidReceiveResponse(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ResourceResponse&);
virtual void dispatchDidReceiveContentLength(WebCore::DocumentLoader*, unsigned long identifier, int dataLength);
virtual void dispatchDidFinishLoading(WebCore::DocumentLoader*, unsigned long identifier);
virtual void dispatchDidFailLoading(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ResourceError&);
virtual void dispatchWillSendRequest(WebCore::DocumentLoader*, unsigned long identifier, WebCore::ResourceRequest&, const WebCore::ResourceResponse& redirectResponse) OVERRIDE;
virtual bool shouldUseCredentialStorage(WebCore::DocumentLoader*, unsigned long identifier) OVERRIDE;
virtual void dispatchDidReceiveAuthenticationChallenge(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::AuthenticationChallenge&) OVERRIDE;
virtual void dispatchDidCancelAuthenticationChallenge(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::AuthenticationChallenge&) OVERRIDE;
virtual void dispatchDidReceiveResponse(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ResourceResponse&) OVERRIDE;
virtual void dispatchDidReceiveContentLength(WebCore::DocumentLoader*, unsigned long identifier, int dataLength) OVERRIDE;
virtual void dispatchDidFinishLoading(WebCore::DocumentLoader*, unsigned long identifier) OVERRIDE;
virtual void dispatchDidFailLoading(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ResourceError&) OVERRIDE;
virtual bool shouldCacheResponse(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ResourceResponse&, const unsigned char* data, unsigned long long length);
virtual void dispatchDidHandleOnloadEvents();
virtual void dispatchDidReceiveServerRedirectForProvisionalLoad();
virtual void dispatchDidCancelClientRedirect();
virtual void dispatchWillPerformClientRedirect(const WebCore::KURL&, double interval, double fireDate);
virtual void dispatchDidChangeLocationWithinPage();
virtual void dispatchDidPushStateWithinPage();
virtual void dispatchDidReplaceStateWithinPage();
virtual void dispatchDidPopStateWithinPage();
virtual void dispatchWillClose();
virtual void dispatchDidReceiveIcon();
virtual void dispatchDidStartProvisionalLoad();
virtual void dispatchDidReceiveTitle(const WebCore::StringWithDirection&);
virtual void dispatchDidChangeIcons(WebCore::IconType);
virtual void dispatchDidCommitLoad();
virtual void dispatchDidFinishDocumentLoad();
virtual void dispatchDidFinishLoad();
virtual void dispatchDidLayout(WebCore::LayoutMilestones);
virtual WebCore::Frame* dispatchCreatePage(const WebCore::NavigationAction&);
virtual void dispatchShow();
virtual void setMainDocumentError(WebCore::DocumentLoader*, const WebCore::ResourceError&);
virtual void dispatchDidHandleOnloadEvents() OVERRIDE;
virtual void dispatchDidReceiveServerRedirectForProvisionalLoad() OVERRIDE;
virtual void dispatchDidCancelClientRedirect() OVERRIDE;
virtual void dispatchWillPerformClientRedirect(const WebCore::KURL&, double interval, double fireDate) OVERRIDE;
virtual void dispatchDidChangeLocationWithinPage() OVERRIDE;
virtual void dispatchDidPushStateWithinPage() OVERRIDE;
virtual void dispatchDidReplaceStateWithinPage() OVERRIDE;
virtual void dispatchDidPopStateWithinPage() OVERRIDE;
virtual void dispatchWillClose() OVERRIDE;
virtual void dispatchDidReceiveIcon() OVERRIDE;
virtual void dispatchDidStartProvisionalLoad() OVERRIDE;
virtual void dispatchDidReceiveTitle(const WebCore::StringWithDirection&) OVERRIDE;
virtual void dispatchDidChangeIcons(WebCore::IconType) OVERRIDE;
virtual void dispatchDidCommitLoad() OVERRIDE;
virtual void dispatchDidFailProvisionalLoad(const WebCore::ResourceError&) OVERRIDE;
virtual void dispatchDidFailLoad(const WebCore::ResourceError&) OVERRIDE;
virtual void dispatchDidFinishDocumentLoad() OVERRIDE;
virtual void dispatchDidFinishLoad() OVERRIDE;
virtual void dispatchDidLayout(WebCore::LayoutMilestones) OVERRIDE;
virtual void dispatchDecidePolicyForResponse(WebCore::FramePolicyFunction, const WebCore::ResourceResponse&, const WebCore::ResourceRequest&);
virtual void dispatchDecidePolicyForNewWindowAction(WebCore::FramePolicyFunction, const WebCore::NavigationAction&, const WebCore::ResourceRequest&, PassRefPtr<WebCore::FormState>, const WTF::String& frameName) OVERRIDE;
virtual void dispatchDecidePolicyForNavigationAction(WebCore::FramePolicyFunction, const WebCore::NavigationAction&, const WebCore::ResourceRequest&, PassRefPtr<WebCore::FormState>) OVERRIDE;
virtual void cancelPolicyCheck() OVERRIDE;
virtual void dispatchUnableToImplementPolicy(const WebCore::ResourceError&) OVERRIDE;
virtual void dispatchWillSendSubmitEvent(PassRefPtr<WebCore::FormState>) OVERRIDE;
virtual void dispatchWillSubmitForm(WebCore::FramePolicyFunction, PassRefPtr<WebCore::FormState>) OVERRIDE;
virtual void revertToProvisionalState(WebCore::DocumentLoader*) OVERRIDE;
virtual bool dispatchDidLoadResourceFromMemoryCache(WebCore::DocumentLoader*, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&, int length) OVERRIDE;
virtual WebCore::Frame* dispatchCreatePage(const WebCore::NavigationAction&) OVERRIDE;
virtual void dispatchShow() OVERRIDE;
virtual void setMainDocumentError(WebCore::DocumentLoader*, const WebCore::ResourceError&) OVERRIDE;
virtual void setMainFrameDocumentReady(bool) OVERRIDE;
virtual void startDownload(const WebCore::ResourceRequest&, const String& suggestedName = String()) OVERRIDE;
virtual void postProgressStartedNotification();
virtual void postProgressEstimateChangedNotification();
virtual void postProgressFinishedNotification();
virtual void committedLoad(WebCore::DocumentLoader*, const char*, int);
virtual void finishedLoading(WebCore::DocumentLoader*);
virtual void committedLoad(WebCore::DocumentLoader*, const char*, int) OVERRIDE;
virtual void finishedLoading(WebCore::DocumentLoader*) OVERRIDE;
virtual void willChangeTitle(WebCore::DocumentLoader*) OVERRIDE;
virtual void didChangeTitle(WebCore::DocumentLoader*) OVERRIDE;
virtual void updateGlobalHistory() OVERRIDE;
virtual void updateGlobalHistoryRedirectLinks() OVERRIDE;
virtual bool shouldGoToHistoryItem(WebCore::HistoryItem*) const OVERRIDE;
virtual bool shouldStopLoadingForHistoryItem(WebCore::HistoryItem*) const OVERRIDE;
virtual void updateGlobalHistoryItemForPage() OVERRIDE;
virtual void didDisplayInsecureContent() OVERRIDE;
virtual void didRunInsecureContent(WebCore::SecurityOrigin*, const WebCore::KURL&) OVERRIDE;
virtual void didDetectXSS(const WebCore::KURL&, bool didBlockEntirePage) OVERRIDE;
virtual void updateGlobalHistory();
virtual void updateGlobalHistoryRedirectLinks();
virtual bool shouldGoToHistoryItem(WebCore::HistoryItem*) const;
virtual bool shouldStopLoadingForHistoryItem(WebCore::HistoryItem*) const;
virtual void updateGlobalHistoryItemForPage();
virtual WebCore::ResourceError cancelledError(const WebCore::ResourceRequest&) OVERRIDE;
virtual WebCore::ResourceError blockedError(const WebCore::ResourceRequest&) OVERRIDE;
virtual WebCore::ResourceError cannotShowURLError(const WebCore::ResourceRequest&) OVERRIDE;
virtual WebCore::ResourceError interruptedForPolicyChangeError(const WebCore::ResourceRequest&) OVERRIDE;
virtual WebCore::ResourceError cannotShowMIMETypeError(const WebCore::ResourceResponse&) OVERRIDE;
virtual WebCore::ResourceError fileDoesNotExistError(const WebCore::ResourceResponse&) OVERRIDE;
virtual WebCore::ResourceError pluginWillHandleLoadError(const WebCore::ResourceResponse&) OVERRIDE;
virtual void didDisplayInsecureContent();
virtual void didRunInsecureContent(WebCore::SecurityOrigin*, const WebCore::KURL&);
virtual void didDetectXSS(const WebCore::KURL&, bool didBlockEntirePage);
virtual bool shouldFallBack(const WebCore::ResourceError&) OVERRIDE;
virtual WTF::String userAgent(const WebCore::KURL&) OVERRIDE;
virtual PassRefPtr<WebCore::DocumentLoader> createDocumentLoader(const WebCore::ResourceRequest&, const WebCore::SubstituteData&);
virtual void setTitle(const WebCore::StringWithDirection&, const WebCore::KURL&);
virtual void savePlatformDataToCachedFrame(WebCore::CachedFrame*);
virtual void transitionToCommittedFromCachedFrame(WebCore::CachedFrame*);
virtual void transitionToCommittedForNewPage();
virtual void savePlatformDataToCachedFrame(WebCore::CachedFrame*) OVERRIDE;
virtual void transitionToCommittedFromCachedFrame(WebCore::CachedFrame*) OVERRIDE;
virtual void transitionToCommittedForNewPage() OVERRIDE;
virtual bool canHandleRequest(const WebCore::ResourceRequest&) const OVERRIDE;
virtual bool canShowMIMEType(const WTF::String& MIMEType) const OVERRIDE;
virtual bool canShowMIMETypeAsHTML(const WTF::String& MIMEType) const OVERRIDE;
virtual bool representationExistsForURLScheme(const WTF::String& URLScheme) const OVERRIDE;
virtual WTF::String generatedMIMETypeForURLScheme(const WTF::String& URLScheme) const OVERRIDE;
virtual void frameLoadCompleted() OVERRIDE;
virtual void saveViewStateToItem(WebCore::HistoryItem *) OVERRIDE;
virtual void restoreViewState() OVERRIDE;
virtual void provisionalLoadStarted() OVERRIDE;
virtual void didFinishLoad() OVERRIDE;
virtual void prepareForDataSourceReplacement() OVERRIDE;
virtual void didSaveToPageCache();
virtual void didRestoreFromPageCache();
virtual void didSaveToPageCache() OVERRIDE;
virtual void didRestoreFromPageCache() OVERRIDE;
virtual void dispatchDidBecomeFrameset(bool);
virtual void dispatchDidBecomeFrameset(bool) OVERRIDE;
virtual bool canCachePage() const;
virtual PassRefPtr<WebCore::Frame> createFrame(const WebCore::KURL& url, const WTF::String& name, WebCore::HTMLFrameOwnerElement* ownerElement,
const WTF::String& referrer, bool allowsScrolling, int marginWidth, int marginHeight);
virtual PassRefPtr<WebCore::Widget> createPlugin(const WebCore::IntSize&, WebCore::HTMLPlugInElement*, const WebCore::KURL&, const Vector<WTF::String>&, const Vector<WTF::String>&, const WTF::String&, bool loadManually);
virtual void recreatePlugin(WebCore::Widget*) { }
virtual void redirectDataToPlugin(WebCore::Widget* pluginWidget);
const WTF::String& referrer, bool allowsScrolling, int marginWidth, int marginHeight) OVERRIDE;
virtual PassRefPtr<WebCore::Widget> createPlugin(const WebCore::IntSize&, WebCore::HTMLPlugInElement*, const WebCore::KURL&, const Vector<WTF::String>&, const Vector<WTF::String>&, const WTF::String&, bool loadManually) OVERRIDE;
virtual void recreatePlugin(WebCore::Widget*) OVERRIDE { }
virtual void redirectDataToPlugin(WebCore::Widget* pluginWidget) OVERRIDE;
virtual PassRefPtr<WebCore::Widget> createJavaAppletWidget(const WebCore::IntSize&, WebCore::HTMLAppletElement*, const WebCore::KURL& baseURL, const Vector<WTF::String>& paramNames, const Vector<WTF::String>& paramValues) OVERRIDE;
virtual WebCore::ObjectContentType objectContentType(const WebCore::KURL&, const WTF::String& mimeType, bool shouldPreferPlugInsForImages) OVERRIDE;
virtual WTF::String overrideMediaType() const OVERRIDE;
virtual void dispatchDidClearWindowObjectInWorld(WebCore::DOMWrapperWorld*) OVERRIDE;
virtual void documentElementAvailable() OVERRIDE;
virtual void didPerformFirstNavigation() const OVERRIDE;
COMPtr<WebFramePolicyListener> setUpPolicyListener(WebCore::FramePolicyFunction);
void receivedPolicyDecision(WebCore::PolicyAction);
virtual void registerForIconNotification(bool listen) OVERRIDE;
virtual bool shouldAlwaysUsePluginDocument(const WTF::String& mimeType) const;
virtual void dispatchDidFailToStartPlugin(const WebCore::PluginView*) const;
protected:
WebFrameLoaderClient(WebFrame*);
~WebFrameLoaderClient();
class WebFramePolicyListenerPrivate;
OwnPtr<WebFramePolicyListenerPrivate> m_policyListenerPrivate;
private:
PassRefPtr<WebCore::Frame> createFrame(const WebCore::KURL&, const WTF::String& name, WebCore::HTMLFrameOwnerElement*, const WTF::String& referrer);
......
/*
* Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
* Copyright (C) 2006, 2007, 2013 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -32,6 +32,7 @@
#include "WebDocumentLoader.h"
#include "WebError.h"
#include "WebFrame.h"
#include "WebFrameLoaderClient.h"
#include "WebKit.h"
#include "WebHTMLRepresentation.h"
#include "WebKitStatisticsPrivate.h"
......@@ -184,12 +185,11 @@ HRESULT STDMETHODCALLTYPE WebDataSource::data(
return MemoryStream::createInstance(buffer ? buffer->sharedBuffer() : 0).copyRefTo(stream);
}
HRESULT STDMETHODCALLTYPE WebDataSource::representation(
/* [retval][out] */ IWebDocumentRepresentation** rep)
HRESULT WebDataSource::representation(/* [retval][out] */ IWebDocumentRepresentation** rep)
{
HRESULT hr = S_OK;
if (!m_representation) {
WebHTMLRepresentation* htmlRep = WebHTMLRepresentation::createInstance(static_cast<WebFrame*>(&m_loader->frameLoader()->client()));
WebHTMLRepresentation* htmlRep = WebHTMLRepresentation::createInstance(static_cast<WebFrameLoaderClient&>(m_loader->frameLoader()->client()).webFrame());
hr = htmlRep->QueryInterface(IID_IWebDocumentRepresentation, (void**) &m_representation);
htmlRep->Release();
}
......@@ -197,10 +197,9 @@ HRESULT STDMETHODCALLTYPE WebDataSource::representation(
return m_representation.copyRefTo(rep);
}
HRESULT STDMETHODCALLTYPE WebDataSource::webFrame(
/* [retval][out] */ IWebFrame** frame)
HRESULT WebDataSource::webFrame(/* [retval][out] */ IWebFrame** frame)
{
*frame = static_cast<WebFrame*>(&m_loader->frameLoader()->client());
*frame = static_cast<WebFrameLoaderClient&>(m_loader->frameLoader()->client()).webFrame();
(*frame)->AddRef();
return S_OK;
}
......
/*
* Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
* Copyright (C) 2006, 2007, 2013 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -30,6 +30,7 @@
#include "MarshallingHelpers.h"
#include "DOMCoreClasses.h"
#include "WebFrame.h"
#include "WebFrameLoaderClient.h"
#include <WebCore/Document.h>
#include <WebCore/Frame.h>
#include <WebCore/HitTestResult.h>
......@@ -109,7 +110,7 @@ static HRESULT convertStringToVariant(VARIANT* pVar, const String& string)
}
HRESULT STDMETHODCALLTYPE WebElementPropertyBag::Read(LPCOLESTR pszPropName, VARIANT *pVar, IErrorLog * /*pErrorLog*/)
HRESULT WebElementPropertyBag::Read(LPCOLESTR pszPropName, VARIANT *pVar, IErrorLog * /*pErrorLog*/)
{
if (!pszPropName)
return E_POINTER;
......@@ -129,7 +130,7 @@ HRESULT STDMETHODCALLTYPE WebElementPropertyBag::Read(LPCOLESTR pszPropName, VAR
&& m_result->innerNonSharedNode()->document()->frame()))
return E_FAIL;
Frame* coreFrame = m_result->innerNonSharedNode()->document()->frame();
WebFrame* webFrame = static_cast<WebFrame*>(&coreFrame->loader().client());
WebFrame* webFrame = static_cast<WebFrameLoaderClient&>(coreFrame->loader().client()).webFrame();
IWebFrame* iWebFrame;
if (FAILED(webFrame->QueryInterface(IID_IWebFrame, (void**)&iWebFrame)))
return E_FAIL;
......
......@@ -31,7 +31,6 @@
#include "CFDictionaryPropertyBag.h"
#include "COMPropertyBag.h"
#include "DOMCoreClasses.h"
#include "DefaultPolicyDelegate.h"
#include "HTMLFrameOwnerElement.h"
#include "MarshallingHelpers.h"
#include "WebActionPropertyBag.h"
......@@ -41,7 +40,7 @@
#include "WebDownload.h"
#include "WebEditorClient.h"
#include "WebError.h"
#include "WebFrameNetworkingContext.h"
#include "WebFrameLoaderClient.h"
#include "WebFramePolicyListener.h"
#include "WebHistory.h"
#include "WebHistoryItem.h"
......@@ -156,7 +155,7 @@ WebFrame* kit(Frame* frame)
// FIXME: Doesn't this need to be aware of EmptyFrameLoaderClient?
FrameLoaderClient& frameLoaderClient = frame->loader().client();
return static_cast<WebFrame*>(&frameLoaderClient);
return static_cast<WebFrameLoaderClient&>(frameLoaderClient).webFrame();
}
Frame* core(WebFrame* webFrame)
......@@ -233,8 +232,7 @@ public:
WebFramePrivate()
: frame(0)
, webView(0)
, m_policyFunction(0)
{
{
}
~WebFramePrivate() { }
......@@ -242,15 +240,12 @@ public:
Frame* frame;
WebView* webView;
FramePolicyFunction m_policyFunction;
COMPtr<WebFramePolicyListener> m_policyListener;
};
// WebFrame ----------------------------------------------------------------
WebFrame::WebFrame()
: WebFrameLoaderClient(this)
, m_refCount(0)
: m_refCount(0)
, d(new WebFrame::WebFramePrivate)
, m_quickRedirectComing(false)
, m_inPrintingMode(false)
......@@ -1085,7 +1080,7 @@ PassRefPtr<Frame> WebFrame::init(IWebView* webView, Page* page, HTMLFrameOwnerEl
d->webView->viewWindow((OLE_HANDLE*)&viewWindow);
this->AddRef(); // We release this ref in frameLoaderDestroyed()
RefPtr<Frame> frame = Frame::create(page, ownerElement, this);
RefPtr<Frame> frame = Frame::create(page, ownerElement, new WebFrameLoaderClient(this));
d->frame = frame.get();
return frame.release();
}
......@@ -1466,461 +1461,6 @@ void WebFrame::frameLoaderDestroyed()
this->Release();
}
void WebFrame::makeRepresentation(DocumentLoader*)
{
notImplemented();
}
void WebFrame::forceLayoutForNonHTML()
{
notImplemented();
}
void WebFrame::setCopiesOnScroll()
{
notImplemented();
}
void WebFrame::detachedFromParent2()
{
notImplemented();
}
void WebFrame::detachedFromParent3()
{
notImplemented();
}
void WebFrame::cancelPolicyCheck()
{
if (d->m_policyListener) {
d->m_policyListener->invalidate();
d->m_policyListener = 0;
}
d->m_policyFunction = 0;
}
void WebFrame::dispatchWillSendSubmitEvent(PassRefPtr<WebCore::FormState>)
{
}
void WebFrame::dispatchWillSubmitForm(FramePolicyFunction function, PassRefPtr<FormState> formState)
{
Frame* coreFrame = core(this);
ASSERT(coreFrame);
COMPtr<IWebFormDelegate> formDelegate;
if (FAILED(d->webView->formDelegate(&formDelegate))) {
(coreFrame->loader().policyChecker()->*function)(PolicyUse);
return;
}
COMPtr<IDOMElement> formElement(AdoptCOM, DOMElement::createInstance(formState->form()));
HashMap<String, String> formValuesMap;
const StringPairVector& textFieldValues = formState->textFieldValues();
size_t size = textFieldValues.size();
for (size_t i = 0; i < size; ++i)
formValuesMap.add(textFieldValues[i].first, textFieldValues[i].second);
COMPtr<IPropertyBag> formValuesPropertyBag(AdoptCOM, COMPropertyBag<String>::createInstance(formValuesMap));
COMPtr<WebFrame> sourceFrame(kit(formState->sourceDocument()->frame()));
if (SUCCEEDED(formDelegate->willSubmitForm(this, sourceFrame.get(), formElement.get(), formValuesPropertyBag.get(), setUpPolicyListener(function).get())))
return;
// FIXME: Add a sane default implementation
(coreFrame->loader().policyChecker()->*function)(PolicyUse);
}
void WebFrame::revertToProvisionalState(DocumentLoader*)
{
notImplemented();
}
void WebFrame::setMainFrameDocumentReady(bool)
{
notImplemented();
}
void WebFrame::willChangeTitle(DocumentLoader*)
{
notImplemented();
}
void WebFrame::didChangeTitle(DocumentLoader*)
{
notImplemented();
}
void WebFrame::didChangeIcons(DocumentLoader*)
{
notImplemented();
}
bool WebFrame::canHandleRequest(const ResourceRequest& request) const
{
return WebView::canHandleRequest(request);
}
bool WebFrame::canShowMIMETypeAsHTML(const String& /*MIMEType*/) const
{
notImplemented();
return true;
}
bool WebFrame::canShowMIMEType(const String& /*MIMEType*/) const
{
notImplemented();
return true;
}
bool WebFrame::representationExistsForURLScheme(const String& /*URLScheme*/) const
{
notImplemented();
return false;
}
String WebFrame::generatedMIMETypeForURLScheme(const String& /*URLScheme*/) const
{
notImplemented();
ASSERT_NOT_REACHED();
return String();
}
void WebFrame::frameLoadCompleted()
{
}
void WebFrame::restoreViewState()