Remove "virtual" from all lines that have both "virtual" and "override".
[WebKit-https.git] / Source / WebKit / mac / WebView / WebViewData.h
1 /*
2  * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2012 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 #import "WebTypesInternal.h"
31 #import "WebDelegateImplementationCaching.h"
32 #import <WebCore/AlternativeTextClient.h>
33 #import <WebCore/LayerFlushScheduler.h>
34 #import <WebCore/LayerFlushSchedulerClient.h>
35 #import <WebCore/WebCoreKeyboardUIMode.h>
36 #import <wtf/HashMap.h>
37 #import <wtf/Lock.h>
38 #import <wtf/RetainPtr.h>
39 #import <wtf/ThreadingPrimitives.h>
40 #import <wtf/text/WTFString.h>
41
42 #if PLATFORM(IOS)
43 #import "WebCaretChangeListener.h"
44 #endif
45
46 namespace WebCore {
47 class AlternativeTextUIController;
48 class HistoryItem;
49 class Page;
50 class TextIndicatorWindow;
51 }
52
53 @class WebImmediateActionController;
54 @class WebInspector;
55 @class WebNodeHighlight;
56 @class WebPluginDatabase;
57 @class WebPreferences;
58 @class WebTextCompletionController;
59 @protocol WebFormDelegate;
60 @protocol WebDeviceOrientationProvider;
61 @protocol WebGeolocationProvider;
62 @protocol WebNotificationProvider;
63 #if ENABLE(VIDEO)
64 @class WebVideoFullscreenController;
65 #endif
66 #if ENABLE(FULLSCREEN_API)
67 @class WebFullScreenController;
68 #endif
69 #if ENABLE(MEDIA_STREAM)
70 @protocol WebUserMediaClient;
71 #endif
72 #if ENABLE(REMOTE_INSPECTOR) && PLATFORM(IOS)
73 @class WebIndicateLayer;
74 #endif
75
76 #if PLATFORM(IOS)
77 @class WAKWindow;
78 @class WebEvent;
79 @class WebFixedPositionContent;
80 #endif
81
82 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS)
83 class WebMediaPlaybackTargetPicker;
84 #endif
85
86 #if PLATFORM(MAC)
87 @class WebWindowVisibilityObserver;
88 #endif
89
90 extern BOOL applicationIsTerminating;
91 extern int pluginDatabaseClientCount;
92
93 class LayerFlushController;
94 class WebViewGroup;
95
96 #if ENABLE(SERVICE_CONTROLS)
97 class WebSelectionServiceController;
98 #endif
99
100 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200 && USE(APPLE_INTERNAL_SDK)
101 #import <WebKitAdditions/WebViewDataAdditionsDeclarations.h>
102 #endif
103
104 class WebViewLayerFlushScheduler : public WebCore::LayerFlushScheduler {
105 public:
106     WebViewLayerFlushScheduler(LayerFlushController*);
107     virtual ~WebViewLayerFlushScheduler() { }
108
109 private:
110     void layerFlushCallback() override
111     {
112         RefPtr<LayerFlushController> protector = m_flushController;
113         WebCore::LayerFlushScheduler::layerFlushCallback();
114     }
115     
116     LayerFlushController* m_flushController;
117 };
118
119 class LayerFlushController : public RefCounted<LayerFlushController>, public WebCore::LayerFlushSchedulerClient {
120 public:
121     static PassRefPtr<LayerFlushController> create(WebView* webView)
122     {
123         return adoptRef(new LayerFlushController(webView));
124     }
125     
126     virtual bool flushLayers();
127     
128     void scheduleLayerFlush();
129     void invalidate();
130     
131 private:
132     LayerFlushController(WebView*);
133     
134     WebView* m_webView;
135     WebViewLayerFlushScheduler m_layerFlushScheduler;
136 };
137
138 @interface WebWindowVisibilityObserver : NSObject {
139     WebView *_view;
140 }
141
142 - (instancetype)initWithView:(WebView *)view;
143 - (void)startObserving:(NSWindow *)window;
144 - (void)stopObserving:(NSWindow *)window;
145 @end
146
147 // FIXME: This should be renamed to WebViewData.
148 @interface WebViewPrivate : NSObject {
149 @public
150     WebCore::Page* page;
151     RefPtr<WebViewGroup> group;
152
153     id UIDelegate;
154     id UIDelegateForwarder;
155     id resourceProgressDelegate;
156     id downloadDelegate;
157     id policyDelegate;
158     id policyDelegateForwarder;
159     id frameLoadDelegate;
160     id frameLoadDelegateForwarder;
161     id <WebFormDelegate> formDelegate;
162     id editingDelegate;
163     id editingDelegateForwarder;
164     id scriptDebugDelegate;
165     id historyDelegate;
166 #if PLATFORM(IOS)
167     id resourceProgressDelegateForwarder;
168     id formDelegateForwarder;
169 #endif
170
171     WebInspector *inspector;
172     WebNodeHighlight *currentNodeHighlight;
173
174 #if PLATFORM(MAC)
175     WebImmediateActionController *immediateActionController;
176
177 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200 && USE(APPLE_INTERNAL_SDK)
178 #import <WebKitAdditions/WebViewDataAdditions.h>
179 #endif
180
181     std::unique_ptr<WebCore::TextIndicatorWindow> textIndicatorWindow;
182     BOOL hasInitializedLookupObserver;
183     RetainPtr<WebWindowVisibilityObserver> windowVisibilityObserver;
184     RetainPtr<NSEvent> pressureEvent;
185 #endif // PLATFORM(MAC)
186
187     BOOL shouldMaintainInactiveSelection;
188
189     BOOL allowsUndo;
190         
191     float zoomMultiplier;
192     BOOL zoomsTextOnly;
193
194     NSString *applicationNameForUserAgent;
195     WTF::String userAgent;
196     BOOL userAgentOverridden;
197     
198     WebPreferences *preferences;
199     BOOL useSiteSpecificSpoofing;
200 #if PLATFORM(IOS)
201     NSURL *userStyleSheetLocation;
202 #endif
203
204     NSWindow *hostWindow;
205
206     int programmaticFocusCount;
207     
208     WebResourceDelegateImplementationCache resourceLoadDelegateImplementations;
209     WebFrameLoadDelegateImplementationCache frameLoadDelegateImplementations;
210     WebScriptDebugDelegateImplementationCache scriptDebugDelegateImplementations;
211     WebHistoryDelegateImplementationCache historyDelegateImplementations;
212
213     void *observationInfo;
214     
215     BOOL closed;
216 #if PLATFORM(IOS)
217     BOOL closing;
218 #endif
219     BOOL shouldCloseWithWindow;
220     BOOL mainFrameDocumentReady;
221     BOOL drawsBackground;
222     BOOL tabKeyCyclesThroughElementsChanged;
223     BOOL becomingFirstResponder;
224     BOOL becomingFirstResponderFromOutside;
225     BOOL usesPageCache;
226
227 #if !PLATFORM(IOS)
228     NSColor *backgroundColor;
229 #else
230     CGColorRef backgroundColor;
231 #endif
232
233     NSString *mediaStyle;
234     
235     BOOL hasSpellCheckerDocumentTag;
236     NSInteger spellCheckerDocumentTag;
237
238 #if ENABLE(DASHBOARD_SUPPORT)
239     BOOL dashboardBehaviorAlwaysSendMouseEventsToAllWindows;
240     BOOL dashboardBehaviorAlwaysSendActiveNullEventsToPlugIns;
241     BOOL dashboardBehaviorAlwaysAcceptsFirstMouse;
242     BOOL dashboardBehaviorAllowWheelScrolling;
243 #endif
244     
245 #if PLATFORM(IOS)
246     BOOL isStopping;
247
248     id UIKitDelegate;
249     id UIKitDelegateForwarder;
250
251     id WebMailDelegate;
252
253     BOOL allowsMessaging;
254     NSMutableSet *_caretChangeListeners;
255     id <WebCaretChangeListener> _caretChangeListener;
256
257     CGSize fixedLayoutSize;
258     BOOL mainViewIsScrollingOrZooming;
259     int32_t didDrawTiles;
260     WTF::Lock pendingFixedPositionLayoutRectMutex;
261     CGRect pendingFixedPositionLayoutRect;
262 #endif
263
264 #if !PLATFORM(IOS)
265     // WebKit has both a global plug-in database and a separate, per WebView plug-in database. Dashboard uses the per WebView database.
266     WebPluginDatabase *pluginDatabase;
267 #endif
268     
269     HashMap<unsigned long, RetainPtr<id>> identifierMap;
270
271     BOOL _keyboardUIModeAccessed;
272     WebCore::KeyboardUIMode _keyboardUIMode;
273
274     BOOL shouldUpdateWhileOffscreen;
275
276     BOOL includesFlattenedCompositingLayersWhenDrawingToBitmap;
277
278     // When this flag is set, next time a WebHTMLView draws, it needs to temporarily disable screen updates
279     // so that the NSView drawing is visually synchronized with CALayer updates.
280     BOOL needsOneShotDrawingSynchronization;
281     BOOL postsAcceleratedCompositingNotifications;
282     RefPtr<LayerFlushController> layerFlushController;
283
284 #if !PLATFORM(IOS)
285     NSPasteboard *insertionPasteboard;
286 #endif
287             
288     NSSize lastLayoutSize;
289
290 #if ENABLE(VIDEO)
291     WebVideoFullscreenController *fullscreenController;
292 #endif
293     
294 #if ENABLE(FULLSCREEN_API)
295     WebFullScreenController *newFullscreenController;
296 #endif
297
298 #if ENABLE(REMOTE_INSPECTOR)
299 #if PLATFORM(IOS)
300     WebIndicateLayer *indicateLayer;
301 #endif
302 #endif
303
304     id<WebGeolocationProvider> _geolocationProvider;
305     id<WebDeviceOrientationProvider> m_deviceOrientationProvider;
306     id<WebNotificationProvider> _notificationProvider;
307
308 #if ENABLE(MEDIA_STREAM)
309     id<WebUserMediaClient> m_userMediaClient;
310 #endif
311
312 #if ENABLE(SERVICE_CONTROLS)
313     std::unique_ptr<WebSelectionServiceController> _selectionServiceController;
314 #endif
315
316     RefPtr<WebCore::HistoryItem> _globalHistoryItem;
317
318     BOOL interactiveFormValidationEnabled;
319     int validationMessageTimerMagnification;
320
321     float customDeviceScaleFactor;
322 #if PLATFORM(IOS)
323     WebFixedPositionContent* _fixedPositionContent;
324 #endif
325
326 #if USE(DICTATION_ALTERNATIVES)
327     std::unique_ptr<WebCore::AlternativeTextUIController> m_alternativeTextUIController;
328 #endif
329
330     RetainPtr<NSData> sourceApplicationAuditData;
331
332     BOOL _didPerformFirstNavigation;
333
334 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS)
335     std::unique_ptr<WebMediaPlaybackTargetPicker> m_playbackTargetPicker;
336 #endif
337 }
338 @end