| 1 | /* |
|---|
| 2 | * Copyright (C) 2006 Zack Rusin <zack@kde.org> |
|---|
| 3 | * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. |
|---|
| 4 | * Copyright (C) 2008 Collabora Ltd. All rights reserved. |
|---|
| 5 | * |
|---|
| 6 | * All rights reserved. |
|---|
| 7 | * |
|---|
| 8 | * Redistribution and use in source and binary forms, with or without |
|---|
| 9 | * modification, are permitted provided that the following conditions |
|---|
| 10 | * are met: |
|---|
| 11 | * 1. Redistributions of source code must retain the above copyright |
|---|
| 12 | * notice, this list of conditions and the following disclaimer. |
|---|
| 13 | * 2. Redistributions in binary form must reproduce the above copyright |
|---|
| 14 | * notice, this list of conditions and the following disclaimer in the |
|---|
| 15 | * documentation and/or other materials provided with the distribution. |
|---|
| 16 | * |
|---|
| 17 | * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY |
|---|
| 18 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
|---|
| 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|---|
| 20 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR |
|---|
| 21 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
|---|
| 22 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
|---|
| 23 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
|---|
| 24 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
|---|
| 25 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|---|
| 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
|---|
| 27 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|---|
| 28 | */ |
|---|
| 29 | |
|---|
| 30 | #ifndef FrameLoaderClientGtk_h |
|---|
| 31 | #define FrameLoaderClientGtk_h |
|---|
| 32 | |
|---|
| 33 | #include "FrameLoaderClient.h" |
|---|
| 34 | #include "ResourceResponse.h" |
|---|
| 35 | #include "PluginView.h" |
|---|
| 36 | |
|---|
| 37 | typedef struct _WebKitWebFrame WebKitWebFrame; |
|---|
| 38 | |
|---|
| 39 | namespace WebKit { |
|---|
| 40 | |
|---|
| 41 | class FrameLoaderClient : public WebCore::FrameLoaderClient { |
|---|
| 42 | public: |
|---|
| 43 | FrameLoaderClient(WebKitWebFrame*); |
|---|
| 44 | virtual ~FrameLoaderClient() { } |
|---|
| 45 | virtual void frameLoaderDestroyed(); |
|---|
| 46 | |
|---|
| 47 | WebKitWebFrame* webFrame() const { return m_frame; } |
|---|
| 48 | |
|---|
| 49 | virtual bool hasWebView() const; |
|---|
| 50 | |
|---|
| 51 | virtual void makeRepresentation(WebCore::DocumentLoader*); |
|---|
| 52 | virtual void forceLayout(); |
|---|
| 53 | virtual void forceLayoutForNonHTML(); |
|---|
| 54 | |
|---|
| 55 | virtual void setCopiesOnScroll(); |
|---|
| 56 | |
|---|
| 57 | virtual void detachedFromParent2(); |
|---|
| 58 | virtual void detachedFromParent3(); |
|---|
| 59 | |
|---|
| 60 | virtual void loadedFromCachedPage(); |
|---|
| 61 | |
|---|
| 62 | virtual void assignIdentifierToInitialRequest(unsigned long identifier, WebCore::DocumentLoader*, const WebCore::ResourceRequest&); |
|---|
| 63 | |
|---|
| 64 | virtual void dispatchWillSendRequest(WebCore::DocumentLoader*, unsigned long identifier, WebCore::ResourceRequest&, const WebCore::ResourceResponse& redirectResponse); |
|---|
| 65 | virtual void dispatchDidReceiveAuthenticationChallenge(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::AuthenticationChallenge&); |
|---|
| 66 | virtual void dispatchDidCancelAuthenticationChallenge(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::AuthenticationChallenge&); |
|---|
| 67 | virtual void dispatchDidReceiveResponse(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ResourceResponse&); |
|---|
| 68 | virtual void dispatchDidReceiveContentLength(WebCore::DocumentLoader*, unsigned long identifier, int lengthReceived); |
|---|
| 69 | virtual void dispatchDidFinishLoading(WebCore::DocumentLoader*, unsigned long identifier); |
|---|
| 70 | virtual void dispatchDidFailLoading(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ResourceError&); |
|---|
| 71 | virtual bool dispatchDidLoadResourceFromMemoryCache(WebCore::DocumentLoader*, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&, int length); |
|---|
| 72 | |
|---|
| 73 | virtual void dispatchDidHandleOnloadEvents(); |
|---|
| 74 | virtual void dispatchDidReceiveServerRedirectForProvisionalLoad(); |
|---|
| 75 | virtual void dispatchDidCancelClientRedirect(); |
|---|
| 76 | virtual void dispatchWillPerformClientRedirect(const WebCore::KURL&, double, double); |
|---|
| 77 | virtual void dispatchDidChangeLocationWithinPage(); |
|---|
| 78 | virtual void dispatchWillClose(); |
|---|
| 79 | virtual void dispatchDidReceiveIcon(); |
|---|
| 80 | virtual void dispatchDidStartProvisionalLoad(); |
|---|
| 81 | virtual void dispatchDidReceiveTitle(const WebCore::String&); |
|---|
| 82 | virtual void dispatchDidCommitLoad(); |
|---|
| 83 | virtual void dispatchDidFailProvisionalLoad(const WebCore::ResourceError&); |
|---|
| 84 | virtual void dispatchDidFailLoad(const WebCore::ResourceError&); |
|---|
| 85 | virtual void dispatchDidFinishDocumentLoad(); |
|---|
| 86 | virtual void dispatchDidFinishLoad(); |
|---|
| 87 | virtual void dispatchDidFirstLayout(); |
|---|
| 88 | |
|---|
| 89 | virtual WebCore::Frame* dispatchCreatePage(); |
|---|
| 90 | virtual void dispatchShow(); |
|---|
| 91 | |
|---|
| 92 | virtual void dispatchDecidePolicyForMIMEType(WebCore::FramePolicyFunction, const WebCore::String& MIMEType, const WebCore::ResourceRequest&); |
|---|
| 93 | virtual void dispatchDecidePolicyForNewWindowAction(WebCore::FramePolicyFunction, const WebCore::NavigationAction&, const WebCore::ResourceRequest&, WTF::PassRefPtr<WebCore::FormState>, const WebCore::String& frameName); |
|---|
| 94 | virtual void dispatchDecidePolicyForNavigationAction(WebCore::FramePolicyFunction, const WebCore::NavigationAction&, const WebCore::ResourceRequest&, WTF::PassRefPtr<WebCore::FormState>); |
|---|
| 95 | virtual void cancelPolicyCheck(); |
|---|
| 96 | |
|---|
| 97 | virtual void dispatchUnableToImplementPolicy(const WebCore::ResourceError&); |
|---|
| 98 | |
|---|
| 99 | virtual void dispatchWillSubmitForm(WebCore::FramePolicyFunction, WTF::PassRefPtr<WebCore::FormState>); |
|---|
| 100 | |
|---|
| 101 | virtual void dispatchDidLoadMainResource(WebCore::DocumentLoader*); |
|---|
| 102 | virtual void revertToProvisionalState(WebCore::DocumentLoader*); |
|---|
| 103 | virtual void setMainDocumentError(WebCore::DocumentLoader*, const WebCore::ResourceError&); |
|---|
| 104 | |
|---|
| 105 | virtual void postProgressStartedNotification(); |
|---|
| 106 | virtual void postProgressEstimateChangedNotification(); |
|---|
| 107 | virtual void postProgressFinishedNotification(); |
|---|
| 108 | |
|---|
| 109 | virtual PassRefPtr<WebCore::Frame> createFrame(const WebCore::KURL& url, const WebCore::String& name, WebCore::HTMLFrameOwnerElement* ownerElement, |
|---|
| 110 | const WebCore::String& referrer, bool allowsScrolling, int marginWidth, int marginHeight); |
|---|
| 111 | virtual WebCore::Widget* createPlugin(const WebCore::IntSize&, WebCore::Element*, const WebCore::KURL&, const WTF::Vector<WebCore::String>&, const WTF::Vector<WebCore::String>&, const WebCore::String&, bool); |
|---|
| 112 | virtual void redirectDataToPlugin(WebCore::Widget* pluginWidget); |
|---|
| 113 | virtual WebCore::Widget* createJavaAppletWidget(const WebCore::IntSize&, WebCore::Element*, const WebCore::KURL& baseURL, const WTF::Vector<WebCore::String>& paramNames, const WTF::Vector<WebCore::String>& paramValues); |
|---|
| 114 | virtual WebCore::String overrideMediaType() const; |
|---|
| 115 | virtual void windowObjectCleared(); |
|---|
| 116 | virtual void didPerformFirstNavigation() const; |
|---|
| 117 | |
|---|
| 118 | virtual void registerForIconNotification(bool); |
|---|
| 119 | |
|---|
| 120 | virtual WebCore::ObjectContentType objectContentType(const WebCore::KURL& url, const WebCore::String& mimeType); |
|---|
| 121 | |
|---|
| 122 | virtual void setMainFrameDocumentReady(bool); |
|---|
| 123 | |
|---|
| 124 | virtual void startDownload(const WebCore::ResourceRequest&); |
|---|
| 125 | |
|---|
| 126 | virtual void willChangeTitle(WebCore::DocumentLoader*); |
|---|
| 127 | virtual void didChangeTitle(WebCore::DocumentLoader*); |
|---|
| 128 | |
|---|
| 129 | virtual void committedLoad(WebCore::DocumentLoader*, const char*, int); |
|---|
| 130 | virtual void finishedLoading(WebCore::DocumentLoader*); |
|---|
| 131 | |
|---|
| 132 | virtual void updateGlobalHistory(); |
|---|
| 133 | virtual bool shouldGoToHistoryItem(WebCore::HistoryItem*) const; |
|---|
| 134 | |
|---|
| 135 | virtual WebCore::ResourceError cancelledError(const WebCore::ResourceRequest&); |
|---|
| 136 | virtual WebCore::ResourceError blockedError(const WebCore::ResourceRequest&); |
|---|
| 137 | virtual WebCore::ResourceError cannotShowURLError(const WebCore::ResourceRequest&); |
|---|
| 138 | virtual WebCore::ResourceError interruptForPolicyChangeError(const WebCore::ResourceRequest&); |
|---|
| 139 | |
|---|
| 140 | virtual WebCore::ResourceError cannotShowMIMETypeError(const WebCore::ResourceResponse&); |
|---|
| 141 | virtual WebCore::ResourceError fileDoesNotExistError(const WebCore::ResourceResponse&); |
|---|
| 142 | virtual WebCore::ResourceError pluginWillHandleLoadError(const WebCore::ResourceResponse&); |
|---|
| 143 | |
|---|
| 144 | virtual bool shouldFallBack(const WebCore::ResourceError&); |
|---|
| 145 | |
|---|
| 146 | virtual bool canHandleRequest(const WebCore::ResourceRequest&) const; |
|---|
| 147 | virtual bool canShowMIMEType(const WebCore::String&) const; |
|---|
| 148 | virtual bool representationExistsForURLScheme(const WebCore::String&) const; |
|---|
| 149 | virtual WebCore::String generatedMIMETypeForURLScheme(const WebCore::String&) const; |
|---|
| 150 | |
|---|
| 151 | virtual void frameLoadCompleted(); |
|---|
| 152 | virtual void saveViewStateToItem(WebCore::HistoryItem*); |
|---|
| 153 | virtual void restoreViewState(); |
|---|
| 154 | virtual void provisionalLoadStarted(); |
|---|
| 155 | virtual void didFinishLoad(); |
|---|
| 156 | virtual void prepareForDataSourceReplacement(); |
|---|
| 157 | |
|---|
| 158 | virtual WTF::PassRefPtr<WebCore::DocumentLoader> createDocumentLoader(const WebCore::ResourceRequest&, const WebCore::SubstituteData&); |
|---|
| 159 | virtual void setTitle(const WebCore::String& title, const WebCore::KURL&); |
|---|
| 160 | |
|---|
| 161 | virtual WebCore::String userAgent(const WebCore::KURL&); |
|---|
| 162 | |
|---|
| 163 | virtual void savePlatformDataToCachedPage(WebCore::CachedPage*); |
|---|
| 164 | virtual void transitionToCommittedFromCachedPage(WebCore::CachedPage*); |
|---|
| 165 | virtual void transitionToCommittedForNewPage(); |
|---|
| 166 | |
|---|
| 167 | virtual bool canCachePage() const; |
|---|
| 168 | virtual void download(WebCore::ResourceHandle*, const WebCore::ResourceRequest&, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&); |
|---|
| 169 | private: |
|---|
| 170 | WebKitWebFrame* m_frame; |
|---|
| 171 | WebCore::ResourceResponse m_response; |
|---|
| 172 | WebCore::String m_userAgent; |
|---|
| 173 | |
|---|
| 174 | // Plugin view to redirect data to |
|---|
| 175 | WebCore::PluginView* m_pluginView; |
|---|
| 176 | bool m_hasSentResponseToPlugin; |
|---|
| 177 | }; |
|---|
| 178 | |
|---|
| 179 | } |
|---|
| 180 | |
|---|
| 181 | #endif |
|---|