| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef WEBKIT_GLUE_WEBFRAMELOADERCLIENT_IMPL_H_ | |
| 6 #define WEBKIT_GLUE_WEBFRAMELOADERCLIENT_IMPL_H_ | |
| 7 | |
| 8 #include "FrameLoaderClient.h" | |
| 9 #include "KURL.h" | |
| 10 #include <wtf/PassOwnPtr.h> | |
| 11 #include <wtf/RefPtr.h> | |
| 12 | |
| 13 #include "webkit/api/public/WebNavigationPolicy.h" | |
| 14 | |
| 15 class WebFrameImpl; | |
| 16 | |
| 17 namespace WebKit { | |
| 18 class WebPluginContainerImpl; | |
| 19 class WebPluginLoadObserver; | |
| 20 } | |
| 21 | |
| 22 class WebFrameLoaderClient : public WebCore::FrameLoaderClient { | |
| 23 public: | |
| 24 WebFrameLoaderClient(WebFrameImpl* webframe); | |
| 25 virtual ~WebFrameLoaderClient(); | |
| 26 | |
| 27 WebFrameImpl* webframe() const { return webframe_; } | |
| 28 | |
| 29 // WebCore::FrameLoaderClient ---------------------------------------------- | |
| 30 | |
| 31 virtual void frameLoaderDestroyed(); | |
| 32 | |
| 33 // Notifies the WebView delegate that the JS window object has been cleared, | |
| 34 // giving it a chance to bind native objects to the window before script | |
| 35 // parsing begins. | |
| 36 virtual void windowObjectCleared(); | |
| 37 virtual void documentElementAvailable(); | |
| 38 | |
| 39 // A frame's V8 context was created or destroyed. | |
| 40 virtual void didCreateScriptContextForFrame(); | |
| 41 virtual void didDestroyScriptContextForFrame(); | |
| 42 | |
| 43 // A context untied to a frame was created (through evaluateInNewContext). | |
| 44 // This context is not tied to the lifetime of its frame, and is destroyed | |
| 45 // in garbage collection. | |
| 46 virtual void didCreateIsolatedScriptContext(); | |
| 47 | |
| 48 virtual bool hasWebView() const; // mainly for assertions | |
| 49 virtual bool hasFrameView() const; // ditto | |
| 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 assignIdentifierToInitialRequest(unsigned long identifier, WebCor
e::DocumentLoader*, const WebCore::ResourceRequest&); | |
| 61 | |
| 62 virtual void dispatchWillSendRequest(WebCore::DocumentLoader*, unsigned long i
dentifier, WebCore::ResourceRequest&, const WebCore::ResourceResponse& redirectR
esponse); | |
| 63 virtual bool shouldUseCredentialStorage(WebCore::DocumentLoader*, unsigned lon
g identifier); | |
| 64 virtual void dispatchDidReceiveAuthenticationChallenge(WebCore::DocumentLoader
*, unsigned long identifier, const WebCore::AuthenticationChallenge&); | |
| 65 virtual void dispatchDidCancelAuthenticationChallenge(WebCore::DocumentLoader*
, unsigned long identifier, const WebCore::AuthenticationChallenge&); | |
| 66 virtual void dispatchDidReceiveResponse(WebCore::DocumentLoader*, unsigned lon
g identifier, const WebCore::ResourceResponse&); | |
| 67 virtual void dispatchDidReceiveContentLength(WebCore::DocumentLoader*, unsigne
d long identifier, int lengthReceived); | |
| 68 virtual void dispatchDidFinishLoading(WebCore::DocumentLoader*, unsigned long
identifier); | |
| 69 virtual void dispatchDidFailLoading(WebCore::DocumentLoader*, unsigned long id
entifier, const WebCore::ResourceError&); | |
| 70 virtual bool dispatchDidLoadResourceFromMemoryCache(WebCore::DocumentLoader*,
const WebCore::ResourceRequest&, const WebCore::ResourceResponse&, int length); | |
| 71 virtual void dispatchDidLoadResourceByXMLHttpRequest(unsigned long identifier,
const WebCore::ScriptString&); | |
| 72 | |
| 73 virtual void dispatchDidHandleOnloadEvents(); | |
| 74 virtual void dispatchDidReceiveServerRedirectForProvisionalLoad(); | |
| 75 virtual void dispatchDidCancelClientRedirect(); | |
| 76 virtual void dispatchWillPerformClientRedirect(const WebCore::KURL&, double in
terval, double fireDate); | |
| 77 virtual void dispatchDidChangeLocationWithinPage(); | |
| 78 virtual void dispatchWillClose(); | |
| 79 virtual void dispatchDidReceiveIcon(); | |
| 80 virtual void dispatchDidStartProvisionalLoad(); | |
| 81 virtual void dispatchDidReceiveTitle(const WebCore::String& title); | |
| 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 virtual void dispatchDidFirstVisuallyNonEmptyLayout(); | |
| 89 | |
| 90 virtual WebCore::Frame* dispatchCreatePage(); | |
| 91 virtual void dispatchShow(); | |
| 92 | |
| 93 virtual void dispatchDecidePolicyForMIMEType(WebCore::FramePolicyFunction func
tion, const WebCore::String& mime_type, const WebCore::ResourceRequest&); | |
| 94 virtual void dispatchDecidePolicyForNewWindowAction(WebCore::FramePolicyFuncti
on function, const WebCore::NavigationAction& action, const WebCore::ResourceReq
uest& request, PassRefPtr<WebCore::FormState> form_state, const WebCore::String&
frame_name); | |
| 95 virtual void dispatchDecidePolicyForNavigationAction(WebCore::FramePolicyFunct
ion function, const WebCore::NavigationAction& action, const WebCore::ResourceRe
quest& request, PassRefPtr<WebCore::FormState> form_state); | |
| 96 virtual void cancelPolicyCheck(); | |
| 97 | |
| 98 virtual void dispatchUnableToImplementPolicy(const WebCore::ResourceError&); | |
| 99 | |
| 100 virtual void dispatchWillSubmitForm(WebCore::FramePolicyFunction, PassRefPtr<W
ebCore::FormState>); | |
| 101 | |
| 102 virtual void dispatchDidLoadMainResource(WebCore::DocumentLoader*); | |
| 103 virtual void revertToProvisionalState(WebCore::DocumentLoader*); | |
| 104 virtual void setMainDocumentError(WebCore::DocumentLoader*, const WebCore::Res
ourceError&); | |
| 105 | |
| 106 // Maybe these should go into a ProgressTrackerClient some day | |
| 107 virtual void willChangeEstimatedProgress() { } | |
| 108 virtual void didChangeEstimatedProgress() { } | |
| 109 virtual void postProgressStartedNotification(); | |
| 110 virtual void postProgressEstimateChangedNotification(); | |
| 111 virtual void postProgressFinishedNotification(); | |
| 112 | |
| 113 virtual void setMainFrameDocumentReady(bool); | |
| 114 | |
| 115 virtual void startDownload(const WebCore::ResourceRequest&); | |
| 116 | |
| 117 virtual void willChangeTitle(WebCore::DocumentLoader*); | |
| 118 virtual void didChangeTitle(WebCore::DocumentLoader*); | |
| 119 | |
| 120 virtual void committedLoad(WebCore::DocumentLoader*, const char*, int); | |
| 121 virtual void finishedLoading(WebCore::DocumentLoader*); | |
| 122 | |
| 123 virtual void updateGlobalHistory(); | |
| 124 virtual void updateGlobalHistoryRedirectLinks(); | |
| 125 | |
| 126 virtual bool shouldGoToHistoryItem(WebCore::HistoryItem*) const; | |
| 127 | |
| 128 virtual void didDisplayInsecureContent(); | |
| 129 virtual void didRunInsecureContent(WebCore::SecurityOrigin*); | |
| 130 | |
| 131 virtual WebCore::ResourceError blockedError(const WebCore::ResourceRequest&); | |
| 132 virtual WebCore::ResourceError cancelledError(const WebCore::ResourceRequest&)
; | |
| 133 virtual WebCore::ResourceError cannotShowURLError(const WebCore::ResourceReque
st&); | |
| 134 virtual WebCore::ResourceError interruptForPolicyChangeError(const WebCore::Re
sourceRequest&); | |
| 135 | |
| 136 virtual WebCore::ResourceError cannotShowMIMETypeError(const WebCore::Resource
Response&); | |
| 137 virtual WebCore::ResourceError fileDoesNotExistError(const WebCore::ResourceRe
sponse&); | |
| 138 virtual WebCore::ResourceError pluginWillHandleLoadError(const WebCore::Resour
ceResponse&); | |
| 139 | |
| 140 virtual bool shouldFallBack(const WebCore::ResourceError&); | |
| 141 | |
| 142 virtual bool canHandleRequest(const WebCore::ResourceRequest&) const; | |
| 143 virtual bool canShowMIMEType(const WebCore::String& MIMEType) const; | |
| 144 virtual bool representationExistsForURLScheme(const WebCore::String& URLScheme
) const; | |
| 145 virtual WebCore::String generatedMIMETypeForURLScheme(const WebCore::String& U
RLScheme) const; | |
| 146 | |
| 147 virtual void frameLoadCompleted(); | |
| 148 virtual void saveViewStateToItem(WebCore::HistoryItem*); | |
| 149 virtual void restoreViewState(); | |
| 150 virtual void provisionalLoadStarted(); | |
| 151 virtual void didFinishLoad(); | |
| 152 virtual void prepareForDataSourceReplacement(); | |
| 153 | |
| 154 virtual PassRefPtr<WebCore::DocumentLoader> createDocumentLoader( | |
| 155 const WebCore::ResourceRequest&, | |
| 156 const WebCore::SubstituteData&); | |
| 157 virtual void setTitle(const WebCore::String& title, const WebCore::KURL&); | |
| 158 | |
| 159 virtual WebCore::String userAgent(const WebCore::KURL&); | |
| 160 | |
| 161 virtual void savePlatformDataToCachedFrame(WebCore::CachedFrame*); | |
| 162 virtual void transitionToCommittedFromCachedFrame(WebCore::CachedFrame*); | |
| 163 virtual void transitionToCommittedForNewPage(); | |
| 164 | |
| 165 virtual bool canCachePage() const; | |
| 166 virtual void download(WebCore::ResourceHandle* handle, | |
| 167 const WebCore::ResourceRequest& request, | |
| 168 const WebCore::ResourceRequest& initialRequest, | |
| 169 const WebCore::ResourceResponse& response); | |
| 170 virtual PassRefPtr<WebCore::Frame> createFrame( | |
| 171 const WebCore::KURL& url, | |
| 172 const WebCore::String& name, | |
| 173 WebCore::HTMLFrameOwnerElement* ownerEleme
nt, | |
| 174 const WebCore::String& referrer, | |
| 175 bool allowsScrolling, int marginWidth, | |
| 176 int marginHeight); | |
| 177 virtual PassRefPtr<WebCore::Widget> createPlugin(const WebCore::IntSize&, | |
| 178 WebCore::HTMLPlugInElement*, | |
| 179 const WebCore::KURL&, | |
| 180 const WTF::Vector<WebCore::String>&, | |
| 181 const WTF::Vector<WebCore::String>&, | |
| 182 const WebCore::String&, | |
| 183 bool loadManually); | |
| 184 virtual void redirectDataToPlugin(WebCore::Widget* pluginWidget); | |
| 185 | |
| 186 virtual PassRefPtr<WebCore::Widget> createJavaAppletWidget( | |
| 187 const WebCore::IntSize&, | |
| 188 WebCore::HTMLAppletElement*, | |
| 189 const WebCore::KURL& /* base_url */, | |
| 190 const WTF::Vector<WebCore::String>& paramNames, | |
| 191 const WTF::Vector<WebCore::String>& paramValues); | |
| 192 | |
| 193 virtual WebCore::ObjectContentType objectContentType( | |
| 194 const WebCore::KURL& url, const WebCore::String& mimeType); | |
| 195 virtual WebCore::String overrideMediaType() const; | |
| 196 | |
| 197 virtual void didPerformFirstNavigation() const; | |
| 198 | |
| 199 virtual void registerForIconNotification(bool listen = true); | |
| 200 | |
| 201 private: | |
| 202 void makeDocumentView(); | |
| 203 | |
| 204 // Given a NavigationAction, determine the associated WebNavigationPolicy. | |
| 205 // For example, a middle click means "open in background tab". | |
| 206 static bool ActionSpecifiesNavigationPolicy( | |
| 207 const WebCore::NavigationAction& action, | |
| 208 WebKit::WebNavigationPolicy* policy); | |
| 209 | |
| 210 // Called when a dummy back-forward navigation is intercepted. | |
| 211 void HandleBackForwardNavigation(const WebCore::KURL&); | |
| 212 | |
| 213 PassOwnPtr<WebKit::WebPluginLoadObserver> GetPluginLoadObserver(); | |
| 214 | |
| 215 // The WebFrame that owns this object and manages its lifetime. Therefore, | |
| 216 // the web frame object is guaranteed to exist. | |
| 217 WebFrameImpl* webframe_; | |
| 218 | |
| 219 // True if makeRepresentation was called. We don't actually have a concept | |
| 220 // of a "representation", but we need to know when we're expected to have one. | |
| 221 // See finishedLoading(). | |
| 222 bool has_representation_; | |
| 223 | |
| 224 // Used to help track client redirects. When a provisional load starts, it | |
| 225 // has no redirects in its chain. But in the case of client redirects, we want | |
| 226 // to add that initial load as a redirect. When we get a new provisional load | |
| 227 // and the dest URL matches that load, we know that it was the result of a | |
| 228 // previous client redirect and the source should be added as a redirect. | |
| 229 // Both should be empty if unused. | |
| 230 WebCore::KURL expected_client_redirect_src_; | |
| 231 WebCore::KURL expected_client_redirect_dest_; | |
| 232 | |
| 233 // Contains a pointer to the plugin widget. | |
| 234 WTF::RefPtr<WebKit::WebPluginContainerImpl> plugin_widget_; | |
| 235 | |
| 236 // Indicates if we need to send over the initial notification to the plugin | |
| 237 // which specifies that the plugin should be ready to accept data. | |
| 238 bool sent_initial_response_to_plugin_; | |
| 239 | |
| 240 // The navigation policy to use for the next call to dispatchCreatePage. | |
| 241 WebKit::WebNavigationPolicy next_navigation_policy_; | |
| 242 }; | |
| 243 | |
| 244 #endif // #ifndef WEBKIT_GLUE_WEBFRAMELOADERCLIENT_IMPL_H_ | |
| OLD | NEW |