| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | |
| 3 * | |
| 4 * Redistribution and use in source and binary forms, with or without | |
| 5 * modification, are permitted provided that the following conditions are | |
| 6 * met: | |
| 7 * | |
| 8 * * Redistributions of source code must retain the above copyright | |
| 9 * notice, this list of conditions and the following disclaimer. | |
| 10 * * Redistributions in binary form must reproduce the above | |
| 11 * copyright notice, this list of conditions and the following disclaimer | |
| 12 * in the documentation and/or other materials provided with the | |
| 13 * distribution. | |
| 14 * * Neither the name of Google Inc. nor the names of its | |
| 15 * contributors may be used to endorse or promote products derived from | |
| 16 * this software without specific prior written permission. | |
| 17 * | |
| 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 29 */ | |
| 30 | |
| 31 #ifndef FrameLoaderClientImpl_h | |
| 32 #define FrameLoaderClientImpl_h | |
| 33 | |
| 34 // FIXME: remove this relative path once consumers from glue are removed. | |
| 35 #include "../public/WebNavigationPolicy.h" | |
| 36 #include "FrameLoaderClient.h" | |
| 37 #include "KURL.h" | |
| 38 #include <wtf/PassOwnPtr.h> | |
| 39 #include <wtf/RefPtr.h> | |
| 40 | |
| 41 | |
| 42 namespace WebKit { | |
| 43 | |
| 44 class WebFrameImpl; | |
| 45 class WebPluginContainerImpl; | |
| 46 class WebPluginLoadObserver; | |
| 47 | |
| 48 class FrameLoaderClientImpl : public WebCore::FrameLoaderClient { | |
| 49 public: | |
| 50 FrameLoaderClientImpl(WebFrameImpl* webFrame); | |
| 51 ~FrameLoaderClientImpl(); | |
| 52 | |
| 53 WebFrameImpl* webFrame() const { return m_webFrame; } | |
| 54 | |
| 55 // WebCore::FrameLoaderClient ---------------------------------------------- | |
| 56 | |
| 57 virtual void frameLoaderDestroyed(); | |
| 58 | |
| 59 // Notifies the WebView delegate that the JS window object has been cleared, | |
| 60 // giving it a chance to bind native objects to the window before script | |
| 61 // parsing begins. | |
| 62 virtual void windowObjectCleared(); | |
| 63 virtual void documentElementAvailable(); | |
| 64 | |
| 65 // A frame's V8 context was created or destroyed. | |
| 66 virtual void didCreateScriptContextForFrame(); | |
| 67 virtual void didDestroyScriptContextForFrame(); | |
| 68 | |
| 69 // A context untied to a frame was created (through evaluateInNewContext). | |
| 70 // This context is not tied to the lifetime of its frame, and is destroyed | |
| 71 // in garbage collection. | |
| 72 virtual void didCreateIsolatedScriptContext(); | |
| 73 | |
| 74 virtual bool hasWebView() const; | |
| 75 virtual bool hasFrameView() const; | |
| 76 virtual void makeRepresentation(WebCore::DocumentLoader*); | |
| 77 virtual void forceLayout(); | |
| 78 virtual void forceLayoutForNonHTML(); | |
| 79 virtual void setCopiesOnScroll(); | |
| 80 virtual void detachedFromParent2(); | |
| 81 virtual void detachedFromParent3(); | |
| 82 virtual void assignIdentifierToInitialRequest(unsigned long identifier, WebCore::DocumentLoader*, const WebCore::ResourceRequest&); | |
| 83 virtual void dispatchWillSendRequest(WebCore::DocumentLoader*, unsigned long identifier, WebCore::ResourceRequest&, const WebCore::ResourceResponse& redirectResponse); | |
| 84 virtual bool shouldUseCredentialStorage(WebCore::DocumentLoader*, unsigned long identifier); | |
| 85 virtual void dispatchDidReceiveAuthenticationChallenge(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::AuthenticationChallenge&); | |
| 86 virtual void dispatchDidCancelAuthenticationChallenge(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::AuthenticationChallenge&); | |
| 87 virtual void dispatchDidReceiveResponse(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ResourceResponse&); | |
| 88 virtual void dispatchDidReceiveContentLength(WebCore::DocumentLoader*, unsigned long identifier, int lengthReceived); | |
| 89 virtual void dispatchDidFinishLoading(WebCore::DocumentLoader*, unsigned long identifier); | |
| 90 virtual void dispatchDidFailLoading(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ResourceError&); | |
| 91 virtual bool dispatchDidLoadResourceFromMemoryCache(WebCore::DocumentLoader*, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&, int length); | |
| 92 virtual void dispatchDidLoadResourceByXMLHttpRequest(unsigned long identifier, const WebCore::ScriptString&); | |
| 93 virtual void dispatchDidHandleOnloadEvents(); | |
| 94 virtual void dispatchDidReceiveServerRedirectForProvisionalLoad(); | |
| 95 virtual void dispatchDidCancelClientRedirect(); | |
| 96 virtual void dispatchWillPerformClientRedirect(const WebCore::KURL&, double interval, double fireDate); | |
| 97 virtual void dispatchDidChangeLocationWithinPage(); | |
| 98 virtual void dispatchWillClose(); | |
| 99 virtual void dispatchDidReceiveIcon(); | |
| 100 virtual void dispatchDidStartProvisionalLoad(); | |
| 101 virtual void dispatchDidReceiveTitle(const WebCore::String& title); | |
| 102 virtual void dispatchDidCommitLoad(); | |
| 103 virtual void dispatchDidFailProvisionalLoad(const WebCore::ResourceError&); | |
| 104 virtual void dispatchDidFailLoad(const WebCore::ResourceError&); | |
| 105 virtual void dispatchDidFinishDocumentLoad(); | |
| 106 virtual void dispatchDidFinishLoad(); | |
| 107 virtual void dispatchDidFirstLayout(); | |
| 108 virtual void dispatchDidFirstVisuallyNonEmptyLayout(); | |
| 109 virtual WebCore::Frame* dispatchCreatePage(); | |
| 110 virtual void dispatchShow(); | |
| 111 virtual void dispatchDecidePolicyForMIMEType(WebCore::FramePolicyFunction function, const WebCore::String& mime_type, const WebCore::ResourceRequest&); | |
| 112 virtual void dispatchDecidePolicyForNewWindowAction(WebCore::FramePolicyFunction function, const WebCore::NavigationAction& action, const WebCore::ResourceRequest& request, PassRefPtr<WebCore::FormState> form_state, const WebCore::String& frame_name); | |
| 113 virtual void dispatchDecidePolicyForNavigationAction(WebCore::FramePolicyFunction function, const WebCore::NavigationAction& action, const WebCore::ResourceRequest& request, PassRefPtr<WebCore::FormState> form_state); | |
| 114 virtual void cancelPolicyCheck(); | |
| 115 virtual void dispatchUnableToImplementPolicy(const WebCore::ResourceError&); | |
| 116 virtual void dispatchWillSubmitForm(WebCore::FramePolicyFunction, PassRefPtr<WebCore::FormState>); | |
| 117 virtual void dispatchDidLoadMainResource(WebCore::DocumentLoader*); | |
| 118 virtual void revertToProvisionalState(WebCore::DocumentLoader*); | |
| 119 virtual void setMainDocumentError(WebCore::DocumentLoader*, const WebCore::ResourceError&); | |
| 120 virtual void willChangeEstimatedProgress() { } | |
| 121 virtual void didChangeEstimatedProgress() { } | |
| 122 virtual void postProgressStartedNotification(); | |
| 123 virtual void postProgressEstimateChangedNotification(); | |
| 124 virtual void postProgressFinishedNotification(); | |
| 125 virtual void setMainFrameDocumentReady(bool); | |
| 126 virtual void startDownload(const WebCore::ResourceRequest&); | |
| 127 virtual void willChangeTitle(WebCore::DocumentLoader*); | |
| 128 virtual void didChangeTitle(WebCore::DocumentLoader*); | |
| 129 virtual void committedLoad(WebCore::DocumentLoader*, const char*, int); | |
| 130 virtual void finishedLoading(WebCore::DocumentLoader*); | |
| 131 virtual void updateGlobalHistory(); | |
| 132 virtual void updateGlobalHistoryRedirectLinks(); | |
| 133 virtual bool shouldGoToHistoryItem(WebCore::HistoryItem*) const; | |
| 134 virtual void didDisplayInsecureContent(); | |
| 135 virtual void didRunInsecureContent(WebCore::SecurityOrigin*); | |
| 136 virtual WebCore::ResourceError blockedError(const WebCore::ResourceRequest&); | |
| 137 virtual WebCore::ResourceError cancelledError(const WebCore::ResourceRequest&); | |
| 138 virtual WebCore::ResourceError cannotShowURLError(const WebCore::ResourceRequest&); | |
| 139 virtual WebCore::ResourceError interruptForPolicyChangeError(const WebCore::ResourceRequest&); | |
| 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 virtual bool shouldFallBack(const WebCore::ResourceError&); | |
| 144 virtual bool canHandleRequest(const WebCore::ResourceRequest&) const; | |
| 145 virtual bool canShowMIMEType(const WebCore::String& MIMEType) const; | |
| 146 virtual bool representationExistsForURLScheme(const WebCore::String& URLScheme) const; | |
| 147 virtual WebCore::String generatedMIMETypeForURLScheme(const WebCore::String& URLScheme) const; | |
| 148 virtual void frameLoadCompleted(); | |
| 149 virtual void saveViewStateToItem(WebCore::HistoryItem*); | |
| 150 virtual void restoreViewState(); | |
| 151 virtual void provisionalLoadStarted(); | |
| 152 virtual void didFinishLoad(); | |
| 153 virtual void prepareForDataSourceReplacement(); | |
| 154 virtual PassRefPtr<WebCore::DocumentLoader> createDocumentLoader( | |
| 155 const WebCore::ResourceRequest&, const WebCore::SubstituteData&); | |
| 156 virtual void setTitle(const WebCore::String& title, const WebCore::KURL&); | |
| 157 virtual WebCore::String userAgent(const WebCore::KURL&); | |
| 158 virtual void savePlatformDataToCachedFrame(WebCore::CachedFrame*); | |
| 159 virtual void transitionToCommittedFromCachedFrame(WebCore::CachedFrame*); | |
| 160 virtual void transitionToCommittedForNewPage(); | |
| 161 virtual bool canCachePage() const; | |
| 162 virtual void download( | |
| 163 WebCore::ResourceHandle*, const WebCore::ResourceRequest&, | |
| 164 const WebCore::ResourceRequest& initialRequest, | |
| 165 const WebCore::ResourceResponse&); | |
| 166 virtual PassRefPtr<WebCore::Frame> createFrame( | |
| 167 const WebCore::KURL& url, const WebCore::String& name, | |
| 168 WebCore::HTMLFrameOwnerElement* ownerElement, | |
| 169 const WebCore::String& referrer, bool allowsScrolling, | |
| 170 int marginWidth, int marginHeight); | |
| 171 virtual PassRefPtr<WebCore::Widget> createPlugin( | |
| 172 const WebCore::IntSize&, WebCore::HTMLPlugInElement*, const WebCore::KURL&, | |
| 173 const Vector<WebCore::String>&, const Vector<WebCore::String>&, | |
| 174 const WebCore::String&, bool loadManually); | |
| 175 virtual void redirectDataToPlugin(WebCore::Widget* pluginWidget); | |
| 176 virtual PassRefPtr<WebCore::Widget> createJavaAppletWidget( | |
| 177 const WebCore::IntSize&, | |
| 178 WebCore::HTMLAppletElement*, | |
| 179 const WebCore::KURL& /* base_url */, | |
| 180 const Vector<WebCore::String>& paramNames, | |
| 181 const Vector<WebCore::String>& paramValues); | |
| 182 virtual WebCore::ObjectContentType objectContentType( | |
| 183 const WebCore::KURL& url, const WebCore::String& mimeType); | |
| 184 virtual WebCore::String overrideMediaType() const; | |
| 185 virtual void didPerformFirstNavigation() const; | |
| 186 virtual void registerForIconNotification(bool listen = true); | |
| 187 virtual void didChangeScrollOffset(); | |
| 188 virtual bool allowJavaScript(bool enabledPerSettings); | |
| 189 | |
| 190 private: | |
| 191 void makeDocumentView(); | |
| 192 | |
| 193 // Given a NavigationAction, determine the associated WebNavigationPolicy. | |
| 194 // For example, a middle click means "open in background tab". | |
| 195 static bool actionSpecifiesNavigationPolicy( | |
| 196 const WebCore::NavigationAction& action, WebNavigationPolicy* policy); | |
| 197 | |
| 198 // Called when a dummy back-forward navigation is intercepted. | |
| 199 void handleBackForwardNavigation(const WebCore::KURL&); | |
| 200 | |
| 201 PassOwnPtr<WebPluginLoadObserver> pluginLoadObserver(); | |
| 202 | |
| 203 // The WebFrame that owns this object and manages its lifetime. Therefore, | |
| 204 // the web frame object is guaranteed to exist. | |
| 205 WebFrameImpl* m_webFrame; | |
| 206 | |
| 207 // True if makeRepresentation was called. We don't actually have a concept | |
| 208 // of a "representation", but we need to know when we're expected to have one. | |
| 209 // See finishedLoading(). | |
| 210 bool m_hasRepresentation; | |
| 211 | |
| 212 // Used to help track client redirects. When a provisional load starts, it | |
| 213 // has no redirects in its chain. But in the case of client redirects, we want | |
| 214 // to add that initial load as a redirect. When we get a new provisional load | |
| 215 // and the dest URL matches that load, we know that it was the result of a | |
| 216 // previous client redirect and the source should be added as a redirect. | |
| 217 // Both should be empty if unused. | |
| 218 WebCore::KURL m_expectedClientRedirectSrc; | |
| 219 WebCore::KURL m_expectedClientRedirectDest; | |
| 220 | |
| 221 // Contains a pointer to the plugin widget. | |
| 222 RefPtr<WebPluginContainerImpl> m_pluginWidget; | |
| 223 | |
| 224 // Indicates if we need to send over the initial notification to the plugin | |
| 225 // which specifies that the plugin should be ready to accept data. | |
| 226 bool m_sentInitialResponseToPlugin; | |
| 227 | |
| 228 // The navigation policy to use for the next call to dispatchCreatePage. | |
| 229 WebNavigationPolicy m_nextNavigationPolicy; | |
| 230 }; | |
| 231 | |
| 232 } // namespace WebKit | |
| 233 | |
| 234 #endif | |
| OLD | NEW |