3 Copyright 2001 Apple, Inc. All rights reserved.
6 #import <WebKit/WebView.h>
7 #import <WebKit/WebFramePrivate.h>
11 @class WebPreferences;
12 @class WebCoreSettings;
14 @protocol WebFormDelegate;
16 typedef struct _WebResourceDelegateImplementationCache {
17 uint delegateImplementsDidCancelAuthenticationChallenge:1;
18 uint delegateImplementsDidReceiveAuthenticationChallenge:1;
19 uint delegateImplementsDidReceiveResponse:1;
20 uint delegateImplementsDidReceiveContentLength:1;
21 uint delegateImplementsDidFinishLoadingFromDataSource:1;
22 uint delegateImplementsWillSendRequest:1;
23 uint delegateImplementsIdentifierForRequest:1;
24 } WebResourceDelegateImplementationCache;
26 extern NSString *_WebCanGoBackKey;
27 extern NSString *_WebCanGoForwardKey;
28 extern NSString *_WebEstimatedProgressKey;
29 extern NSString *_WebIsLoadingKey;
30 extern NSString *_WebMainFrameIconKey;
31 extern NSString *_WebMainFrameTitleKey;
32 extern NSString *_WebMainFrameURLKey;
35 WebDashboardBehaviorAlwaysSendMouseEventsToAllWindows,
36 WebDashboardBehaviorAlwaysSendActiveNullEventsToPlugIns,
37 WebDashboardBehaviorAlwaysAcceptsFirstMouse,
38 WebDashboardBehaviorAllowWheelScrolling
39 } WebDashboardBehavior;
42 @interface WebView (WebPendingPublic)
44 - (void)setMainFrameURL:(NSString *)URLString;
45 - (NSString *)mainFrameURL;
47 - (NSString *)mainFrameTitle;
48 - (NSImage *)mainFrameIcon;
50 - (void)setDrawsBackground:(BOOL)drawsBackround;
51 - (BOOL)drawsBackground;
53 - (IBAction)toggleContinuousSpellChecking:(id)sender;
55 - (BOOL)isContinuousGrammarCheckingEnabled;
56 - (void)setContinuousGrammarCheckingEnabled:(BOOL)flag;
57 - (void)toggleContinuousGrammarChecking:(id)sender;
59 - (void)toggleSmartInsertDelete:(id)sender;
63 @interface WebView (WebPrivate)
65 + (BOOL)_viewClass:(Class *)vClass andRepresentationClass:(Class *)rClass forMIMEType:(NSString *)MIMEType;
67 + (NSArray *)_supportedFileExtensions;
71 @abstract Checks if the WebKit can show the content of the file at the specified path.
72 @param path The path of the file to check
73 @result YES if the WebKit can show the content of the file at the specified path.
75 + (BOOL)canShowFile:(NSString *)path;
78 @method suggestedFileExtensionForMIMEType:
79 @param MIMEType The MIME type to check.
80 @result The extension based on the MIME type
82 + (NSString *)suggestedFileExtensionForMIMEType: (NSString *)MIMEType;
85 @method frameForDataSource:
86 @abstract Return the frame associated with the data source.
87 @discussion Traverses the frame tree to find the frame associated
89 @param datasource The datasource to match against each frame.
90 @result The frame that has the associated datasource.
92 - (WebFrame *)_frameForDataSource: (WebDataSource *)dataSource;
96 @abstract Return the frame associated with the view.
97 @discussion Traverses the frame tree to find the view.
98 @param aView The view to match against each frame.
99 @result The frame that has the associated view.
101 - (WebFrame *)_frameForView: (WebFrameView *)aView;
103 - (WebFrame *)_createFrameNamed:(NSString *)name inParent:(WebFrame *)parent allowsScrolling:(BOOL)allowsScrolling;
105 - (void)_finishedLoadingResourceFromDataSource:(WebDataSource *)dataSource;
106 - (void)_receivedError:(NSError *)error fromDataSource:(WebDataSource *)dataSource;
107 - (void)_mainReceivedBytesSoFar:(unsigned)bytesSoFar fromDataSource:(WebDataSource *)dataSource complete:(BOOL)isComplete;
108 - (void)_mainReceivedError:(NSError *)error fromDataSource:(WebDataSource *)dataSource complete:(BOOL)isComplete;
109 + (NSString *)_MIMETypeForFile:(NSString *)path;
110 - (void)_downloadURL:(NSURL *)URL;
111 - (void)_downloadURL:(NSURL *)URL toDirectory:(NSString *)directoryPath;
113 - (BOOL)defersCallbacks;
114 - (void)setDefersCallbacks:(BOOL)defers;
116 - (void)_setTopLevelFrameName:(NSString *)name;
117 - (WebFrame *)_findFrameInThisWindowNamed:(NSString *)name sourceFrame:(WebFrame *)source;
118 - (WebFrame *)_findFrameNamed:(NSString *)name sourceFrame:(WebFrame *)source;
120 - (WebView *)_openNewWindowWithRequest:(NSURLRequest *)request;
122 - (NSMenu *)_menuForElement:(NSDictionary *)element;
124 - (void)_mouseDidMoveOverElement:(NSDictionary *)dictionary modifierFlags:(unsigned)modifierFlags;
127 Could be worth adding to the API.
129 @abstract Loads the view with the contents described by the item, including frame content
130 described by child items.
131 @param item The item to load. It is not retained, but a copy will appear in the
132 BackForwardList on this WebView.
134 - (void)_loadItem:(WebHistoryItem *)item;
136 Could be worth adding to the API.
137 @method loadItemsFromOtherView:
138 @abstract Loads the view with the contents of the other view, including its backforward list.
139 @param otherView The WebView from which to copy contents.
141 - (void)_loadBackForwardListFromOtherView:(WebView *)otherView;
143 - (void)_goToItem:(WebHistoryItem *)item withLoadType:(WebFrameLoadType)type;
145 // May well become public
146 - (void)_setFormDelegate:(id<WebFormDelegate>)delegate;
147 - (id<WebFormDelegate>)_formDelegate;
149 - (WebCoreSettings *)_settings;
150 - (void)_updateWebCoreSettingsFromPreferences:(WebPreferences *)prefs;
152 - (id)_frameLoadDelegateForwarder;
153 - (id)_resourceLoadDelegateForwarder;
154 - (void)_cacheResourceLoadDelegateImplementations;
155 - (WebResourceDelegateImplementationCache)_resourceLoadDelegateImplementations;
156 - (id)_policyDelegateForwarder;
157 - (id)_UIDelegateForwarder;
158 - (id)_editingDelegateForwarder;
160 - (void)_closeWindow;
162 - (void)_setInitiatedDrag:(BOOL)initiatedDrag;
167 @method _registerViewClass:representationClass:forURLScheme:
168 @discussion Register classes that implement WebDocumentView and WebDocumentRepresentation respectively.
169 @param viewClass The WebDocumentView class to use to render data for a given MIME type.
170 @param representationClass The WebDocumentRepresentation class to use to represent data of the given MIME type.
171 @param scheme The URL scheme to represent with an object of the given class.
173 + (void)_registerViewClass:(Class)viewClass representationClass:(Class)representationClass forURLScheme:(NSString *)URLScheme;
175 + (void)_unregisterViewClassAndRepresentationClassForMIMEType:(NSString *)MIMEType;
177 + (NSString *)_generatedMIMETypeForURLScheme:(NSString *)URLScheme;
178 + (BOOL)_representationExistsForURLScheme:(NSString *)URLScheme;
180 @method _canHandleRequest:
181 @abstract Performs a "preflight" operation that performs some
182 speculative checks to see if a request can be used to create
183 a WebDocumentView and WebDocumentRepresentation.
184 @discussion The result of this method is valid only as long as no
185 protocols or schemes are registered or unregistered, and as long as
186 the request is not mutated (if the request is mutable). Hence, clients
187 should be prepared to handle failures even if they have performed request
188 preflighting by caling this method.
189 @param request The request to preflight.
190 @result YES if it is likely that a WebDocumentView and WebDocumentRepresentation
191 can be created for the request, NO otherwise.
193 + (BOOL)_canHandleRequest:(NSURLRequest *)request;
195 + (NSString *)_decodeData:(NSData *)data;
197 - (void)_pushPerformingProgrammaticFocus;
198 - (void)_popPerformingProgrammaticFocus;
199 - (BOOL)_isPerformingProgrammaticFocus;
201 // Methods dealing with the estimated progress completion.
202 - (void)_progressStarted:(WebFrame *)frame;
203 - (void)_progressCompleted:(WebFrame *)frame;
204 - (void)_incrementProgressForConnectionDelegate:(id)connectionDelegate response:(NSURLResponse *)response;
205 - (void)_incrementProgressForConnectionDelegate:(id)connectionDelegate data:(NSData *)dataSource;
206 - (void)_completeProgressForConnectionDelegate:(id)connectionDelegate;
208 - (void)_didStartProvisionalLoadForFrame:(WebFrame *)frame;
209 - (void)_didCommitLoadForFrame:(WebFrame *)frame;
210 - (void)_didFinishLoadForFrame:(WebFrame *)frame;
211 - (void)_didFailLoadWithError:(NSError *)error forFrame:(WebFrame *)frame;
212 - (void)_didFailProvisionalLoadWithError:(NSError *)error forFrame:(WebFrame *)frame;
214 - (void)_willChangeValueForKey:(NSString *)key;
215 - (void)_didChangeValueForKey:(NSString *)key;
217 - (void)_reloadForPluginChanges;
218 + (void)_setAlwaysUseATSU:(BOOL)f;
220 - (NSCachedURLResponse *)_cachedResponseForURL:(NSURL *)URL;
222 - (void)_writeImageElement:(NSDictionary *)element withPasteboardTypes:(NSArray *)types toPasteboard:(NSPasteboard *)pasteboard;
223 - (void)_writeLinkElement:(NSDictionary *)element withPasteboardTypes:(NSArray *)types toPasteboard:(NSPasteboard *)pasteboard;
225 - (void)_addScrollerDashboardRegions:(NSMutableDictionary *)regions;
226 - (NSDictionary *)_dashboardRegions;
228 - (void)_setDashboardBehavior:(WebDashboardBehavior)behavior to:(BOOL)flag;
229 - (BOOL)_dashboardBehavior:(WebDashboardBehavior)behavior;
231 - (void)handleAuthenticationForResource:(id)identifier challenge:(NSURLAuthenticationChallenge *)challenge fromDataSource:(WebDataSource *)dataSource;
233 + (void)_setShouldUseFontSmoothing:(BOOL)f;
234 + (BOOL)_shouldUseFontSmoothing;
238 @interface WebView (WebViewPrintingPrivate)
240 @method _adjustPrintingMarginsForHeaderAndFooter:
241 @abstract Increase the top and bottom margins for the current print operation to
242 account for the header and footer height.
243 @discussion Called by <WebDocument> implementors once when a print job begins. If the
244 <WebDocument> implementor implements knowsPageRange:, this should be called from there.
245 Otherwise this should be called from beginDocument. The <WebDocument> implementors need
246 to also call _drawHeaderAndFooter.
248 - (void)_adjustPrintingMarginsForHeaderAndFooter;
251 @method _drawHeaderAndFooter
252 @abstract Gives the WebView's UIDelegate a chance to draw a header and footer on the
254 @discussion This should be called by <WebDocument> implementors from an override of
255 drawPageBorderWithSize:.
257 - (void)_drawHeaderAndFooter;
260 @interface WebView (WebViewEditingInMail)
261 - (void)_insertNewlineInQuotedContent;
262 - (BOOL)_selectWordBeforeMenuEvent;
263 - (void)_setSelectWordBeforeMenuEvent:(BOOL)flag;
266 @interface _WebSafeForwarder : NSObject
268 id target; // Non-retained. Don't retain delegates;
272 - (id)initWithTarget:(id)t defaultTarget:(id)dt templateClass:(Class)aClass;
273 + (id)safeForwarderWithTarget:(id)t defaultTarget:(id)dt templateClass:(Class)aClass;
276 @interface NSObject (WebFrameLoadDelegatePrivate)
277 - (void)webView:(WebView *)sender didFirstLayoutInFrame:(WebFrame *)frame;