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/LayoutMilestones.h>
41#import <WebCore/TextAlternativeWithRange.h>
42#import <WebCore/WebCoreKeyboardUIMode.h>
43
44#include <wtf/Forward.h>
45#include <wtf/RetainPtr.h>
46
47namespace WebCore {
48class Element;
49class Event;
50class Frame;
51class HistoryItem;
52class URL;
53class KeyboardEvent;
54class Page;
55class RenderBox;
56class Node;
57struct DictationAlternative;
58}
59#endif
60
61@class WebBasePluginPackage;
62@class WebDownload;
63@class WebNodeHighlight;
64
65#ifdef __cplusplus
66
67WebCore::FindOptions coreOptions(WebFindOptions options);
68
69WebCore::LayoutMilestones coreLayoutMilestones(WebLayoutMilestones);
70WebLayoutMilestones kitLayoutMilestones(WebCore::LayoutMilestones);
71
72#if USE(DICTATION_ALTERNATIVES)
73OBJC_CLASS NSTextAlternatives;
74#endif
75
76@interface WebView (WebViewEditingExtras)
77- (BOOL)_shouldChangeSelectedDOMRange:(DOMRange *)currentRange toDOMRange:(DOMRange *)proposedRange affinity:(NSSelectionAffinity)selectionAffinity stillSelecting:(BOOL)flag;
78@end
79
80@interface WebView (AllWebViews)
81+ (void)_makeAllWebViewsPerformSelector:(SEL)selector;
82- (void)_removeFromAllWebViewsSet;
83- (void)_addToAllWebViewsSet;
84@end
85
86@interface WebView (WebViewInternal)
87
88+ (BOOL)shouldIncludeInWebKitStatistics;
89
90- (WebCore::Frame*)_mainCoreFrame;
91- (WebFrame *)_selectedOrMainFrame;
92
93- (WebCore::KeyboardUIMode)_keyboardUIMode;
94
95- (BOOL)_becomingFirstResponderFromOutside;
96
97#if ENABLE(ICONDATABASE)
98- (void)_registerForIconNotification:(BOOL)listen;
99- (void)_dispatchDidReceiveIconFromWebFrame:(WebFrame *)webFrame;
100#endif
101
102- (BOOL)_needsOneShotDrawingSynchronization;
103- (void)_setNeedsOneShotDrawingSynchronization:(BOOL)needsSynchronization;
104- (void)_scheduleCompositingLayerFlush;
105- (BOOL)_flushCompositingChanges;
106
107#if USE(GLIB)
108- (void)_scheduleGlibContextIterations;
109#endif
110
111#if USE(AUTOCORRECTION_PANEL)
112- (void)handleAcceptedAlternativeText:(NSString*)text;
113#endif
114
115#if USE(DICTATION_ALTERNATIVES)
116- (void)_getWebCoreDictationAlternatives:(Vector<WebCore::DictationAlternative>&)alternatives fromTextAlternatives:(const Vector<WebCore::TextAlternativeWithRange>&)alternativesWithRange;
117- (void)_showDictationAlternativeUI:(const WebCore::FloatRect&)boundingBoxOfDictatedText forDictationContext:(uint64_t)dictationContext;
118- (void)_removeDictationAlternatives:(uint64_t)dictationContext;
119- (Vector<String>)_dictationAlternatives:(uint64_t)dictationContext;
120#endif
121
122@end
123
124#endif
125
126#if PLATFORM(IOS)
127@interface NSObject (WebSafeForwarder)
128- (id)asyncForwarder;
129@end
130#endif
131
132// FIXME: Temporary way to expose methods that are in the wrong category inside WebView.
133@interface WebView (WebViewOtherInternal)
134
135+ (void)_setCacheModel:(WebCacheModel)cacheModel;
136+ (WebCacheModel)_cacheModel;
137
138#ifdef __cplusplus
139- (WebCore::Page*)page;
140- (void)_setGlobalHistoryItem:(WebCore::HistoryItem*)historyItem;
141- (WTF::String)_userAgentString;
142#endif
143
144#if !PLATFORM(IOS)
145- (NSMenu *)_menuForElement:(NSDictionary *)element defaultItems:(NSArray *)items;
146#endif
147- (id)_UIDelegateForwarder;
148#if PLATFORM(IOS)
149- (id)_UIDelegateForSelector:(SEL)selector;
150#endif
151- (id)_editingDelegateForwarder;
152- (id)_policyDelegateForwarder;
153#if PLATFORM(IOS)
154- (id)_frameLoadDelegateForwarder;
155- (id)_resourceLoadDelegateForwarder;
156- (id)_UIKitDelegateForwarder;
157#endif
158- (void)_pushPerformingProgrammaticFocus;
159- (void)_popPerformingProgrammaticFocus;
160#if !PLATFORM(IOS)
161- (void)_didStartProvisionalLoadForFrame:(WebFrame *)frame;
162#endif
163+ (BOOL)_viewClass:(Class *)vClass andRepresentationClass:(Class *)rClass forMIMEType:(NSString *)MIMEType allowingPlugins:(BOOL)allowPlugins;
164- (BOOL)_viewClass:(Class *)vClass andRepresentationClass:(Class *)rClass forMIMEType:(NSString *)MIMEType;
165+ (void)_registerPluginMIMEType:(NSString *)MIMEType;
166+ (void)_unregisterPluginMIMEType:(NSString *)MIMEType;
167+ (BOOL)_canShowMIMEType:(NSString *)MIMEType allowingPlugins:(BOOL)allowPlugins;
168- (BOOL)_canShowMIMEType:(NSString *)MIMEType;
169+ (NSString *)_MIMETypeForFile:(NSString *)path;
170- (WebDownload *)_downloadURL:(NSURL *)URL;
171+ (NSString *)_generatedMIMETypeForURLScheme:(NSString *)URLScheme;
172+ (BOOL)_representationExistsForURLScheme:(NSString *)URLScheme;
173- (BOOL)_isPerformingProgrammaticFocus;
174- (void)_mouseDidMoveOverElement:(NSDictionary *)dictionary modifierFlags:(NSUInteger)modifierFlags;
175- (WebView *)_openNewWindowWithRequest:(NSURLRequest *)request;
176#if !PLATFORM(IOS)
177- (void)_writeImageForElement:(NSDictionary *)element withPasteboardTypes:(NSArray *)types toPasteboard:(NSPasteboard *)pasteboard;
178- (void)_writeLinkElement:(NSDictionary *)element withPasteboardTypes:(NSArray *)types toPasteboard:(NSPasteboard *)pasteboard;
179- (void)_openFrameInNewWindowFromMenu:(NSMenuItem *)sender;
180- (void)_searchWithGoogleFromMenu:(id)sender;
181- (void)_searchWithSpotlightFromMenu:(id)sender;
182#endif
183- (void)_progressCompleted:(WebFrame *)frame;
184- (void)_didCommitLoadForFrame:(WebFrame *)frame;
185#if !PLATFORM(IOS)
186- (void)_didFinishLoadForFrame:(WebFrame *)frame;
187- (void)_didFailLoadWithError:(NSError *)error forFrame:(WebFrame *)frame;
188- (void)_didFailProvisionalLoadWithError:(NSError *)error forFrame:(WebFrame *)frame;
189#endif
190- (void)_willChangeValueForKey:(NSString *)key;
191- (void)_didChangeValueForKey:(NSString *)key;
192- (WebBasePluginPackage *)_pluginForMIMEType:(NSString *)MIMEType;
193- (WebBasePluginPackage *)_pluginForExtension:(NSString *)extension;
194
195- (void)setCurrentNodeHighlight:(WebNodeHighlight *)nodeHighlight;
196- (WebNodeHighlight *)currentNodeHighlight;
197
198#if !PLATFORM(IOS)
199- (void)addPluginInstanceView:(NSView *)view;
200- (void)removePluginInstanceView:(NSView *)view;
201- (void)removePluginInstanceViewsFor:(WebFrame*)webFrame;
202#endif
203
204- (void)_addObject:(id)object forIdentifier:(unsigned long)identifier;
205- (id)_objectForIdentifier:(unsigned long)identifier;
206- (void)_removeObjectForIdentifier:(unsigned long)identifier;
207
208- (void)_setZoomMultiplier:(float)multiplier isTextOnly:(BOOL)isTextOnly;
209- (float)_zoomMultiplier:(BOOL)isTextOnly;
210- (float)_realZoomMultiplier;
211- (BOOL)_realZoomMultiplierIsTextOnly;
212- (BOOL)_canZoomOut:(BOOL)isTextOnly;
213- (BOOL)_canZoomIn:(BOOL)isTextOnly;
214- (IBAction)_zoomOut:(id)sender isTextOnly:(BOOL)isTextOnly;
215- (IBAction)_zoomIn:(id)sender isTextOnly:(BOOL)isTextOnly;
216- (BOOL)_canResetZoom:(BOOL)isTextOnly;
217- (IBAction)_resetZoom:(id)sender isTextOnly:(BOOL)isTextOnly;
218
219+ (BOOL)_canHandleRequest:(NSURLRequest *)request forMainFrame:(BOOL)forMainFrame;
220
221#if !PLATFORM(IOS)
222- (void)_setInsertionPasteboard:(NSPasteboard *)pasteboard;
223#endif
224
225#if PLATFORM(IOS)
226- (BOOL)_isStopping;
227- (BOOL)_isClosing;
228
229- (void)_documentScaleChanged;
230- (BOOL)_fetchCustomFixedPositionLayoutRect:(NSRect*)rect;
231#endif
232
233- (void)_preferencesChanged:(WebPreferences *)preferences;
234
235#if ENABLE(VIDEO) && defined(__cplusplus)
236- (void)_enterFullscreenForNode:(WebCore::Node*)node;
237- (void)_exitFullscreen;
238#endif
239
240#if ENABLE(FULLSCREEN_API) && !PLATFORM(IOS) && defined(__cplusplus)
241- (BOOL)_supportsFullScreenForElement:(WebCore::Element*)element withKeyboard:(BOOL)withKeyboard;
242- (void)_enterFullScreenForElement:(WebCore::Element*)element;
243- (void)_exitFullScreenForElement:(WebCore::Element*)element;
244#endif
245
246// Conversion functions between WebCore root view coordinates and web view coordinates.
247- (NSPoint)_convertPointFromRootView:(NSPoint)point;
248- (NSRect)_convertRectFromRootView:(NSRect)rect;
249
250@end
251