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