1 /* 2 * Copyright (C) 2006 Zack Rusin <zack@kde.org> 3 * Copyright (C) 2006, 2011 Apple 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 #include "webkitwebpolicydecision.h" 37 38 typedef struct _WebKitWebFrame WebKitWebFrame; 39 40 namespace WebKit { 41 42 class FrameLoaderClient : public WebCore::FrameLoaderClient { 43 public: 44 FrameLoaderClient(WebKitWebFrame*); 45 virtual ~FrameLoaderClient(); 46 virtual void frameLoaderDestroyed(); 47 webFrame()48 WebKitWebFrame* webFrame() const { return m_frame; } 49 50 virtual bool hasWebView() const; 51 52 virtual void makeRepresentation(WebCore::DocumentLoader*); 53 virtual void forceLayout(); 54 virtual void forceLayoutForNonHTML(); 55 56 virtual void setCopiesOnScroll(); 57 58 virtual void detachedFromParent2(); 59 virtual void detachedFromParent3(); 60 61 virtual void assignIdentifierToInitialRequest(unsigned long identifier, WebCore::DocumentLoader*, const WebCore::ResourceRequest&); 62 63 virtual void dispatchWillSendRequest(WebCore::DocumentLoader*, unsigned long identifier, WebCore::ResourceRequest&, const WebCore::ResourceResponse& redirectResponse); 64 virtual bool shouldUseCredentialStorage(WebCore::DocumentLoader*, unsigned long identifier); 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 dataLength); 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 dispatchDidPushStateWithinPage(); 79 virtual void dispatchDidReplaceStateWithinPage(); 80 virtual void dispatchDidPopStateWithinPage(); 81 virtual void dispatchWillClose(); 82 virtual void dispatchDidReceiveIcon(); 83 virtual void dispatchDidStartProvisionalLoad(); 84 virtual void dispatchDidReceiveTitle(const WebCore::StringWithDirection&); 85 virtual void dispatchDidChangeIcons(); 86 virtual void dispatchDidCommitLoad(); 87 virtual void dispatchDidFailProvisionalLoad(const WebCore::ResourceError&); 88 virtual void dispatchDidFailLoad(const WebCore::ResourceError&); 89 virtual void dispatchDidFinishDocumentLoad(); 90 virtual void dispatchDidFinishLoad(); 91 virtual void dispatchDidFirstLayout(); 92 virtual void dispatchDidFirstVisuallyNonEmptyLayout(); 93 94 virtual WebCore::Frame* dispatchCreatePage(const WebCore::NavigationAction&); 95 virtual void dispatchShow(); 96 97 virtual void dispatchDecidePolicyForResponse(WebCore::FramePolicyFunction, const WebCore::ResourceResponse&, const WebCore::ResourceRequest&); 98 virtual void dispatchDecidePolicyForNewWindowAction(WebCore::FramePolicyFunction, const WebCore::NavigationAction&, const WebCore::ResourceRequest&, WTF::PassRefPtr<WebCore::FormState>, const WTF::String& frameName); 99 virtual void dispatchDecidePolicyForNavigationAction(WebCore::FramePolicyFunction, const WebCore::NavigationAction&, const WebCore::ResourceRequest&, WTF::PassRefPtr<WebCore::FormState>); 100 virtual void cancelPolicyCheck(); 101 102 virtual void dispatchUnableToImplementPolicy(const WebCore::ResourceError&); 103 dispatchWillSendSubmitEvent(WebCore::HTMLFormElement *)104 virtual void dispatchWillSendSubmitEvent(WebCore::HTMLFormElement*) { } 105 virtual void dispatchWillSubmitForm(WebCore::FramePolicyFunction, WTF::PassRefPtr<WebCore::FormState>); 106 107 virtual void dispatchDidLoadMainResource(WebCore::DocumentLoader*); 108 virtual void revertToProvisionalState(WebCore::DocumentLoader*); 109 virtual void setMainDocumentError(WebCore::DocumentLoader*, const WebCore::ResourceError&); 110 111 virtual void postProgressStartedNotification(); 112 virtual void postProgressEstimateChangedNotification(); 113 virtual void postProgressFinishedNotification(); 114 115 virtual PassRefPtr<WebCore::Frame> createFrame(const WebCore::KURL& url, const WTF::String& name, WebCore::HTMLFrameOwnerElement* ownerElement, 116 const WTF::String& referrer, bool allowsScrolling, int marginWidth, int marginHeight); 117 virtual void didTransferChildFrameToNewDocument(WebCore::Page*); 118 virtual void transferLoadingResourceFromPage(unsigned long, WebCore::DocumentLoader*, const WebCore::ResourceRequest&, WebCore::Page*); 119 virtual PassRefPtr<WebCore::Widget> createPlugin(const WebCore::IntSize&, WebCore::HTMLPlugInElement*, const WebCore::KURL&, const WTF::Vector<WTF::String>&, const WTF::Vector<WTF::String>&, const WTF::String&, bool); 120 virtual void redirectDataToPlugin(WebCore::Widget* pluginWidget); 121 virtual PassRefPtr<WebCore::Widget> createJavaAppletWidget(const WebCore::IntSize&, WebCore::HTMLAppletElement*, const WebCore::KURL& baseURL, const WTF::Vector<WTF::String>& paramNames, const WTF::Vector<WTF::String>& paramValues); 122 virtual WTF::String overrideMediaType() const; 123 virtual void dispatchDidClearWindowObjectInWorld(WebCore::DOMWrapperWorld*); 124 virtual void documentElementAvailable(); 125 virtual void didPerformFirstNavigation() const; 126 127 virtual void registerForIconNotification(bool); 128 129 virtual WebCore::ObjectContentType objectContentType(const WebCore::KURL&, const WTF::String& mimeType, bool shouldPreferPlugInsForImages); 130 131 virtual void setMainFrameDocumentReady(bool); 132 133 virtual void startDownload(const WebCore::ResourceRequest&); 134 135 virtual void willChangeTitle(WebCore::DocumentLoader*); 136 virtual void didChangeTitle(WebCore::DocumentLoader*); 137 138 virtual void committedLoad(WebCore::DocumentLoader*, const char*, int); 139 virtual void finishedLoading(WebCore::DocumentLoader*); 140 141 virtual void updateGlobalHistory(); 142 virtual void updateGlobalHistoryRedirectLinks(); 143 virtual bool shouldGoToHistoryItem(WebCore::HistoryItem*) const; 144 virtual bool shouldStopLoadingForHistoryItem(WebCore::HistoryItem*) const; 145 virtual void dispatchDidAddBackForwardItem(WebCore::HistoryItem*) const; 146 virtual void dispatchDidRemoveBackForwardItem(WebCore::HistoryItem*) const; 147 virtual void dispatchDidChangeBackForwardIndex() const; 148 149 virtual void didDisplayInsecureContent(); 150 virtual void didRunInsecureContent(WebCore::SecurityOrigin*, const WebCore::KURL&); 151 152 virtual WebCore::ResourceError cancelledError(const WebCore::ResourceRequest&); 153 virtual WebCore::ResourceError blockedError(const WebCore::ResourceRequest&); 154 virtual WebCore::ResourceError cannotShowURLError(const WebCore::ResourceRequest&); 155 virtual WebCore::ResourceError interruptForPolicyChangeError(const WebCore::ResourceRequest&); 156 157 virtual WebCore::ResourceError cannotShowMIMETypeError(const WebCore::ResourceResponse&); 158 virtual WebCore::ResourceError fileDoesNotExistError(const WebCore::ResourceResponse&); 159 virtual WebCore::ResourceError pluginWillHandleLoadError(const WebCore::ResourceResponse&); 160 161 virtual bool shouldFallBack(const WebCore::ResourceError&); 162 163 virtual bool canHandleRequest(const WebCore::ResourceRequest&) const; 164 virtual bool canShowMIMEType(const WTF::String&) const; 165 virtual bool canShowMIMETypeAsHTML(const String& MIMEType) const; 166 virtual bool representationExistsForURLScheme(const WTF::String&) const; 167 virtual WTF::String generatedMIMETypeForURLScheme(const WTF::String&) const; 168 169 virtual void frameLoadCompleted(); 170 virtual void saveViewStateToItem(WebCore::HistoryItem*); 171 virtual void restoreViewState(); 172 virtual void provisionalLoadStarted(); 173 virtual void didFinishLoad(); 174 virtual void prepareForDataSourceReplacement(); 175 176 virtual WTF::PassRefPtr<WebCore::DocumentLoader> createDocumentLoader(const WebCore::ResourceRequest&, const WebCore::SubstituteData&); 177 virtual void setTitle(const WebCore::StringWithDirection& title, const WebCore::KURL&); 178 179 virtual WTF::String userAgent(const WebCore::KURL&); 180 181 virtual void savePlatformDataToCachedFrame(WebCore::CachedFrame*); 182 virtual void transitionToCommittedFromCachedFrame(WebCore::CachedFrame*); 183 virtual void transitionToCommittedForNewPage(); 184 185 virtual void didSaveToPageCache(); 186 virtual void didRestoreFromPageCache(); 187 188 virtual void dispatchDidBecomeFrameset(bool); 189 190 virtual bool canCachePage() const; 191 virtual void download(WebCore::ResourceHandle*, const WebCore::ResourceRequest&, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&); 192 193 virtual PassRefPtr<WebCore::FrameNetworkingContext> createNetworkingContext(); 194 195 private: 196 WebKitWebFrame* m_frame; 197 WebCore::ResourceResponse m_response; 198 WebKitWebPolicyDecision* m_policyDecision; 199 200 bool m_loadingErrorPage; 201 202 // Plugin view to redirect data to 203 WebCore::PluginView* m_pluginView; 204 bool m_hasSentResponseToPlugin; 205 206 bool m_hasRepresentation; 207 }; 208 209 } 210 211 #endif 212