• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2007 Kevin Ollivier <kevino@theolliviers.com>
3  *
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
16  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
19  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
23  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 #ifndef FrameLoaderClientWx_H
29 #define FrameLoaderClientWx_H
30 
31 #include "FrameLoaderClient.h"
32 #include "FrameLoader.h"
33 #include "KURL.h"
34 #include "PluginView.h"
35 #include "ResourceResponse.h"
36 #include "HTMLPlugInElement.h"
37 
38 class wxWebFrame;
39 class wxWebView;
40 
41 namespace WebCore {
42 
43     class AuthenticationChallenge;
44     class DocumentLoader;
45     class Element;
46     class FormState;
47     class NavigationAction;
48     class String;
49     class ResourceLoader;
50 
51     struct LoadErrorResetToken;
52 
53     class FrameLoaderClientWx : public FrameLoaderClient {
54     public:
55         FrameLoaderClientWx();
56         ~FrameLoaderClientWx();
57         void setFrame(wxWebFrame *frame);
58         void setWebView(wxWebView *webview);
59 
60         virtual bool hasWebView() const; // mainly for assertions
61 
62         virtual bool hasBackForwardList() const;
63         virtual void resetBackForwardList();
64 
65         virtual bool provisionalItemIsTarget() const;
66 
67         virtual void makeRepresentation(DocumentLoader*);
68         virtual void forceLayout();
69         virtual void forceLayoutForNonHTML();
70 
71         virtual void updateHistoryForCommit();
72 
73         virtual void updateHistoryForBackForwardNavigation();
74         virtual void updateHistoryForReload();
75         virtual void updateHistoryForStandardLoad();
76         virtual void updateHistoryForInternalLoad();
77 
78         virtual void updateHistoryAfterClientRedirect();
79 
80         virtual void setCopiesOnScroll();
81 
82         virtual LoadErrorResetToken* tokenForLoadErrorReset();
83         virtual void resetAfterLoadError(LoadErrorResetToken*);
84         virtual void doNotResetAfterLoadError(LoadErrorResetToken*);
85 
86         virtual void willCloseDocument();
87 
88         virtual void detachedFromParent2();
89         virtual void detachedFromParent3();
90 
91         virtual void frameLoaderDestroyed();
92         virtual bool canHandleRequest(const ResourceRequest&) const;
93 
94         virtual void dispatchDidHandleOnloadEvents();
95         virtual void dispatchDidReceiveServerRedirectForProvisionalLoad();
96         virtual void dispatchDidCancelClientRedirect();
97         virtual void dispatchWillPerformClientRedirect(const KURL&, double interval, double fireDate);
98         virtual void dispatchDidChangeLocationWithinPage();
99         virtual void dispatchDidPushStateWithinPage();
100         virtual void dispatchDidReplaceStateWithinPage();
101         virtual void dispatchDidPopStateWithinPage();
102         virtual void dispatchWillClose();
103         virtual void dispatchDidReceiveIcon();
104         virtual void dispatchDidStartProvisionalLoad();
105         virtual void dispatchDidReceiveTitle(const String& title);
106         virtual void dispatchDidCommitLoad();
107         virtual void dispatchDidFinishDocumentLoad();
108         virtual void dispatchDidFinishLoad();
109         virtual void dispatchDidFirstLayout();
110         virtual void dispatchDidFirstVisuallyNonEmptyLayout();
111 
112         virtual void dispatchShow();
113         virtual void cancelPolicyCheck();
114 
115         virtual void dispatchWillSubmitForm(FramePolicyFunction, PassRefPtr<FormState>);
116 
117         virtual void dispatchDidLoadMainResource(DocumentLoader*);
118         virtual void revertToProvisionalState(DocumentLoader*);
119 
120         virtual void postProgressStartedNotification();
121         virtual void postProgressEstimateChangedNotification();
122         virtual void postProgressFinishedNotification();
123 
124         virtual void progressStarted();
125         virtual void progressCompleted();
126         virtual void setMainFrameDocumentReady(bool);
127         virtual void willChangeTitle(DocumentLoader*);
128         virtual void didChangeTitle(DocumentLoader*);
129         virtual void finishedLoading(DocumentLoader*);
130 
131         virtual bool canShowMIMEType(const String& MIMEType) const;
132         virtual bool representationExistsForURLScheme(const String& URLScheme) const;
133         virtual String generatedMIMETypeForURLScheme(const String& URLScheme) const;
134 
135         virtual void frameLoadCompleted();
136         virtual void saveViewStateToItem(HistoryItem*);
137         virtual void restoreViewState();
138         virtual void restoreScrollPositionAndViewState();
139         virtual void provisionalLoadStarted();
140         virtual bool shouldTreatURLAsSameAsCurrent(const KURL&) const;
141         virtual void addHistoryItemForFragmentScroll();
142         virtual void didFinishLoad();
143         virtual void prepareForDataSourceReplacement();
144         virtual void setTitle(const String& title, const KURL&);
145 
146         virtual String userAgent(const KURL&);
147 
148         virtual void savePlatformDataToCachedFrame(WebCore::CachedFrame*);
149         virtual void transitionToCommittedFromCachedFrame(WebCore::CachedFrame*);
150         virtual void transitionToCommittedForNewPage();
151 
152         virtual void updateGlobalHistory();
153         virtual void updateGlobalHistoryRedirectLinks();
154         virtual bool shouldGoToHistoryItem(HistoryItem*) const;
155         virtual void dispatchDidAddBackForwardItem(HistoryItem*) const;
156         virtual void dispatchDidRemoveBackForwardItem(HistoryItem*) const;
157         virtual void dispatchDidChangeBackForwardIndex() const;
158         virtual void saveScrollPositionAndViewStateToItem(HistoryItem*);
159         virtual bool canCachePage() const;
160 
161         virtual void didDisplayInsecureContent();
162         virtual void didRunInsecureContent(SecurityOrigin*);
163 
164         virtual void setMainDocumentError(DocumentLoader*, const ResourceError&);
165         virtual void committedLoad(DocumentLoader*, const char*, int);
166         virtual ResourceError cancelledError(const ResourceRequest&);
167         virtual ResourceError blockedError(const ResourceRequest&);
168         virtual ResourceError cannotShowURLError(const ResourceRequest&);
169         virtual ResourceError interruptForPolicyChangeError(const ResourceRequest&);
170         virtual ResourceError cannotShowMIMETypeError(const ResourceResponse&);
171         virtual ResourceError fileDoesNotExistError(const ResourceResponse&);
172         virtual bool shouldFallBack(const ResourceError&);
173         virtual WTF::PassRefPtr<DocumentLoader> createDocumentLoader(const ResourceRequest&, const SubstituteData&);
174         virtual void download(ResourceHandle*, const ResourceRequest&, const ResourceRequest&, const ResourceResponse&);
175 
176         virtual void assignIdentifierToInitialRequest(unsigned long identifier, DocumentLoader*, const ResourceRequest&);
177 
178         virtual void dispatchWillSendRequest(DocumentLoader*, unsigned long, ResourceRequest&, const ResourceResponse&);
179         virtual bool shouldUseCredentialStorage(DocumentLoader*, unsigned long identifier);
180         virtual void dispatchDidReceiveAuthenticationChallenge(DocumentLoader*, unsigned long identifier, const AuthenticationChallenge&);
181         virtual void dispatchDidCancelAuthenticationChallenge(DocumentLoader*, unsigned long identifier, const AuthenticationChallenge&);
182         virtual void dispatchDidReceiveResponse(DocumentLoader*, unsigned long, const ResourceResponse&);
183         virtual void dispatchDidReceiveContentLength(DocumentLoader*, unsigned long, int);
184         virtual void dispatchDidFinishLoading(DocumentLoader*, unsigned long);
185         virtual void dispatchDidFailLoading(DocumentLoader*, unsigned long, const ResourceError&);
186         virtual bool dispatchDidLoadResourceFromMemoryCache(DocumentLoader*, const ResourceRequest&, const ResourceResponse&, int);
187         virtual void dispatchDidLoadResourceByXMLHttpRequest(unsigned long, const ScriptString&);
188 
189         virtual void dispatchDidFailProvisionalLoad(const ResourceError&);
190         virtual void dispatchDidFailLoad(const ResourceError&);
191         virtual Frame* dispatchCreatePage();
192         virtual void dispatchDecidePolicyForMIMEType(FramePolicyFunction function, const String&, const ResourceRequest&);
193         virtual void dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function, const NavigationAction&, const ResourceRequest&, PassRefPtr<FormState>, const String&);
194         virtual void dispatchDecidePolicyForNavigationAction(FramePolicyFunction function, const NavigationAction&, const ResourceRequest&, PassRefPtr<FormState>);
195         virtual void dispatchUnableToImplementPolicy(const ResourceError&);
196 
197         virtual void startDownload(const ResourceRequest&);
198 
199         // FIXME: This should probably not be here, but it's needed for the tests currently
200         virtual void partClearedInBegin();
201 
202         virtual PassRefPtr<Frame> createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement,
203                                    const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight);
204         virtual PassRefPtr<Widget> createPlugin(const IntSize&, HTMLPlugInElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool loadManually) ;
205         virtual void redirectDataToPlugin(Widget* pluginWidget);
206         virtual ResourceError pluginWillHandleLoadError(const ResourceResponse&);
207 
208         virtual PassRefPtr<Widget> createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL& baseURL, const Vector<String>& paramNames, const Vector<String>& paramValues);
209 
210         virtual ObjectContentType objectContentType(const KURL& url, const String& mimeType);
211         virtual String overrideMediaType() const;
212 
213         virtual void dispatchDidClearWindowObjectInWorld(DOMWrapperWorld*);
214         virtual void documentElementAvailable();
215 
216         virtual void didPerformFirstNavigation() const;
217 
218         virtual void registerForIconNotification(bool listen = true);
219 
220         virtual bool shouldUsePluginDocument(const String &mimeType) const;
221 
222     private:
223         wxWebFrame *m_webFrame;
224         Frame* m_frame;
225         wxWebView *m_webView;
226         PluginView* m_pluginView;
227         bool m_hasSentResponseToPlugin;
228         ResourceResponse m_response;
229         bool m_firstData;
230     };
231 
232 }
233 
234 #endif
235