1/*
2 * Copyright (C) 2005, 2006, 2007, 2008, 2009 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#import "WebTypesInternal.h"
30#import "WebDelegateImplementationCaching.h"
31#import <WebCore/PlatformString.h>
32#import <WebCore/WebCoreKeyboardUIMode.h>
33#import <wtf/HashMap.h>
34#import <wtf/RetainPtr.h>
35
36namespace WebCore {
37    class Page;
38}
39
40@class WebInspector;
41@class WebNodeHighlight;
42@class WebPluginDatabase;
43@class WebPreferences;
44@class WebTextCompletionController;
45@protocol WebFormDelegate;
46@protocol WebGeolocationProvider;
47#if ENABLE(VIDEO)
48@class WebVideoFullscreenController;
49#endif
50
51extern BOOL applicationIsTerminating;
52extern int pluginDatabaseClientCount;
53
54// FIXME: This should be renamed to WebViewData.
55@interface WebViewPrivate : NSObject {
56@public
57    WebCore::Page* page;
58
59    id UIDelegate;
60    id UIDelegateForwarder;
61    id resourceProgressDelegate;
62    id downloadDelegate;
63    id policyDelegate;
64    id policyDelegateForwarder;
65    id frameLoadDelegate;
66    id frameLoadDelegateForwarder;
67    id <WebFormDelegate> formDelegate;
68    id editingDelegate;
69    id editingDelegateForwarder;
70    id scriptDebugDelegate;
71    id historyDelegate;
72
73    WebInspector *inspector;
74    WebNodeHighlight *currentNodeHighlight;
75
76    BOOL allowsUndo;
77
78    float zoomMultiplier;
79
80    NSString *applicationNameForUserAgent;
81    WebCore::String userAgent;
82    BOOL userAgentOverridden;
83
84    WebPreferences *preferences;
85    BOOL useSiteSpecificSpoofing;
86
87    NSWindow *hostWindow;
88
89    int programmaticFocusCount;
90
91    WebResourceDelegateImplementationCache resourceLoadDelegateImplementations;
92    WebFrameLoadDelegateImplementationCache frameLoadDelegateImplementations;
93    WebScriptDebugDelegateImplementationCache scriptDebugDelegateImplementations;
94    WebHistoryDelegateImplementationCache historyDelegateImplementations;
95
96    void *observationInfo;
97
98    BOOL closed;
99    BOOL shouldCloseWithWindow;
100    BOOL mainFrameDocumentReady;
101    BOOL drawsBackground;
102    BOOL editable;
103    BOOL tabKeyCyclesThroughElementsChanged;
104    BOOL becomingFirstResponder;
105    BOOL becomingFirstResponderFromOutside;
106    BOOL hoverFeedbackSuspended;
107    BOOL usesPageCache;
108    BOOL catchesDelegateExceptions;
109    BOOL cssAnimationsSuspended;
110
111    NSColor *backgroundColor;
112
113    NSString *mediaStyle;
114
115    BOOL hasSpellCheckerDocumentTag;
116    NSInteger spellCheckerDocumentTag;
117
118    BOOL smartInsertDeleteEnabled;
119    BOOL selectTrailingWhitespaceEnabled;
120
121#if ENABLE(DASHBOARD_SUPPORT)
122    BOOL dashboardBehaviorAlwaysSendMouseEventsToAllWindows;
123    BOOL dashboardBehaviorAlwaysSendActiveNullEventsToPlugIns;
124    BOOL dashboardBehaviorAlwaysAcceptsFirstMouse;
125    BOOL dashboardBehaviorAllowWheelScrolling;
126#endif
127
128    // WebKit has both a global plug-in database and a separate, per WebView plug-in database. Dashboard uses the per WebView database.
129    WebPluginDatabase *pluginDatabase;
130
131    HashMap<unsigned long, RetainPtr<id> > identifierMap;
132
133    BOOL _keyboardUIModeAccessed;
134    WebCore::KeyboardUIMode _keyboardUIMode;
135
136    BOOL shouldUpdateWhileOffscreen;
137
138    // When this flag is set, we will not make any subviews underneath this WebView.  This means no WebFrameViews and no WebHTMLViews.
139    BOOL usesDocumentViews;
140
141#if USE(ACCELERATED_COMPOSITING)
142    // When this flag is set, next time a WebHTMLView draws, it needs to temporarily disable screen updates
143    // so that the NSView drawing is visually synchronized with CALayer updates.
144    BOOL needsOneShotDrawingSynchronization;
145    BOOL postsAcceleratedCompositingNotifications;
146    // Run loop observer used to implement the compositing equivalent of -viewWillDraw
147    CFRunLoopObserverRef layerSyncRunLoopObserver;
148#endif
149
150    NSPasteboard *insertionPasteboard;
151
152    NSSize lastLayoutSize;
153
154    BOOL ignoringMouseDraggedEvents;
155
156    NSEvent *mouseDownEvent; // Kept after handling the event.
157    BOOL handlingMouseDownEvent;
158    NSEvent *keyDownEvent; // Kept after handling the event.
159
160    WebTextCompletionController *completionController;
161
162    NSTimer *autoscrollTimer;
163    NSEvent *autoscrollTriggerEvent;
164
165    CFRunLoopTimerRef updateMouseoverTimer;
166#if ENABLE(VIDEO)
167    WebVideoFullscreenController *fullscreenController;
168#endif
169
170    id<WebGeolocationProvider> _geolocationProvider;
171}
172@end
173