123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271 |
- /*
- * Copyright (C) 2006 Zack Rusin <zack@kde.org>
- * Copyright (C) 2006, 2011 Apple Inc. All rights reserved.
- * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
- * Copyright (C) 2008 Collabora Ltd. All rights reserved.
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * 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 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.
- */
- #ifndef FrameLoaderClientQt_h
- #define FrameLoaderClientQt_h
- #include "FormState.h"
- #include "Frame.h"
- #include "FrameLoader.h"
- #include "FrameLoaderClient.h"
- #include "HTMLFormElement.h"
- #include "KURL.h"
- #include "ResourceError.h"
- #include "ResourceResponse.h"
- #include "WebCore/plugins/PluginView.h"
- #include <QUrl>
- #include <qobject.h>
- #include <wtf/Forward.h>
- #include <wtf/OwnPtr.h>
- #include <wtf/RefCounted.h>
- QT_BEGIN_NAMESPACE
- class QNetworkReply;
- QT_END_NAMESPACE
- class QWebFrame;
- class QWebFrameAdapter;
- namespace WebCore {
- class AuthenticationChallenge;
- class DocumentLoader;
- class Element;
- class FormState;
- class NavigationAction;
- class FrameNetworkingContext;
- class ResourceLoader;
- struct LoadErrorResetToken;
- class FrameLoaderClientQt : public QObject, public FrameLoaderClient {
- Q_OBJECT
- friend class ::QWebFrameAdapter;
- void callPolicyFunction(FramePolicyFunction, PolicyAction);
- bool callErrorPageExtension(const ResourceError&);
- Q_SIGNALS:
- void loadProgress(int d);
- void titleChanged(const QString& title);
- void unsupportedContent(QNetworkReply*);
- public:
- FrameLoaderClientQt();
- ~FrameLoaderClientQt();
- virtual void frameLoaderDestroyed();
- void setFrame(QWebFrameAdapter*, Frame*);
- virtual bool hasWebView() const; // mainly for assertions
- virtual void makeRepresentation(DocumentLoader*) { }
- virtual void forceLayout();
- virtual void forceLayoutForNonHTML();
- virtual void setCopiesOnScroll();
- virtual void detachedFromParent2();
- virtual void detachedFromParent3();
- virtual void assignIdentifierToInitialRequest(unsigned long identifier, WebCore::DocumentLoader*, const WebCore::ResourceRequest&);
- virtual void dispatchWillSendRequest(WebCore::DocumentLoader*, unsigned long, WebCore::ResourceRequest&, const WebCore::ResourceResponse&);
- virtual bool shouldUseCredentialStorage(DocumentLoader*, unsigned long identifier);
- virtual void dispatchDidReceiveAuthenticationChallenge(DocumentLoader*, unsigned long identifier, const AuthenticationChallenge&);
- virtual void dispatchDidCancelAuthenticationChallenge(DocumentLoader*, unsigned long identifier, const AuthenticationChallenge&);
- virtual void dispatchDidReceiveResponse(WebCore::DocumentLoader*, unsigned long, const WebCore::ResourceResponse&);
- virtual void dispatchDidReceiveContentLength(WebCore::DocumentLoader*, unsigned long, int);
- virtual void dispatchDidFinishLoading(WebCore::DocumentLoader*, unsigned long);
- virtual void dispatchDidFailLoading(WebCore::DocumentLoader*, unsigned long, const WebCore::ResourceError&);
- virtual bool dispatchDidLoadResourceFromMemoryCache(WebCore::DocumentLoader*, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&, int);
- virtual void dispatchDidHandleOnloadEvents();
- virtual void dispatchDidReceiveServerRedirectForProvisionalLoad();
- virtual void dispatchDidCancelClientRedirect();
- virtual void dispatchWillPerformClientRedirect(const KURL&, double interval, double fireDate);
- virtual void dispatchDidNavigateWithinPage() OVERRIDE;
- 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 StringWithDirection&);
- virtual void dispatchDidChangeIcons(WebCore::IconType);
- virtual void dispatchDidCommitLoad();
- virtual void dispatchDidFailProvisionalLoad(const ResourceError&);
- virtual void dispatchDidFailLoad(const WebCore::ResourceError&);
- virtual void dispatchDidFinishDocumentLoad();
- virtual void dispatchDidFinishLoad();
- virtual void dispatchDidLayout(WebCore::LayoutMilestones);
- virtual WebCore::Frame* dispatchCreatePage(const WebCore::NavigationAction&);
- virtual void dispatchShow();
- virtual void dispatchDecidePolicyForResponse(FramePolicyFunction, const WebCore::ResourceResponse&, const WebCore::ResourceRequest&);
- virtual void dispatchDecidePolicyForNewWindowAction(FramePolicyFunction, const WebCore::NavigationAction&, const WebCore::ResourceRequest&, PassRefPtr<FormState>, const WTF::String&);
- virtual void dispatchDecidePolicyForNavigationAction(FramePolicyFunction, const WebCore::NavigationAction&, const WebCore::ResourceRequest&, PassRefPtr<FormState>);
- virtual void cancelPolicyCheck();
- virtual void dispatchUnableToImplementPolicy(const WebCore::ResourceError&);
- virtual void dispatchWillSendSubmitEvent(PassRefPtr<FormState>) { }
- virtual void dispatchWillSubmitForm(FramePolicyFunction, PassRefPtr<FormState>);
- virtual void revertToProvisionalState(DocumentLoader*) { }
- virtual void setMainDocumentError(DocumentLoader*, const ResourceError&);
- virtual void postProgressStartedNotification();
- virtual void postProgressEstimateChangedNotification();
- virtual void postProgressFinishedNotification();
- virtual void setMainFrameDocumentReady(bool);
- virtual void startDownload(const WebCore::ResourceRequest&, const String& suggestedName = String());
- virtual void willChangeTitle(DocumentLoader*);
- virtual void didChangeTitle(DocumentLoader*);
- virtual void committedLoad(WebCore::DocumentLoader*, const char*, int);
- virtual void finishedLoading(DocumentLoader*);
- virtual void updateGlobalHistory();
- virtual void updateGlobalHistoryRedirectLinks();
- virtual bool shouldGoToHistoryItem(HistoryItem*) const;
- virtual bool shouldStopLoadingForHistoryItem(HistoryItem*) const;
- virtual void didDisplayInsecureContent();
- virtual void didRunInsecureContent(SecurityOrigin*, const KURL&);
- virtual void didDetectXSS(const KURL&, bool didBlockEntirePage);
- virtual ResourceError cancelledError(const ResourceRequest&);
- virtual ResourceError blockedError(const ResourceRequest&);
- virtual ResourceError cannotShowURLError(const ResourceRequest&);
- virtual ResourceError interruptedForPolicyChangeError(const ResourceRequest&);
- virtual ResourceError cannotShowMIMETypeError(const ResourceResponse&);
- virtual ResourceError fileDoesNotExistError(const ResourceResponse&);
- virtual ResourceError pluginWillHandleLoadError(const ResourceResponse&);
- virtual bool shouldFallBack(const ResourceError&);
- virtual bool canHandleRequest(const WebCore::ResourceRequest&) const;
- virtual bool canShowMIMEType(const String& MIMEType) const;
- virtual bool canShowMIMETypeAsHTML(const String& MIMEType) const;
- virtual bool representationExistsForURLScheme(const String& URLScheme) const;
- virtual String generatedMIMETypeForURLScheme(const String& URLScheme) const;
- virtual void frameLoadCompleted();
- virtual void saveViewStateToItem(WebCore::HistoryItem*);
- virtual void restoreViewState();
- virtual void provisionalLoadStarted();
- virtual void didFinishLoad();
- virtual void prepareForDataSourceReplacement();
- virtual WTF::PassRefPtr<WebCore::DocumentLoader> createDocumentLoader(const WebCore::ResourceRequest&, const WebCore::SubstituteData&);
- virtual void setTitle(const StringWithDirection&, const KURL&);
- virtual String userAgent(const WebCore::KURL&);
- virtual void savePlatformDataToCachedFrame(WebCore::CachedFrame*);
- virtual void transitionToCommittedFromCachedFrame(WebCore::CachedFrame*);
- virtual void transitionToCommittedForNewPage();
- virtual void didSaveToPageCache();
- virtual void didRestoreFromPageCache();
- virtual void dispatchDidBecomeFrameset(bool);
- virtual bool canCachePage() const;
- virtual void convertMainResourceLoadToDownload(WebCore::DocumentLoader*, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&);
- virtual PassRefPtr<Frame> createFrame(const KURL&, const String& name, HTMLFrameOwnerElement*, const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight);
- virtual PassRefPtr<Widget> createPlugin(const IntSize&, HTMLPlugInElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool);
- virtual void recreatePlugin(Widget*) { }
- virtual void redirectDataToPlugin(Widget* pluginWidget);
- virtual PassRefPtr<Widget> createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL& baseURL, const Vector<String>& paramNames, const Vector<String>& paramValues);
- virtual ObjectContentType objectContentType(const KURL&, const String& mimeTypeIn, bool shouldPreferPlugInsForImages);
- virtual String overrideMediaType() const;
- virtual void dispatchDidClearWindowObjectInWorld(DOMWrapperWorld*);
- virtual void documentElementAvailable();
- virtual void didPerformFirstNavigation() const;
- virtual void registerForIconNotification(bool);
- QString chooseFile(const QString& oldFile);
- virtual PassRefPtr<FrameNetworkingContext> createNetworkingContext();
- const KURL& lastRequestedUrl() const { return m_lastRequestedUrl; }
- QWebFrameAdapter* webFrame() const;
- static bool dumpFrameLoaderCallbacks;
- static bool dumpProgressFinishedCallback;
- static bool dumpUserGestureInFrameLoaderCallbacks;
- static bool dumpResourceLoadCallbacks;
- static bool dumpResourceResponseMIMETypes;
- static bool dumpWillCacheResponseCallbacks;
- static QString dumpResourceLoadCallbacksPath;
- static bool sendRequestReturnsNullOnRedirect;
- static bool sendRequestReturnsNull;
- static QStringList sendRequestClearHeaders;
- static bool policyDelegateEnabled;
- static bool policyDelegatePermissive;
- static bool deferMainResourceDataLoad;
- static bool dumpHistoryCallbacks;
- static QMap<QString, QString> URLsToRedirect;
- private Q_SLOTS:
- void onIconLoadedForPageURL(const QString&);
- private:
- void emitLoadStarted();
- void emitLoadFinished(bool ok);
- Frame *m_frame;
- QWebFrameAdapter *m_webFrame;
- ResourceResponse m_response;
- // Plugin view to redirect data to
- WebCore::PluginView* m_pluginView;
- bool m_hasSentResponseToPlugin;
- KURL m_lastRequestedUrl;
- bool m_isOriginatingLoad;
- };
- }
- #endif
|