]>
git.saurik.com Git - iphone-api.git/blob - WebCore/FrameLoaderClient.h
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
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 * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
14 * its contributors may be used to endorse or promote products derived
15 * from this software without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 #ifndef FrameLoaderClient_h
30 #define FrameLoaderClient_h
32 #include "FrameLoaderTypes.h"
33 #include "ScrollTypes.h"
34 #include <wtf/Forward.h>
35 #include <wtf/Platform.h>
36 #include <wtf/Vector.h>
38 typedef class _jobject
* jobject
;
40 #if PLATFORM(MAC) && !defined(__OBJC__)
41 class NSCachedURLResponse
;
47 class AuthenticationChallenge
;
56 class HTMLFrameOwnerElement
;
59 class NavigationAction
;
60 class ProtectionSpace
;
64 class ResourceResponse
;
70 class ResourceRequest
;
72 typedef void ( FrameLoader ::* FramePolicyFunction
)( PolicyAction
);
74 class FrameLoaderClient
{
76 virtual ~ FrameLoaderClient ();
77 virtual void frameLoaderDestroyed () = 0 ;
79 virtual bool hasWebView () const = 0 ; // mainly for assertions
81 virtual bool hasHTMLView () const { return true ; }
83 virtual void makeRepresentation ( DocumentLoader
*) = 0 ;
84 virtual void forceLayout () = 0 ;
85 virtual void forceLayoutForNonHTML () = 0 ;
87 virtual void setCopiesOnScroll () = 0 ;
89 virtual void detachedFromParent2 () = 0 ;
90 virtual void detachedFromParent3 () = 0 ;
92 virtual void assignIdentifierToInitialRequest ( unsigned long identifier
, DocumentLoader
*, const ResourceRequest
&) = 0 ;
94 virtual void dispatchWillSendRequest ( DocumentLoader
*, unsigned long identifier
, ResourceRequest
&, const ResourceResponse
& redirectResponse
) = 0 ;
95 virtual bool shouldUseCredentialStorage ( DocumentLoader
*, unsigned long identifier
) = 0 ;
96 virtual void dispatchDidReceiveAuthenticationChallenge ( DocumentLoader
*, unsigned long identifier
, const AuthenticationChallenge
&) = 0 ;
97 virtual void dispatchDidCancelAuthenticationChallenge ( DocumentLoader
*, unsigned long identifier
, const AuthenticationChallenge
&) = 0 ;
99 virtual bool canAuthenticateAgainstProtectionSpace ( DocumentLoader
*, unsigned long identifier
, const ProtectionSpace
&) = 0 ;
101 virtual void dispatchDidReceiveResponse ( DocumentLoader
*, unsigned long identifier
, const ResourceResponse
&) = 0 ;
102 virtual void dispatchDidReceiveContentLength ( DocumentLoader
*, unsigned long identifier
, int lengthReceived
) = 0 ;
103 virtual void dispatchDidFinishLoading ( DocumentLoader
*, unsigned long identifier
) = 0 ;
104 virtual void dispatchDidFailLoading ( DocumentLoader
*, unsigned long identifier
, const ResourceError
&) = 0 ;
105 virtual bool dispatchDidLoadResourceFromMemoryCache ( DocumentLoader
*, const ResourceRequest
&, const ResourceResponse
&, int length
) = 0 ;
107 virtual void dispatchDidHandleOnloadEvents () = 0 ;
108 virtual void dispatchDidReceiveServerRedirectForProvisionalLoad () = 0 ;
109 virtual void dispatchDidCancelClientRedirect () = 0 ;
110 virtual void dispatchWillPerformClientRedirect ( const KURL
&, double interval
, double fireDate
) = 0 ;
111 virtual void dispatchDidChangeLocationWithinPage () = 0 ;
112 virtual void dispatchWillClose () = 0 ;
113 virtual void dispatchDidReceiveIcon () = 0 ;
114 virtual void dispatchDidStartProvisionalLoad () = 0 ;
115 virtual void dispatchDidReceiveTitle ( const String
& title
) = 0 ;
116 virtual void dispatchDidCommitLoad () = 0 ;
117 virtual void dispatchDidFailProvisionalLoad ( const ResourceError
&) = 0 ;
118 virtual void dispatchDidFailLoad ( const ResourceError
&) = 0 ;
119 virtual void dispatchDidFinishDocumentLoad () = 0 ;
120 virtual void dispatchDidFinishLoad () = 0 ;
121 virtual void dispatchDidFirstLayout () = 0 ;
122 virtual void dispatchDidFirstVisuallyNonEmptyLayout () = 0 ;
124 virtual Frame
* dispatchCreatePage () = 0 ;
125 virtual void dispatchShow () = 0 ;
127 virtual void dispatchDecidePolicyForMIMEType ( FramePolicyFunction
, const String
& MIMEType
, const ResourceRequest
&) = 0 ;
128 virtual void dispatchDecidePolicyForNewWindowAction ( FramePolicyFunction
, const NavigationAction
&, const ResourceRequest
&, PassRefPtr
< FormState
>, const String
& frameName
) = 0 ;
129 virtual void dispatchDecidePolicyForNavigationAction ( FramePolicyFunction
, const NavigationAction
&, const ResourceRequest
&, PassRefPtr
< FormState
>) = 0 ;
130 virtual void cancelPolicyCheck () = 0 ;
132 virtual void dispatchUnableToImplementPolicy ( const ResourceError
&) = 0 ;
134 virtual void dispatchWillSubmitForm ( FramePolicyFunction
, PassRefPtr
< FormState
>) = 0 ;
136 virtual void dispatchDidLoadMainResource ( DocumentLoader
*) = 0 ;
137 virtual void revertToProvisionalState ( DocumentLoader
*) = 0 ;
138 virtual void setMainDocumentError ( DocumentLoader
*, const ResourceError
&) = 0 ;
140 // Maybe these should go into a ProgressTrackerClient some day
141 virtual void willChangeEstimatedProgress () { }
142 virtual void didChangeEstimatedProgress () { }
143 virtual void postProgressStartedNotification () = 0 ;
144 virtual void postProgressEstimateChangedNotification () = 0 ;
145 virtual void postProgressFinishedNotification () = 0 ;
147 virtual void setMainFrameDocumentReady ( bool ) = 0 ;
149 virtual void startDownload ( const ResourceRequest
&) = 0 ;
151 virtual void willChangeTitle ( DocumentLoader
*) = 0 ;
152 virtual void didChangeTitle ( DocumentLoader
*) = 0 ;
154 virtual void committedLoad ( DocumentLoader
*, const char *, int ) = 0 ;
155 virtual void finishedLoading ( DocumentLoader
*) = 0 ;
157 virtual void updateGlobalHistory () = 0 ;
158 virtual void updateGlobalHistoryForRedirectWithoutHistoryItem () = 0 ;
160 virtual bool shouldGoToHistoryItem ( HistoryItem
*) const = 0 ;
162 virtual ResourceError
cancelledError ( const ResourceRequest
&) = 0 ;
163 virtual ResourceError
blockedError ( const ResourceRequest
&) = 0 ;
164 virtual ResourceError
cannotShowURLError ( const ResourceRequest
&) = 0 ;
165 virtual ResourceError
interruptForPolicyChangeError ( const ResourceRequest
&) = 0 ;
167 virtual ResourceError
cannotShowMIMETypeError ( const ResourceResponse
&) = 0 ;
168 virtual ResourceError
fileDoesNotExistError ( const ResourceResponse
&) = 0 ;
169 virtual ResourceError
pluginWillHandleLoadError ( const ResourceResponse
&) = 0 ;
171 virtual bool shouldFallBack ( const ResourceError
&) = 0 ;
173 virtual bool canHandleRequest ( const ResourceRequest
&) const = 0 ;
174 virtual bool canShowMIMEType ( const String
& MIMEType
) const = 0 ;
175 virtual bool representationExistsForURLScheme ( const String
& URLScheme
) const = 0 ;
176 virtual String
generatedMIMETypeForURLScheme ( const String
& URLScheme
) const = 0 ;
178 virtual void frameLoadCompleted () = 0 ;
179 virtual void saveViewStateToItem ( HistoryItem
*) = 0 ;
180 virtual void restoreViewState () = 0 ;
181 virtual void provisionalLoadStarted () = 0 ;
182 virtual void didFinishLoad () = 0 ;
183 virtual void prepareForDataSourceReplacement () = 0 ;
185 virtual PassRefPtr
< DocumentLoader
> createDocumentLoader ( const ResourceRequest
&, const SubstituteData
&) = 0 ;
186 virtual void setTitle ( const String
& title
, const KURL
&) = 0 ;
188 virtual String
userAgent ( const KURL
&) = 0 ;
190 virtual void savePlatformDataToCachedFrame ( CachedFrame
*) = 0 ;
191 virtual void transitionToCommittedFromCachedFrame ( CachedFrame
*) = 0 ;
192 virtual void transitionToCommittedForNewPage () = 0 ;
194 virtual bool canCachePage () const = 0 ;
195 virtual void download ( ResourceHandle
*, const ResourceRequest
&, const ResourceRequest
&, const ResourceResponse
&) = 0 ;
197 virtual PassRefPtr
< Frame
> createFrame ( const KURL
& url
, const String
& name
, HTMLFrameOwnerElement
* ownerElement
,
198 const String
& referrer
, bool allowsScrolling
, int marginWidth
, int marginHeight
) = 0 ;
199 virtual Widget
* createPlugin ( const IntSize
&, Element
*, const KURL
&, const Vector
< String
>&, const Vector
< String
>&, const String
&, bool loadManually
) = 0 ;
200 virtual void redirectDataToPlugin ( Widget
* pluginWidget
) = 0 ;
202 virtual Widget
* createJavaAppletWidget ( const IntSize
&, Element
*, const KURL
& baseURL
, const Vector
< String
>& paramNames
, const Vector
< String
>& paramValues
) = 0 ;
204 virtual ObjectContentType
objectContentType ( const KURL
& url
, const String
& mimeType
) = 0 ;
205 virtual String
overrideMediaType () const = 0 ;
207 virtual void windowObjectCleared () = 0 ;
208 virtual void didPerformFirstNavigation () const = 0 ; // "Navigation" here means a transition from one page to another that ends up in the back/forward list.
210 virtual void registerForIconNotification ( bool listen
= true ) = 0 ;
212 #if ENABLE(MAC_JAVA_BRIDGE)
213 virtual jobject
javaApplet ( NSView
*) { return 0 ; }
215 virtual NSCachedURLResponse
* willCacheResponse ( DocumentLoader
*, unsigned long identifier
, NSCachedURLResponse
*) const = 0 ;
217 virtual bool shouldUsePluginDocument ( const String
& /*mimeType*/ ) const { return false ; }
220 static void transitionToCommittedForNewPage ( Frame
*, const IntSize
&, const Color
&, bool , const IntSize
&, bool ,
221 ScrollbarMode
= ScrollbarAuto
, ScrollbarMode
= ScrollbarAuto
);
224 } // namespace WebCore
226 #endif // FrameLoaderClient_h