• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 - (id)_scriptDebugDelegateForwarder;
85 - (void)_pushPerformingProgrammaticFocus;
86 - (void)_popPerformingProgrammaticFocus;
87 - (void)_incrementProgressForIdentifier:(id)identifier response:(NSURLResponse *)response;
88 - (void)_incrementProgressForIdentifier:(id)identifier length:(int)length;
89 - (void)_completeProgressForIdentifier:(id)identifer;
90 - (void)_progressStarted:(WebFrame *)frame;
91 - (void)_didStartProvisionalLoadForFrame:(WebFrame *)frame;
92 + (BOOL)_viewClass:(Class *)vClass andRepresentationClass:(Class *)rClass forMIMEType:(NSString *)MIMEType;
93 - (BOOL)_viewClass:(Class *)vClass andRepresentationClass:(Class *)rClass forMIMEType:(NSString *)MIMEType;
94 + (NSString *)_MIMETypeForFile:(NSString *)path;
95 - (WebDownload *)_downloadURL:(NSURL *)URL;
96 + (NSString *)_generatedMIMETypeForURLScheme:(NSString *)URLScheme;
97 + (BOOL)_representationExistsForURLScheme:(NSString *)URLScheme;
98 - (BOOL)_isPerformingProgrammaticFocus;
99 - (void)_mouseDidMoveOverElement:(NSDictionary *)dictionary modifierFlags:(NSUInteger)modifierFlags;
100 - (WebView *)_openNewWindowWithRequest:(NSURLRequest *)request;
101 - (void)_writeImageForElement:(NSDictionary *)element withPasteboardTypes:(NSArray *)types toPasteboard:(NSPasteboard *)pasteboard;
102 - (void)_writeLinkElement:(NSDictionary *)element withPasteboardTypes:(NSArray *)types toPasteboard:(NSPasteboard *)pasteboard;
103 - (void)_openFrameInNewWindowFromMenu:(NSMenuItem *)sender;
104 - (void)_searchWithGoogleFromMenu:(id)sender;
105 - (void)_searchWithSpotlightFromMenu:(id)sender;
106 - (void)_progressCompleted:(WebFrame *)frame;
107 - (void)_didCommitLoadForFrame:(WebFrame *)frame;
108 - (void)_didFinishLoadForFrame:(WebFrame *)frame;
109 - (void)_didFailLoadWithError:(NSError *)error forFrame:(WebFrame *)frame;
110 - (void)_didFailProvisionalLoadWithError:(NSError *)error forFrame:(WebFrame *)frame;
111 - (void)_willChangeValueForKey:(NSString *)key;
112 - (void)_didChangeValueForKey:(NSString *)key;
113 - (WebBasePluginPackage *)_pluginForMIMEType:(NSString *)MIMEType;
114 - (WebBasePluginPackage *)_pluginForExtension:(NSString *)extension;
115 - (BOOL)_isMIMETypeRegisteredAsPlugin:(NSString *)MIMEType;
116 
117 - (void)setCurrentNodeHighlight:(WebNodeHighlight *)nodeHighlight;
118 - (WebNodeHighlight *)currentNodeHighlight;
119 
120 - (void)addPluginInstanceView:(NSView *)view;
121 - (void)removePluginInstanceView:(NSView *)view;
122 - (void)removePluginInstanceViewsFor:(WebFrame*)webFrame;
123 
124 - (void)_addObject:(id)object forIdentifier:(unsigned long)identifier;
125 - (id)_objectForIdentifier:(unsigned long)identifier;
126 - (void)_removeObjectForIdentifier:(unsigned long)identifier;
127 - (BOOL)_becomingFirstResponderFromOutside;
128 
129 - (void)_registerForIconNotification:(BOOL)listen;
130 - (void)_dispatchDidReceiveIconFromWebFrame:(WebFrame *)webFrame;
131 
132 - (void)_setZoomMultiplier:(float)m isTextOnly:(BOOL)isTextOnly;
133 - (float)_zoomMultiplier:(BOOL)isTextOnly;
134 - (float)_realZoomMultiplier;
135 - (BOOL)_realZoomMultiplierIsTextOnly;
136 - (BOOL)_canZoomOut:(BOOL)isTextOnly;
137 - (BOOL)_canZoomIn:(BOOL)isTextOnly;
138 - (IBAction)_zoomOut:(id)sender isTextOnly:(BOOL)isTextOnly;
139 - (IBAction)_zoomIn:(id)sender isTextOnly:(BOOL)isTextOnly;
140 - (BOOL)_canResetZoom:(BOOL)isTextOnly;
141 - (IBAction)_resetZoom:(id)sender isTextOnly:(BOOL)isTextOnly;
142 
143 - (BOOL)_mustDrawUnionedRect:(NSRect)rect singleRects:(const NSRect *)rects count:(NSInteger)count;
144 - (void)_updateFocusedAndActiveStateForFrame:(WebFrame *)webFrame;
145 
146 + (BOOL)_canHandleRequest:(NSURLRequest *)request forMainFrame:(BOOL)forMainFrame;
147 
148 @end
149 
150 typedef struct _WebResourceDelegateImplementationCache {
151     IMP didCancelAuthenticationChallengeFunc;
152     IMP didReceiveAuthenticationChallengeFunc;
153     IMP identifierForRequestFunc;
154     IMP willSendRequestFunc;
155     IMP didReceiveResponseFunc;
156     IMP didReceiveContentLengthFunc;
157     IMP didFinishLoadingFromDataSourceFunc;
158     IMP didFailLoadingWithErrorFromDataSourceFunc;
159     IMP didLoadResourceFromMemoryCacheFunc;
160     IMP willCacheResponseFunc;
161     IMP plugInFailedWithErrorFunc;
162     IMP shouldUseCredentialStorageFunc;
163 } WebResourceDelegateImplementationCache;
164 
165 typedef struct _WebFrameLoadDelegateImplementationCache {
166     IMP didClearWindowObjectForFrameFunc;
167     IMP windowScriptObjectAvailableFunc;
168     IMP didHandleOnloadEventsForFrameFunc;
169     IMP didReceiveServerRedirectForProvisionalLoadForFrameFunc;
170     IMP didCancelClientRedirectForFrameFunc;
171     IMP willPerformClientRedirectToURLDelayFireDateForFrameFunc;
172     IMP didChangeLocationWithinPageForFrameFunc;
173     IMP willCloseFrameFunc;
174     IMP didStartProvisionalLoadForFrameFunc;
175     IMP didReceiveTitleForFrameFunc;
176     IMP didCommitLoadForFrameFunc;
177     IMP didFailProvisionalLoadWithErrorForFrameFunc;
178     IMP didFailLoadWithErrorForFrameFunc;
179     IMP didFinishLoadForFrameFunc;
180     IMP didFirstLayoutInFrameFunc;
181     IMP didFirstVisuallyNonEmptyLayoutInFrameFunc;
182     IMP didReceiveIconForFrameFunc;
183     IMP didFinishDocumentLoadForFrameFunc;
184 } WebFrameLoadDelegateImplementationCache;
185 
186 WebResourceDelegateImplementationCache* WebViewGetResourceLoadDelegateImplementations(WebView *webView);
187 WebFrameLoadDelegateImplementationCache* WebViewGetFrameLoadDelegateImplementations(WebView *webView);
188 
189 #ifdef __cplusplus
190 
191 id CallFormDelegate(WebView *, SEL, id, id);
192 id CallFormDelegate(WebView *self, SEL selector, id object1, id object2, id object3, id object4, id object5);
193 BOOL CallFormDelegateReturningBoolean(BOOL, WebView *, SEL, id, SEL, id);
194 
195 id CallUIDelegate(WebView *, SEL);
196 id CallUIDelegate(WebView *, SEL, id);
197 id CallUIDelegate(WebView *, SEL, NSRect);
198 id CallUIDelegate(WebView *, SEL, id, id);
199 id CallUIDelegate(WebView *, SEL, id, BOOL);
200 id CallUIDelegate(WebView *, SEL, id, id, id);
201 id CallUIDelegate(WebView *, SEL, id, NSUInteger);
202 float CallUIDelegateReturningFloat(WebView *, SEL);
203 BOOL CallUIDelegateReturningBoolean(BOOL, WebView *, SEL);
204 BOOL CallUIDelegateReturningBoolean(BOOL, WebView *, SEL, id);
205 BOOL CallUIDelegateReturningBoolean(BOOL, WebView *, SEL, id, id);
206 BOOL CallUIDelegateReturningBoolean(BOOL, WebView *, SEL, id, BOOL);
207 
208 id CallFrameLoadDelegate(IMP, WebView *, SEL);
209 id CallFrameLoadDelegate(IMP, WebView *, SEL, id);
210 id CallFrameLoadDelegate(IMP, WebView *, SEL, id, id);
211 id CallFrameLoadDelegate(IMP, WebView *, SEL, id, id, id);
212 id CallFrameLoadDelegate(IMP, WebView *, SEL, id, id, id, id);
213 id CallFrameLoadDelegate(IMP, WebView *, SEL, id, NSTimeInterval, id, id);
214 
215 id CallResourceLoadDelegate(IMP, WebView *, SEL, id, id);
216 id CallResourceLoadDelegate(IMP, WebView *, SEL, id, id, id);
217 id CallResourceLoadDelegate(IMP, WebView *, SEL, id, id, id, id);
218 id CallResourceLoadDelegate(IMP, WebView *, SEL, id, NSInteger, id);
219 id CallResourceLoadDelegate(IMP, WebView *, SEL, id, id, NSInteger, id);
220 
221 BOOL CallResourceLoadDelegateReturningBoolean(BOOL, IMP, WebView *, SEL, id, id);
222 
223 #endif
224