ad4f19c7cc208ef858c1291f2f5aba5d117d8c60
[WebKit-https.git] / WebKit / mac / WebView / WebViewInternal.h
1 /*
2  * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
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. 
16  *
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.
27  */
28
29 // This header contains WebView declarations that can be used anywhere in WebKit, but are neither SPI nor API.
30
31 #import "WebPreferences.h"
32 #import "WebViewPrivate.h"
33 #import "WebTypesInternal.h"
34
35 #ifdef __cplusplus
36 #import <WebCore/WebCoreKeyboardUIMode.h>
37 #endif
38
39 #ifdef __cplusplus
40 namespace WebCore {
41     class KeyboardEvent;
42     class KURL;
43     class Page;
44     class String;
45 }
46 typedef WebCore::KeyboardEvent WebCoreKeyboardEvent;
47 typedef WebCore::Page WebCorePage;
48 #else
49 @class WebCoreKeyboardEvent;
50 @class WebCorePage;
51 #endif
52
53 @class WebBasePluginPackage;
54 @class WebDownload;
55 @class WebNodeHighlight;
56
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;
60 @end
61
62 @interface WebView (AllWebViews)
63 + (void)_makeAllWebViewsPerformSelector:(SEL)selector;
64 - (void)_removeFromAllWebViewsSet;
65 - (void)_addToAllWebViewsSet;
66 @end
67
68 @interface WebView (WebViewInternal)
69 #ifdef __cplusplus
70 - (WebCore::String)_userAgentForURL:(const WebCore::KURL&)url;
71 - (WebCore::KeyboardUIMode)_keyboardUIMode;
72 #endif
73 @end
74
75 @interface WebView (WebViewMiscInternal)
76
77 + (void)_setCacheModel:(WebCacheModel)cacheModel;
78 + (WebCacheModel)_cacheModel;
79 - (WebCorePage*)page;
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;
115
116 - (void)setCurrentNodeHighlight:(WebNodeHighlight *)nodeHighlight;
117 - (WebNodeHighlight *)currentNodeHighlight;
118
119 - (void)addPluginInstanceView:(NSView *)view;
120 - (void)removePluginInstanceView:(NSView *)view;
121 - (void)removePluginInstanceViewsFor:(WebFrame*)webFrame;
122
123 - (void)_addObject:(id)object forIdentifier:(unsigned long)identifier;
124 - (id)_objectForIdentifier:(unsigned long)identifier;
125 - (void)_removeObjectForIdentifier:(unsigned long)identifier;
126 - (BOOL)_becomingFirstResponderFromOutside;
127
128 - (void)_registerForIconNotification:(BOOL)listen;
129 - (void)_dispatchDidReceiveIconFromWebFrame:(WebFrame *)webFrame;
130
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;
141
142 - (BOOL)_mustDrawUnionedRect:(NSRect)rect singleRects:(const NSRect *)rects count:(NSInteger)count;
143 - (void)_updateFocusedAndActiveStateForFrame:(WebFrame *)webFrame;
144
145 + (BOOL)_canHandleRequest:(NSURLRequest *)request forMainFrame:(BOOL)forMainFrame;
146
147 #if USE(ACCELERATED_COMPOSITING)
148 - (BOOL)_needsOneShotDrawingSynchronization;
149 - (void)_setNeedsOneShotDrawingSynchronization:(BOOL)needsSynchronization;
150 - (void)_startedAcceleratedCompositingForFrame:(WebFrame*)webFrame;
151 - (void)_stoppedAcceleratedCompositingForFrame:(WebFrame*)webFrame;
152 #endif
153
154 @end
155
156 typedef struct _WebResourceDelegateImplementationCache {
157     IMP didCancelAuthenticationChallengeFunc;
158     IMP didReceiveAuthenticationChallengeFunc;
159     IMP identifierForRequestFunc;
160     IMP willSendRequestFunc;
161     IMP didReceiveResponseFunc;
162     IMP didReceiveContentLengthFunc;
163     IMP didFinishLoadingFromDataSourceFunc;
164     IMP didFailLoadingWithErrorFromDataSourceFunc;
165     IMP didLoadResourceFromMemoryCacheFunc;
166     IMP willCacheResponseFunc;
167     IMP plugInFailedWithErrorFunc;
168     IMP shouldUseCredentialStorageFunc;
169 } WebResourceDelegateImplementationCache;
170
171 typedef struct _WebFrameLoadDelegateImplementationCache {
172     IMP didClearWindowObjectForFrameFunc;
173     IMP windowScriptObjectAvailableFunc;
174     IMP didHandleOnloadEventsForFrameFunc;
175     IMP didReceiveServerRedirectForProvisionalLoadForFrameFunc;
176     IMP didCancelClientRedirectForFrameFunc;
177     IMP willPerformClientRedirectToURLDelayFireDateForFrameFunc;
178     IMP didChangeLocationWithinPageForFrameFunc;
179     IMP willCloseFrameFunc;
180     IMP didStartProvisionalLoadForFrameFunc;
181     IMP didReceiveTitleForFrameFunc;
182     IMP didCommitLoadForFrameFunc;
183     IMP didFailProvisionalLoadWithErrorForFrameFunc;
184     IMP didFailLoadWithErrorForFrameFunc;
185     IMP didFinishLoadForFrameFunc;
186     IMP didFirstLayoutInFrameFunc;
187     IMP didFirstVisuallyNonEmptyLayoutInFrameFunc;
188     IMP didReceiveIconForFrameFunc;
189     IMP didFinishDocumentLoadForFrameFunc;
190 } WebFrameLoadDelegateImplementationCache;
191
192 typedef struct _WebScriptDebugDelegateImplementationCache {
193     BOOL didParseSourceExpectsBaseLineNumber;
194     IMP didParseSourceFunc;
195     IMP failedToParseSourceFunc;
196     IMP didEnterCallFrameFunc;
197     IMP willExecuteStatementFunc;
198     IMP willLeaveCallFrameFunc;
199     IMP exceptionWasRaisedFunc;
200 } WebScriptDebugDelegateImplementationCache;
201
202 WebResourceDelegateImplementationCache* WebViewGetResourceLoadDelegateImplementations(WebView *webView);
203 WebFrameLoadDelegateImplementationCache* WebViewGetFrameLoadDelegateImplementations(WebView *webView);
204 WebScriptDebugDelegateImplementationCache* WebViewGetScriptDebugDelegateImplementations(WebView *webView);
205
206 #ifdef __cplusplus
207
208 id CallFormDelegate(WebView *, SEL, id, id);
209 id CallFormDelegate(WebView *self, SEL selector, id object1, id object2, id object3, id object4, id object5);
210 BOOL CallFormDelegateReturningBoolean(BOOL, WebView *, SEL, id, SEL, id);
211
212 id CallUIDelegate(WebView *, SEL);
213 id CallUIDelegate(WebView *, SEL, id);
214 id CallUIDelegate(WebView *, SEL, NSRect);
215 id CallUIDelegate(WebView *, SEL, id, id);
216 id CallUIDelegate(WebView *, SEL, id, BOOL);
217 id CallUIDelegate(WebView *, SEL, id, id, id);
218 id CallUIDelegate(WebView *, SEL, id, NSUInteger);
219 float CallUIDelegateReturningFloat(WebView *, SEL);
220 BOOL CallUIDelegateReturningBoolean(BOOL, WebView *, SEL);
221 BOOL CallUIDelegateReturningBoolean(BOOL, WebView *, SEL, id);
222 BOOL CallUIDelegateReturningBoolean(BOOL, WebView *, SEL, id, id);
223 BOOL CallUIDelegateReturningBoolean(BOOL, WebView *, SEL, id, BOOL);
224
225 id CallFrameLoadDelegate(IMP, WebView *, SEL);
226 id CallFrameLoadDelegate(IMP, WebView *, SEL, id);
227 id CallFrameLoadDelegate(IMP, WebView *, SEL, id, id);
228 id CallFrameLoadDelegate(IMP, WebView *, SEL, id, id, id);
229 id CallFrameLoadDelegate(IMP, WebView *, SEL, id, id, id, id);
230 id CallFrameLoadDelegate(IMP, WebView *, SEL, id, NSTimeInterval, id, id);
231
232 id CallResourceLoadDelegate(IMP, WebView *, SEL, id, id);
233 id CallResourceLoadDelegate(IMP, WebView *, SEL, id, id, id);
234 id CallResourceLoadDelegate(IMP, WebView *, SEL, id, id, id, id);
235 id CallResourceLoadDelegate(IMP, WebView *, SEL, id, NSInteger, id);
236 id CallResourceLoadDelegate(IMP, WebView *, SEL, id, id, NSInteger, id);
237
238 BOOL CallResourceLoadDelegateReturningBoolean(BOOL, IMP, WebView *, SEL, id, id);
239
240 id CallScriptDebugDelegate(IMP, WebView *, SEL, id, id, NSInteger, id);
241 id CallScriptDebugDelegate(IMP, WebView *, SEL, id, NSInteger, id, NSInteger, id);
242 id CallScriptDebugDelegate(IMP, WebView *, SEL, id, NSInteger, id, id, id);
243 id CallScriptDebugDelegate(IMP, WebView *, SEL, id, NSInteger, NSInteger, id);
244
245 #endif