2 * Copyright (C) 2005, 2006, 2007, 2008, 2009 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 // This header contains WebView declarations that can be used anywhere in WebKit, but are neither SPI nor API.
31 #import "WebPreferences.h"
32 #import "WebViewPrivate.h"
33 #import "WebTypesInternal.h"
36 #import <WebCore/WebCoreKeyboardUIMode.h>
46 typedef WebCore::KeyboardEvent WebCoreKeyboardEvent;
47 typedef WebCore::Page WebCorePage;
49 @class WebCoreKeyboardEvent;
53 @class WebBasePluginPackage;
55 @class WebNodeHighlight;
57 @interface WebView (WebViewEditingExtras)
58 - (BOOL)_interceptEditingKeyEvent:(WebCoreKeyboardEvent *)event shouldSaveCommand:(BOOL)shouldSave;
59 - (BOOL)_shouldChangeSelectedDOMRange:(DOMRange *)currentRange toDOMRange:(DOMRange *)proposedRange affinity:(NSSelectionAffinity)selectionAffinity stillSelecting:(BOOL)flag;
62 @interface WebView (AllWebViews)
63 + (void)_makeAllWebViewsPerformSelector:(SEL)selector;
64 - (void)_removeFromAllWebViewsSet;
65 - (void)_addToAllWebViewsSet;
68 @interface WebView (WebViewInternal)
70 - (WebCore::String)_userAgentForURL:(const WebCore::KURL&)url;
71 - (WebCore::KeyboardUIMode)_keyboardUIMode;
75 @interface WebView (WebViewMiscInternal)
77 + (void)_setCacheModel:(WebCacheModel)cacheModel;
78 + (WebCacheModel)_cacheModel;
80 - (NSMenu *)_menuForElement:(NSDictionary *)element defaultItems:(NSArray *)items;
81 - (id)_UIDelegateForwarder;
82 - (id)_editingDelegateForwarder;
83 - (id)_policyDelegateForwarder;
84 - (void)_pushPerformingProgrammaticFocus;
85 - (void)_popPerformingProgrammaticFocus;
86 - (void)_incrementProgressForIdentifier:(id)identifier response:(NSURLResponse *)response;
87 - (void)_incrementProgressForIdentifier:(id)identifier length:(int)length;
88 - (void)_completeProgressForIdentifier:(id)identifer;
89 - (void)_progressStarted:(WebFrame *)frame;
90 - (void)_didStartProvisionalLoadForFrame:(WebFrame *)frame;
91 + (BOOL)_viewClass:(Class *)vClass andRepresentationClass:(Class *)rClass forMIMEType:(NSString *)MIMEType;
92 - (BOOL)_viewClass:(Class *)vClass andRepresentationClass:(Class *)rClass forMIMEType:(NSString *)MIMEType;
93 + (NSString *)_MIMETypeForFile:(NSString *)path;
94 - (WebDownload *)_downloadURL:(NSURL *)URL;
95 + (NSString *)_generatedMIMETypeForURLScheme:(NSString *)URLScheme;
96 + (BOOL)_representationExistsForURLScheme:(NSString *)URLScheme;
97 - (BOOL)_isPerformingProgrammaticFocus;
98 - (void)_mouseDidMoveOverElement:(NSDictionary *)dictionary modifierFlags:(NSUInteger)modifierFlags;
99 - (WebView *)_openNewWindowWithRequest:(NSURLRequest *)request;
100 - (void)_writeImageForElement:(NSDictionary *)element withPasteboardTypes:(NSArray *)types toPasteboard:(NSPasteboard *)pasteboard;
101 - (void)_writeLinkElement:(NSDictionary *)element withPasteboardTypes:(NSArray *)types toPasteboard:(NSPasteboard *)pasteboard;
102 - (void)_openFrameInNewWindowFromMenu:(NSMenuItem *)sender;
103 - (void)_searchWithGoogleFromMenu:(id)sender;
104 - (void)_searchWithSpotlightFromMenu:(id)sender;
105 - (void)_progressCompleted:(WebFrame *)frame;
106 - (void)_didCommitLoadForFrame:(WebFrame *)frame;
107 - (void)_didFinishLoadForFrame:(WebFrame *)frame;
108 - (void)_didFailLoadWithError:(NSError *)error forFrame:(WebFrame *)frame;
109 - (void)_didFailProvisionalLoadWithError:(NSError *)error forFrame:(WebFrame *)frame;
110 - (void)_willChangeValueForKey:(NSString *)key;
111 - (void)_didChangeValueForKey:(NSString *)key;
112 - (WebBasePluginPackage *)_pluginForMIMEType:(NSString *)MIMEType;
113 - (WebBasePluginPackage *)_pluginForExtension:(NSString *)extension;
114 - (BOOL)_isMIMETypeRegisteredAsPlugin:(NSString *)MIMEType;
116 - (void)setCurrentNodeHighlight:(WebNodeHighlight *)nodeHighlight;
117 - (WebNodeHighlight *)currentNodeHighlight;
119 - (void)addPluginInstanceView:(NSView *)view;
120 - (void)removePluginInstanceView:(NSView *)view;
121 - (void)removePluginInstanceViewsFor:(WebFrame*)webFrame;
123 - (void)_addObject:(id)object forIdentifier:(unsigned long)identifier;
124 - (id)_objectForIdentifier:(unsigned long)identifier;
125 - (void)_removeObjectForIdentifier:(unsigned long)identifier;
126 - (BOOL)_becomingFirstResponderFromOutside;
128 - (void)_registerForIconNotification:(BOOL)listen;
129 - (void)_dispatchDidReceiveIconFromWebFrame:(WebFrame *)webFrame;
131 - (void)_setZoomMultiplier:(float)m isTextOnly:(BOOL)isTextOnly;
132 - (float)_zoomMultiplier:(BOOL)isTextOnly;
133 - (float)_realZoomMultiplier;
134 - (BOOL)_realZoomMultiplierIsTextOnly;
135 - (BOOL)_canZoomOut:(BOOL)isTextOnly;
136 - (BOOL)_canZoomIn:(BOOL)isTextOnly;
137 - (IBAction)_zoomOut:(id)sender isTextOnly:(BOOL)isTextOnly;
138 - (IBAction)_zoomIn:(id)sender isTextOnly:(BOOL)isTextOnly;
139 - (BOOL)_canResetZoom:(BOOL)isTextOnly;
140 - (IBAction)_resetZoom:(id)sender isTextOnly:(BOOL)isTextOnly;
142 - (BOOL)_mustDrawUnionedRect:(NSRect)rect singleRects:(const NSRect *)rects count:(NSInteger)count;
143 - (void)_updateFocusedAndActiveStateForFrame:(WebFrame *)webFrame;
145 + (BOOL)_canHandleRequest:(NSURLRequest *)request forMainFrame:(BOOL)forMainFrame;
147 #if USE(ACCELERATED_COMPOSITING)
148 - (BOOL)_needsOneShotDrawingSynchronization;
149 - (void)_setNeedsOneShotDrawingSynchronization:(BOOL)needsSynchronization;
150 - (void)_startedAcceleratedCompositingForFrame:(WebFrame*)webFrame;
151 - (void)_stoppedAcceleratedCompositingForFrame:(WebFrame*)webFrame;
154 - (void)_setInsertionPasteboard:(NSPasteboard *)pasteboard;
158 typedef struct _WebResourceDelegateImplementationCache {
159 IMP didCancelAuthenticationChallengeFunc;
160 IMP didReceiveAuthenticationChallengeFunc;
161 IMP identifierForRequestFunc;
162 IMP willSendRequestFunc;
163 IMP didReceiveResponseFunc;
164 IMP didReceiveContentLengthFunc;
165 IMP didFinishLoadingFromDataSourceFunc;
166 IMP didFailLoadingWithErrorFromDataSourceFunc;
167 IMP didLoadResourceFromMemoryCacheFunc;
168 IMP willCacheResponseFunc;
169 IMP plugInFailedWithErrorFunc;
170 IMP shouldUseCredentialStorageFunc;
171 } WebResourceDelegateImplementationCache;
173 typedef struct _WebFrameLoadDelegateImplementationCache {
174 IMP didClearWindowObjectForFrameFunc;
175 IMP windowScriptObjectAvailableFunc;
176 IMP didHandleOnloadEventsForFrameFunc;
177 IMP didReceiveServerRedirectForProvisionalLoadForFrameFunc;
178 IMP didCancelClientRedirectForFrameFunc;
179 IMP willPerformClientRedirectToURLDelayFireDateForFrameFunc;
180 IMP didChangeLocationWithinPageForFrameFunc;
181 IMP willCloseFrameFunc;
182 IMP didStartProvisionalLoadForFrameFunc;
183 IMP didReceiveTitleForFrameFunc;
184 IMP didCommitLoadForFrameFunc;
185 IMP didFailProvisionalLoadWithErrorForFrameFunc;
186 IMP didFailLoadWithErrorForFrameFunc;
187 IMP didFinishLoadForFrameFunc;
188 IMP didFirstLayoutInFrameFunc;
189 IMP didFirstVisuallyNonEmptyLayoutInFrameFunc;
190 IMP didReceiveIconForFrameFunc;
191 IMP didFinishDocumentLoadForFrameFunc;
192 } WebFrameLoadDelegateImplementationCache;
194 typedef struct _WebScriptDebugDelegateImplementationCache {
195 BOOL didParseSourceExpectsBaseLineNumber;
196 IMP didParseSourceFunc;
197 IMP failedToParseSourceFunc;
198 IMP didEnterCallFrameFunc;
199 IMP willExecuteStatementFunc;
200 IMP willLeaveCallFrameFunc;
201 IMP exceptionWasRaisedFunc;
202 } WebScriptDebugDelegateImplementationCache;
204 WebResourceDelegateImplementationCache* WebViewGetResourceLoadDelegateImplementations(WebView *webView);
205 WebFrameLoadDelegateImplementationCache* WebViewGetFrameLoadDelegateImplementations(WebView *webView);
206 WebScriptDebugDelegateImplementationCache* WebViewGetScriptDebugDelegateImplementations(WebView *webView);
210 id CallFormDelegate(WebView *, SEL, id, id);
211 id CallFormDelegate(WebView *self, SEL selector, id object1, id object2, id object3, id object4, id object5);
212 BOOL CallFormDelegateReturningBoolean(BOOL, WebView *, SEL, id, SEL, id);
214 id CallUIDelegate(WebView *, SEL);
215 id CallUIDelegate(WebView *, SEL, id);
216 id CallUIDelegate(WebView *, SEL, NSRect);
217 id CallUIDelegate(WebView *, SEL, id, id);
218 id CallUIDelegate(WebView *, SEL, id, BOOL);
219 id CallUIDelegate(WebView *, SEL, id, id, id);
220 id CallUIDelegate(WebView *, SEL, id, NSUInteger);
221 float CallUIDelegateReturningFloat(WebView *, SEL);
222 BOOL CallUIDelegateReturningBoolean(BOOL, WebView *, SEL);
223 BOOL CallUIDelegateReturningBoolean(BOOL, WebView *, SEL, id);
224 BOOL CallUIDelegateReturningBoolean(BOOL, WebView *, SEL, id, id);
225 BOOL CallUIDelegateReturningBoolean(BOOL, WebView *, SEL, id, BOOL);
227 id CallFrameLoadDelegate(IMP, WebView *, SEL);
228 id CallFrameLoadDelegate(IMP, WebView *, SEL, id);
229 id CallFrameLoadDelegate(IMP, WebView *, SEL, id, id);
230 id CallFrameLoadDelegate(IMP, WebView *, SEL, id, id, id);
231 id CallFrameLoadDelegate(IMP, WebView *, SEL, id, id, id, id);
232 id CallFrameLoadDelegate(IMP, WebView *, SEL, id, NSTimeInterval, id, id);
234 id CallResourceLoadDelegate(IMP, WebView *, SEL, id, id);
235 id CallResourceLoadDelegate(IMP, WebView *, SEL, id, id, id);
236 id CallResourceLoadDelegate(IMP, WebView *, SEL, id, id, id, id);
237 id CallResourceLoadDelegate(IMP, WebView *, SEL, id, NSInteger, id);
238 id CallResourceLoadDelegate(IMP, WebView *, SEL, id, id, NSInteger, id);
240 BOOL CallResourceLoadDelegateReturningBoolean(BOOL, IMP, WebView *, SEL, id, id);
242 id CallScriptDebugDelegate(IMP, WebView *, SEL, id, id, NSInteger, id);
243 id CallScriptDebugDelegate(IMP, WebView *, SEL, id, NSInteger, id, NSInteger, id);
244 id CallScriptDebugDelegate(IMP, WebView *, SEL, id, NSInteger, id, id, id);
245 id CallScriptDebugDelegate(IMP, WebView *, SEL, id, NSInteger, NSInteger, id);