1 /* 2 * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com> 3 * Copyright (C) 2011 Apple Inc. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY 18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26 #ifndef FrameLoaderClientWinCE_h 27 #define FrameLoaderClientWinCE_h 28 29 #include "FrameLoaderClient.h" 30 #include "PluginView.h" 31 #include "ResourceResponse.h" 32 33 class WebView; 34 35 namespace WebKit { 36 37 class FrameLoaderClientWinCE : public WebCore::FrameLoaderClient { 38 public: 39 FrameLoaderClientWinCE(WebView*); 40 virtual ~FrameLoaderClientWinCE(); 41 virtual void frameLoaderDestroyed(); 42 webView()43 WebView* webView() const { return m_webView; } 44 45 virtual bool hasWebView() const; 46 47 virtual void makeRepresentation(WebCore::DocumentLoader*); 48 virtual void forceLayout(); 49 virtual void forceLayoutForNonHTML(); 50 51 virtual void setCopiesOnScroll(); 52 53 virtual void detachedFromParent2(); 54 virtual void detachedFromParent3(); 55 56 virtual void assignIdentifierToInitialRequest(unsigned long identifier, WebCore::DocumentLoader*, const WebCore::ResourceRequest&); 57 58 virtual void dispatchWillSendRequest(WebCore::DocumentLoader*, unsigned long identifier, WebCore::ResourceRequest&, const WebCore::ResourceResponse& redirectResponse); 59 virtual bool shouldUseCredentialStorage(WebCore::DocumentLoader*, unsigned long identifier); 60 virtual void dispatchDidReceiveAuthenticationChallenge(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::AuthenticationChallenge&); 61 virtual void dispatchDidCancelAuthenticationChallenge(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::AuthenticationChallenge&); 62 virtual void dispatchDidReceiveResponse(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ResourceResponse&); 63 virtual void dispatchDidReceiveContentLength(WebCore::DocumentLoader*, unsigned long identifier, int dataLength); 64 virtual void dispatchDidFinishLoading(WebCore::DocumentLoader*, unsigned long identifier); 65 virtual void dispatchDidFailLoading(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ResourceError&); 66 virtual bool dispatchDidLoadResourceFromMemoryCache(WebCore::DocumentLoader*, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&, int length); 67 68 virtual void dispatchDidHandleOnloadEvents(); 69 virtual void dispatchDidReceiveServerRedirectForProvisionalLoad(); 70 virtual void dispatchDidCancelClientRedirect(); 71 virtual void dispatchWillPerformClientRedirect(const WebCore::KURL&, double, double); 72 virtual void dispatchDidChangeLocationWithinPage(); 73 virtual void dispatchDidPushStateWithinPage(); 74 virtual void dispatchDidReplaceStateWithinPage(); 75 virtual void dispatchDidPopStateWithinPage(); 76 virtual void dispatchWillClose(); 77 virtual void dispatchDidReceiveIcon(); 78 virtual void dispatchDidStartProvisionalLoad(); 79 virtual void dispatchDidReceiveTitle(const WebCore::StringWithDirection&); 80 virtual void dispatchDidChangeIcons(); 81 virtual void dispatchDidCommitLoad(); 82 virtual void dispatchDidFailProvisionalLoad(const WebCore::ResourceError&); 83 virtual void dispatchDidFailLoad(const WebCore::ResourceError&); 84 virtual void dispatchDidFinishDocumentLoad(); 85 virtual void dispatchDidFinishLoad(); 86 virtual void dispatchDidFirstLayout(); 87 virtual void dispatchDidFirstVisuallyNonEmptyLayout(); 88 89 virtual WebCore::Frame* dispatchCreatePage(const WebCore::NavigationAction&); 90 virtual void dispatchShow(); 91 92 virtual void dispatchDecidePolicyForResponse(WebCore::FramePolicyFunction, const WebCore::ResourceResponse&, const WebCore::ResourceRequest&); 93 virtual void dispatchDecidePolicyForNewWindowAction(WebCore::FramePolicyFunction, const WebCore::NavigationAction&, const WebCore::ResourceRequest&, WTF::PassRefPtr<WebCore::FormState>, const WTF::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 dispatchWillSendSubmitEvent(WebCore::HTMLFormElement *)99 virtual void dispatchWillSendSubmitEvent(WebCore::HTMLFormElement*) { } 100 virtual void dispatchWillSubmitForm(WebCore::FramePolicyFunction, WTF::PassRefPtr<WebCore::FormState>); 101 102 virtual void dispatchDidLoadMainResource(WebCore::DocumentLoader*); 103 virtual void revertToProvisionalState(WebCore::DocumentLoader*); 104 virtual void setMainDocumentError(WebCore::DocumentLoader*, const WebCore::ResourceError&); 105 106 virtual void postProgressStartedNotification(); 107 virtual void postProgressEstimateChangedNotification(); 108 virtual void postProgressFinishedNotification(); 109 110 virtual PassRefPtr<WebCore::Frame> createFrame(const WebCore::KURL& url, const WTF::String& name, WebCore::HTMLFrameOwnerElement* ownerElement, 111 const WTF::String& referrer, bool allowsScrolling, int marginWidth, int marginHeight); 112 virtual void didTransferChildFrameToNewDocument(WebCore::Page*); 113 virtual void transferLoadingResourceFromPage(unsigned long, WebCore::DocumentLoader*, const WebCore::ResourceRequest&, WebCore::Page*); 114 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); 115 virtual void redirectDataToPlugin(WebCore::Widget* pluginWidget); 116 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); 117 virtual WTF::String overrideMediaType() const; 118 virtual void dispatchDidClearWindowObjectInWorld(WebCore::DOMWrapperWorld*); 119 virtual void documentElementAvailable(); 120 virtual void didPerformFirstNavigation() const; 121 122 virtual void registerForIconNotification(bool); 123 124 virtual WebCore::ObjectContentType objectContentType(const WebCore::KURL&, const WTF::String& mimeType, bool shouldPreferPlugInsForImages); 125 126 virtual void setMainFrameDocumentReady(bool); 127 128 virtual void startDownload(const WebCore::ResourceRequest&); 129 130 virtual void willChangeTitle(WebCore::DocumentLoader*); 131 virtual void didChangeTitle(WebCore::DocumentLoader*); 132 133 virtual void committedLoad(WebCore::DocumentLoader*, const char*, int); 134 virtual void finishedLoading(WebCore::DocumentLoader*); 135 136 virtual void updateGlobalHistory(); 137 virtual void updateGlobalHistoryRedirectLinks(); 138 virtual bool shouldGoToHistoryItem(WebCore::HistoryItem*) const; 139 virtual bool shouldStopLoadingForHistoryItem(WebCore::HistoryItem*) const; 140 virtual void dispatchDidAddBackForwardItem(WebCore::HistoryItem*) const; 141 virtual void dispatchDidRemoveBackForwardItem(WebCore::HistoryItem*) const; 142 virtual void dispatchDidChangeBackForwardIndex() const; 143 144 virtual void didDisplayInsecureContent(); 145 virtual void didRunInsecureContent(WebCore::SecurityOrigin*, const WebCore::KURL&); 146 147 virtual WebCore::ResourceError cancelledError(const WebCore::ResourceRequest&); 148 virtual WebCore::ResourceError blockedError(const WebCore::ResourceRequest&); 149 virtual WebCore::ResourceError cannotShowURLError(const WebCore::ResourceRequest&); 150 virtual WebCore::ResourceError interruptForPolicyChangeError(const WebCore::ResourceRequest&); 151 152 virtual WebCore::ResourceError cannotShowMIMETypeError(const WebCore::ResourceResponse&); 153 virtual WebCore::ResourceError fileDoesNotExistError(const WebCore::ResourceResponse&); 154 virtual WebCore::ResourceError pluginWillHandleLoadError(const WebCore::ResourceResponse&); 155 156 virtual bool shouldFallBack(const WebCore::ResourceError&); 157 158 virtual bool canHandleRequest(const WebCore::ResourceRequest&) const; 159 virtual bool canShowMIMEType(const WTF::String&) const; 160 virtual bool canShowMIMETypeAsHTML(const WTF::String&) const; 161 virtual bool representationExistsForURLScheme(const WTF::String&) const; 162 virtual WTF::String generatedMIMETypeForURLScheme(const WTF::String&) const; 163 164 virtual void frameLoadCompleted(); 165 virtual void saveViewStateToItem(WebCore::HistoryItem*); 166 virtual void restoreViewState(); 167 virtual void provisionalLoadStarted(); 168 virtual void didFinishLoad(); 169 virtual void prepareForDataSourceReplacement(); 170 171 virtual WTF::PassRefPtr<WebCore::DocumentLoader> createDocumentLoader(const WebCore::ResourceRequest&, const WebCore::SubstituteData&); 172 virtual void setTitle(const WebCore::StringWithDirection&, const WebCore::KURL&); 173 174 virtual WTF::String userAgent(const WebCore::KURL&); 175 176 virtual void savePlatformDataToCachedFrame(WebCore::CachedFrame*); 177 virtual void transitionToCommittedFromCachedFrame(WebCore::CachedFrame*); 178 virtual void transitionToCommittedForNewPage(); 179 180 virtual void didSaveToPageCache(); 181 virtual void didRestoreFromPageCache(); 182 183 virtual void dispatchDidBecomeFrameset(bool); 184 185 virtual bool canCachePage() const; 186 virtual void download(WebCore::ResourceHandle*, const WebCore::ResourceRequest&, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&); 187 188 virtual PassRefPtr<WebCore::FrameNetworkingContext> createNetworkingContext(); 189 setFrame(WebCore::Frame * frame)190 void setFrame(WebCore::Frame *frame) { m_frame = frame; } frame()191 WebCore::Frame *frame() { return m_frame; } 192 193 private: 194 WebView* m_webView; 195 WebCore::Frame* m_frame; 196 WebCore::ResourceResponse m_response; 197 198 // Plugin view to redirect data to 199 WebCore::PluginView* m_pluginView; 200 bool m_hasSentResponseToPlugin; 201 }; 202 203 } // namespace WebKit 204 205 #endif // FrameLoaderClientWinCE_h 206