Fix the iOS build.
[WebKit-https.git] / Source / WebKit / mac / WebView / WebViewInternal.h
1 /*
2  * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
3  * Copyright (C) 2010 Igalia S.L
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * 1.  Redistributions of source code must retain the above copyright
10  *     notice, this list of conditions and the following disclaimer. 
11  * 2.  Redistributions in binary form must reproduce the above copyright
12  *     notice, this list of conditions and the following disclaimer in the
13  *     documentation and/or other materials provided with the distribution. 
14  * 3.  Neither the name of Apple Inc. ("Apple") nor the names of
15  *     its contributors may be used to endorse or promote products derived
16  *     from this software without specific prior written permission. 
17  *
18  * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
19  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
22  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29
30 // This header contains WebView declarations that can be used anywhere in WebKit, but are neither SPI nor API.
31
32 #import "WebPreferences.h"
33 #import "WebViewPrivate.h"
34 #import "WebTypesInternal.h"
35
36 #ifdef __cplusplus
37 #import <WebCore/AlternativeTextClient.h>
38 #import <WebCore/FindOptions.h>
39 #import <WebCore/FloatRect.h>
40 #import <WebCore/HTMLMediaElement.h>
41 #import <WebCore/LayoutMilestones.h>
42 #import <WebCore/TextAlternativeWithRange.h>
43 #import <WebCore/WebCoreKeyboardUIMode.h>
44 #import <functional>
45 #import <wtf/Forward.h>
46 #import <wtf/RetainPtr.h>
47
48 namespace WebCore {
49 class Element;
50 class Event;
51 class Frame;
52 class HTMLVideoElement;
53 class HistoryItem;
54 class KeyboardEvent;
55 class Page;
56 class RenderBox;
57 class TextIndicator;
58 class URL;
59 struct DictationAlternative;
60 }
61
62 class WebSelectionServiceController;
63 #endif
64
65 @class WebActionMenuController;
66 @class WebBasePluginPackage;
67 @class WebDownload;
68 @class WebNodeHighlight;
69
70 #ifdef __cplusplus
71
72 WebCore::FindOptions coreOptions(WebFindOptions options);
73
74 WebCore::LayoutMilestones coreLayoutMilestones(WebLayoutMilestones);
75 WebLayoutMilestones kitLayoutMilestones(WebCore::LayoutMilestones);
76
77 #if USE(DICTATION_ALTERNATIVES)
78 OBJC_CLASS NSTextAlternatives;
79 #endif
80
81 @interface WebView (WebViewEditingExtras)
82 - (BOOL)_shouldChangeSelectedDOMRange:(DOMRange *)currentRange toDOMRange:(DOMRange *)proposedRange affinity:(NSSelectionAffinity)selectionAffinity stillSelecting:(BOOL)flag;
83 @end
84
85 @interface WebView (AllWebViews)
86 + (void)_makeAllWebViewsPerformSelector:(SEL)selector;
87 - (void)_removeFromAllWebViewsSet;
88 - (void)_addToAllWebViewsSet;
89 @end
90
91 @interface WebView (WebViewInternal)
92
93 + (BOOL)shouldIncludeInWebKitStatistics;
94
95 - (WebCore::Frame*)_mainCoreFrame;
96 - (WebFrame *)_selectedOrMainFrame;
97
98 - (WebCore::KeyboardUIMode)_keyboardUIMode;
99
100 - (BOOL)_becomingFirstResponderFromOutside;
101
102 #if ENABLE(ICONDATABASE)
103 - (void)_registerForIconNotification:(BOOL)listen;
104 - (void)_dispatchDidReceiveIconFromWebFrame:(WebFrame *)webFrame;
105 #endif
106
107 - (BOOL)_needsOneShotDrawingSynchronization;
108 - (void)_setNeedsOneShotDrawingSynchronization:(BOOL)needsSynchronization;
109 - (void)_scheduleCompositingLayerFlush;
110 - (BOOL)_flushCompositingChanges;
111
112 #if USE(GLIB)
113 - (void)_scheduleGlibContextIterations;
114 #endif
115
116 #if USE(AUTOCORRECTION_PANEL)
117 - (void)handleAcceptedAlternativeText:(NSString*)text;
118 #endif
119
120 #if USE(DICTATION_ALTERNATIVES)
121 - (void)_getWebCoreDictationAlternatives:(Vector<WebCore::DictationAlternative>&)alternatives fromTextAlternatives:(const Vector<WebCore::TextAlternativeWithRange>&)alternativesWithRange;
122 - (void)_showDictationAlternativeUI:(const WebCore::FloatRect&)boundingBoxOfDictatedText forDictationContext:(uint64_t)dictationContext;
123 - (void)_removeDictationAlternatives:(uint64_t)dictationContext;
124 - (Vector<String>)_dictationAlternatives:(uint64_t)dictationContext;
125 #endif
126
127 #if ENABLE(SERVICE_CONTROLS)
128 - (WebSelectionServiceController&)_selectionServiceController;
129 #endif
130
131 @end
132
133 #endif
134
135 #if PLATFORM(IOS)
136 @interface NSObject (WebSafeForwarder)
137 - (id)asyncForwarder;
138 @end
139 #endif
140
141 // FIXME: Temporary way to expose methods that are in the wrong category inside WebView.
142 @interface WebView (WebViewOtherInternal)
143
144 + (void)_setCacheModel:(WebCacheModel)cacheModel;
145 + (WebCacheModel)_cacheModel;
146
147 #ifdef __cplusplus
148 - (WebCore::Page*)page;
149 - (void)_setGlobalHistoryItem:(WebCore::HistoryItem*)historyItem;
150 - (WTF::String)_userAgentString;
151 #endif
152
153 #if !PLATFORM(IOS)
154 - (NSMenu *)_menuForElement:(NSDictionary *)element defaultItems:(NSArray *)items;
155 #endif
156 - (id)_UIDelegateForwarder;
157 #if PLATFORM(IOS)
158 - (id)_UIDelegateForSelector:(SEL)selector;
159 #endif
160 - (id)_editingDelegateForwarder;
161 - (id)_policyDelegateForwarder;
162 #if PLATFORM(IOS)
163 - (id)_frameLoadDelegateForwarder;
164 - (id)_resourceLoadDelegateForwarder;
165 - (id)_UIKitDelegateForwarder;
166 #endif
167 - (void)_pushPerformingProgrammaticFocus;
168 - (void)_popPerformingProgrammaticFocus;
169 #if !PLATFORM(IOS)
170 - (void)_didStartProvisionalLoadForFrame:(WebFrame *)frame;
171 #endif
172 + (BOOL)_viewClass:(Class *)vClass andRepresentationClass:(Class *)rClass forMIMEType:(NSString *)MIMEType allowingPlugins:(BOOL)allowPlugins;
173 - (BOOL)_viewClass:(Class *)vClass andRepresentationClass:(Class *)rClass forMIMEType:(NSString *)MIMEType;
174 + (void)_registerPluginMIMEType:(NSString *)MIMEType;
175 + (void)_unregisterPluginMIMEType:(NSString *)MIMEType;
176 + (BOOL)_canShowMIMEType:(NSString *)MIMEType allowingPlugins:(BOOL)allowPlugins;
177 - (BOOL)_canShowMIMEType:(NSString *)MIMEType;
178 + (NSString *)_MIMETypeForFile:(NSString *)path;
179 - (WebDownload *)_downloadURL:(NSURL *)URL;
180 + (NSString *)_generatedMIMETypeForURLScheme:(NSString *)URLScheme;
181 + (BOOL)_representationExistsForURLScheme:(NSString *)URLScheme;
182 - (BOOL)_isPerformingProgrammaticFocus;
183 - (void)_mouseDidMoveOverElement:(NSDictionary *)dictionary modifierFlags:(NSUInteger)modifierFlags;
184 - (WebView *)_openNewWindowWithRequest:(NSURLRequest *)request;
185 #if !PLATFORM(IOS)
186 - (void)_writeImageForElement:(NSDictionary *)element withPasteboardTypes:(NSArray *)types toPasteboard:(NSPasteboard *)pasteboard;
187 - (void)_writeLinkElement:(NSDictionary *)element withPasteboardTypes:(NSArray *)types toPasteboard:(NSPasteboard *)pasteboard;
188 - (void)_openFrameInNewWindowFromMenu:(NSMenuItem *)sender;
189 - (void)_searchWithGoogleFromMenu:(id)sender;
190 - (void)_searchWithSpotlightFromMenu:(id)sender;
191 #endif
192 - (void)_progressCompleted:(WebFrame *)frame;
193 - (void)_didCommitLoadForFrame:(WebFrame *)frame;
194 #if !PLATFORM(IOS)
195 - (void)_didFinishLoadForFrame:(WebFrame *)frame;
196 - (void)_didFailLoadWithError:(NSError *)error forFrame:(WebFrame *)frame;
197 - (void)_didFailProvisionalLoadWithError:(NSError *)error forFrame:(WebFrame *)frame;
198 #endif
199 - (void)_willChangeValueForKey:(NSString *)key;
200 - (void)_didChangeValueForKey:(NSString *)key;
201 - (WebBasePluginPackage *)_pluginForMIMEType:(NSString *)MIMEType;
202 - (WebBasePluginPackage *)_pluginForExtension:(NSString *)extension;
203
204 - (void)setCurrentNodeHighlight:(WebNodeHighlight *)nodeHighlight;
205 - (WebNodeHighlight *)currentNodeHighlight;
206
207 #if !PLATFORM(IOS)
208 - (void)addPluginInstanceView:(NSView *)view;
209 - (void)removePluginInstanceView:(NSView *)view;
210 - (void)removePluginInstanceViewsFor:(WebFrame*)webFrame;
211 #endif
212
213 - (void)_addObject:(id)object forIdentifier:(unsigned long)identifier;
214 - (id)_objectForIdentifier:(unsigned long)identifier;
215 - (void)_removeObjectForIdentifier:(unsigned long)identifier;
216
217 - (void)_setZoomMultiplier:(float)multiplier isTextOnly:(BOOL)isTextOnly;
218 - (float)_zoomMultiplier:(BOOL)isTextOnly;
219 - (float)_realZoomMultiplier;
220 - (BOOL)_realZoomMultiplierIsTextOnly;
221 - (BOOL)_canZoomOut:(BOOL)isTextOnly;
222 - (BOOL)_canZoomIn:(BOOL)isTextOnly;
223 - (IBAction)_zoomOut:(id)sender isTextOnly:(BOOL)isTextOnly;
224 - (IBAction)_zoomIn:(id)sender isTextOnly:(BOOL)isTextOnly;
225 - (BOOL)_canResetZoom:(BOOL)isTextOnly;
226 - (IBAction)_resetZoom:(id)sender isTextOnly:(BOOL)isTextOnly;
227
228 + (BOOL)_canHandleRequest:(NSURLRequest *)request forMainFrame:(BOOL)forMainFrame;
229
230 #if !PLATFORM(IOS)
231 - (void)_setInsertionPasteboard:(NSPasteboard *)pasteboard;
232 #endif
233
234 #if PLATFORM(IOS)
235 - (BOOL)_isStopping;
236 - (BOOL)_isClosing;
237
238 - (void)_documentScaleChanged;
239 - (BOOL)_fetchCustomFixedPositionLayoutRect:(NSRect*)rect;
240 #endif
241
242 - (void)_preferencesChanged:(WebPreferences *)preferences;
243
244 #if ENABLE(VIDEO) && defined(__cplusplus)
245 - (void)_enterVideoFullscreenForVideoElement:(WebCore::HTMLVideoElement*)videoElement mode:(WebCore::HTMLMediaElement::VideoFullscreenMode)mode;
246 - (void)_exitVideoFullscreen;
247 #endif
248
249 #if ENABLE(FULLSCREEN_API) && !PLATFORM(IOS) && defined(__cplusplus)
250 - (BOOL)_supportsFullScreenForElement:(WebCore::Element*)element withKeyboard:(BOOL)withKeyboard;
251 - (void)_enterFullScreenForElement:(WebCore::Element*)element;
252 - (void)_exitFullScreenForElement:(WebCore::Element*)element;
253 #endif
254
255 // Conversion functions between WebCore root view coordinates and web view coordinates.
256 - (NSPoint)_convertPointFromRootView:(NSPoint)point;
257 - (NSRect)_convertRectFromRootView:(NSRect)rect;
258
259 #if PLATFORM(MAC) && defined(__cplusplus)
260 - (void)_setTextIndicator:(WebCore::TextIndicator*)textIndicator fadeOut:(BOOL)fadeOut animationCompletionHandler:(std::function<void ()>)completionHandler;
261 - (void)_clearTextIndicator;
262 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
263 - (WebActionMenuController *)_actionMenuController;
264 #endif
265 #endif
266
267 @end