• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2006 Zack Rusin <zack@kde.org>
3  * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
4  * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com> All rights reserved.
5  *
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  *
16  * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
17  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
20  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
24  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #ifndef FrameLoaderClientHaiku_h
30 #define FrameLoaderClientHaiku_h
31 
32 #include "FrameLoader.h"
33 #include "FrameLoaderClient.h"
34 #include "KURL.h"
35 #include "ResourceResponse.h"
36 
37 class BMessenger;
38 class WebView;
39 
40 namespace WebCore {
41     class AuthenticationChallenge;
42     class DocumentLoader;
43     class Element;
44     class FormState;
45     class NavigationAction;
46     class ResourceLoader;
47     class String;
48 
49     struct LoadErrorResetToken;
50 
51     class FrameLoaderClientHaiku : public FrameLoaderClient {
52     public:
53         FrameLoaderClientHaiku();
~FrameLoaderClientHaiku()54         ~FrameLoaderClientHaiku() { }
55         void setFrame(Frame*);
56         void setWebView(WebView*);
57         virtual void detachFrameLoader();
58 
59         virtual bool hasWebView() const;
60 
61         virtual bool hasBackForwardList() const;
62         virtual void resetBackForwardList();
63 
64         virtual bool provisionalItemIsTarget() const;
65 
66         virtual void makeRepresentation(DocumentLoader*);
67         virtual void forceLayout();
68         virtual void forceLayoutForNonHTML();
69 
70         virtual void updateHistoryForCommit();
71 
72         virtual void updateHistoryForBackForwardNavigation();
73         virtual void updateHistoryForReload();
74         virtual void updateHistoryForStandardLoad();
75         virtual void updateHistoryForInternalLoad();
76 
77         virtual void updateHistoryAfterClientRedirect();
78 
79         virtual void setCopiesOnScroll();
80 
81         virtual LoadErrorResetToken* tokenForLoadErrorReset();
82         virtual void resetAfterLoadError(LoadErrorResetToken*);
83         virtual void doNotResetAfterLoadError(LoadErrorResetToken*);
84 
85         virtual void willCloseDocument();
86 
87         virtual void detachedFromParent2();
88         virtual void detachedFromParent3();
89 
90         virtual void frameLoaderDestroyed();
91 
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 setMainDocumentError(DocumentLoader*, const ResourceError&);
162         virtual void committedLoad(DocumentLoader*, const char*, int);
163         virtual ResourceError cancelledError(const ResourceRequest&);
164         virtual ResourceError blockedError(const ResourceRequest&);
165         virtual ResourceError cannotShowURLError(const ResourceRequest&);
166         virtual ResourceError interruptForPolicyChangeError(const ResourceRequest&);
167         virtual ResourceError cannotShowMIMETypeError(const ResourceResponse&);
168         virtual ResourceError fileDoesNotExistError(const ResourceResponse&);
169         virtual bool shouldFallBack(const ResourceError&);
170         virtual WTF::PassRefPtr<DocumentLoader> createDocumentLoader(const ResourceRequest&,
171                                                                      const SubstituteData&);
172         virtual void download(ResourceHandle*, const ResourceRequest&, const ResourceRequest&,
173                               const ResourceResponse&);
174 
175         virtual void assignIdentifierToInitialRequest(unsigned long identifier,
176                                                       DocumentLoader*,
177                                                       const ResourceRequest&);
178 
179         virtual void dispatchWillSendRequest(DocumentLoader*, unsigned long, ResourceRequest&,
180                                              const ResourceResponse&);
181         virtual bool shouldUseCredentialStorage(DocumentLoader*, unsigned long identifier);
182         virtual void dispatchDidReceiveAuthenticationChallenge(DocumentLoader*,
183                                                                unsigned long identifier,
184                                                                const AuthenticationChallenge&);
185         virtual void dispatchDidCancelAuthenticationChallenge(DocumentLoader*,
186                                                               unsigned long identifier,
187                                                               const AuthenticationChallenge&);
188         virtual void dispatchDidReceiveResponse(DocumentLoader*, unsigned long,
189                                                 const ResourceResponse&);
190         virtual void dispatchDidReceiveContentLength(DocumentLoader*, unsigned long, int);
191         virtual void dispatchDidFinishLoading(DocumentLoader*, unsigned long);
192         virtual void dispatchDidFailLoading(DocumentLoader*, unsigned long,
193                                             const ResourceError&);
194         virtual bool dispatchDidLoadResourceFromMemoryCache(DocumentLoader*,
195                                                             const ResourceRequest&,
196                                                             const ResourceResponse&, int);
197         virtual void dispatchDidLoadResourceByXMLHttpRequest(unsigned long, const ScriptString&);
198 
199         virtual void dispatchDidFailProvisionalLoad(const ResourceError&);
200         virtual void dispatchDidFailLoad(const ResourceError&);
201         virtual Frame* dispatchCreatePage();
202         virtual void dispatchDecidePolicyForMIMEType(FramePolicyFunction,
203                                                      const String&,
204                                                      const ResourceRequest&);
205         virtual void dispatchDecidePolicyForNewWindowAction(FramePolicyFunction,
206                                                             const NavigationAction&,
207                                                             const ResourceRequest&,
208                                                             PassRefPtr<FormState>, const String&);
209         virtual void dispatchDecidePolicyForNavigationAction(FramePolicyFunction,
210                                                              const NavigationAction&,
211                                                              const ResourceRequest&,
212                                                              PassRefPtr<FormState>);
213         virtual void dispatchUnableToImplementPolicy(const ResourceError&);
214 
215         virtual void startDownload(const ResourceRequest&);
216 
217         // FIXME: This should probably not be here, but it's needed for the tests currently.
218         virtual void partClearedInBegin();
219 
220         virtual PassRefPtr<Frame> createFrame(const KURL& url, const String& name,
221                                               HTMLFrameOwnerElement*, const String& referrer,
222                                               bool allowsScrolling, int marginWidth, int marginHeight);
223         virtual PassRefPtr<Widget> createPlugin(const IntSize&, HTMLPlugInElement*, const KURL&,
224                                                 const Vector<String>&, const Vector<String>&, const String&,
225                                                 bool loadManually);
226         virtual void redirectDataToPlugin(Widget* pluginWidget);
227         virtual ResourceError pluginWillHandleLoadError(const ResourceResponse&);
228 
229         virtual PassRefPtr<Widget> createJavaAppletWidget(const IntSize&, HTMLAppletElement*,
230                                                           const KURL& baseURL, const Vector<String>& paramNames,
231                                                           const Vector<String>& paramValues);
232 
233         virtual ObjectContentType objectContentType(const KURL& url, const String& mimeType);
234         virtual String overrideMediaType() const;
235 
236         virtual void dispatchDidClearWindowObjectInWorld(DOMWrapperWorld*);
237         virtual void documentElementAvailable();
238 
239         virtual void didPerformFirstNavigation() const;
240 
241         virtual void registerForIconNotification(bool listen = true);
242 
243     private:
244         Frame* m_frame;
245         WebView* m_webView;
246         BMessenger* m_messenger;
247         ResourceResponse m_response;
248         bool m_firstData;
249     };
250 } // namespace WebCore
251 
252 #endif // FrameLoaderClientHaiku_h
253 
254