~ubuntu-branches/ubuntu/raring/qtwebkit-source/raring-proposed

« back to all changes in this revision

Viewing changes to Source/WebKit/mac/Plugins/WebNetscapePluginView.h

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2013-02-18 14:24:18 UTC
  • Revision ID: package-import@ubuntu.com-20130218142418-eon0jmjg3nj438uy
Tags: upstream-2.3
ImportĀ upstreamĀ versionĀ 2.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2005, 2007 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
#if ENABLE(NETSCAPE_PLUGIN_API)
 
30
 
 
31
#import "WebBaseNetscapePluginView.h"
 
32
 
 
33
#import "WebNetscapeContainerCheckPrivate.h"
 
34
#import <WebKit/npfunctions.h>
 
35
#import <WebKit/npapi.h>
 
36
#import <wtf/HashMap.h>
 
37
#import <wtf/HashSet.h>
 
38
#import <wtf/OwnPtr.h>
 
39
 
 
40
@class WebDataSource;
 
41
@class WebFrame;
 
42
@class WebNetscapePluginPackage;
 
43
@class WebView;
 
44
 
 
45
class PluginTimer;
 
46
class WebNetscapePluginStream;
 
47
class WebNetscapePluginEventHandler;
 
48
 
 
49
typedef union PluginPort {
 
50
#ifndef NP_NO_QUICKDRAW
 
51
    NP_Port qdPort;
 
52
#endif        
 
53
    NP_CGContext cgPort;
 
54
} PluginPort;
 
55
 
 
56
// Because the Adobe 7.x Acrobat plug-in has a hard coded check for a view named 
 
57
// "WebNetscapePluginDocumentView", this class must retain the old name in order 
 
58
// for the plug-in to function correctly. (rdar://problem/4699455)
 
59
#define WebNetscapePluginView WebNetscapePluginDocumentView
 
60
 
 
61
@interface WebNetscapePluginView : WebBaseNetscapePluginView<WebPluginManualLoader, WebPluginContainerCheckController>
 
62
{
 
63
    RefPtr<WebNetscapePluginStream> _manualStream;
 
64
    RetainPtr<CALayer> _pluginLayer;
 
65
    unsigned _dataLengthReceived;
 
66
    RetainPtr<NSError> _error;
 
67
        
 
68
    unsigned argsCount;
 
69
    char **cAttributes;
 
70
    char **cValues;
 
71
        
 
72
    NPP plugin;
 
73
    NPWindow window;
 
74
    NPWindow lastSetWindow;
 
75
    PluginPort nPort;
 
76
    PluginPort lastSetPort;
 
77
    NPDrawingModel drawingModel;
 
78
    NPEventModel eventModel;
 
79
    
 
80
#ifndef NP_NO_QUICKDRAW
 
81
    // This is only valid when drawingModel is NPDrawingModelQuickDraw
 
82
    GWorldPtr offscreenGWorld;
 
83
#endif
 
84
 
 
85
    OwnPtr<WebNetscapePluginEventHandler> _eventHandler;
 
86
    
 
87
    BOOL inSetWindow;
 
88
    BOOL shouldStopSoon;
 
89
 
 
90
    uint32_t currentTimerID;
 
91
    HashMap<uint32_t, PluginTimer*>* timers;
 
92
 
 
93
    unsigned pluginFunctionCallDepth;
 
94
    
 
95
    int32_t specifiedHeight;
 
96
    int32_t specifiedWidth;
 
97
            
 
98
    HashSet<RefPtr<WebNetscapePluginStream> > streams;
 
99
    RetainPtr<NSMutableDictionary> _pendingFrameLoads;
 
100
    
 
101
    BOOL _isFlash;
 
102
    BOOL _isSilverlight;
 
103
    
 
104
    NSMutableDictionary *_containerChecksInProgress;
 
105
    uint32_t _currentContainerCheckRequestID;
 
106
}
 
107
 
 
108
+ (WebNetscapePluginView *)currentPluginView;
 
109
 
 
110
 
 
111
- (id)initWithFrame:(NSRect)r
 
112
      pluginPackage:(WebNetscapePluginPackage *)thePluginPackage
 
113
                URL:(NSURL *)URL
 
114
            baseURL:(NSURL *)baseURL
 
115
           MIMEType:(NSString *)MIME
 
116
      attributeKeys:(NSArray *)keys
 
117
    attributeValues:(NSArray *)values
 
118
       loadManually:(BOOL)loadManually
 
119
            element:(PassRefPtr<WebCore::HTMLPlugInElement>)element;
 
120
 
 
121
 
 
122
- (NPP)plugin;
 
123
 
 
124
- (void)disconnectStream:(WebNetscapePluginStream*)stream;
 
125
 
 
126
// Returns the NPObject that represents the plugin interface.
 
127
// The return value is expected to be retained.
 
128
- (NPObject *)createPluginScriptableObject;
 
129
 
 
130
// Returns the form value associated with the plugin instance.
 
131
- (BOOL)getFormValue:(NSString **)value;
 
132
 
 
133
// -willCallPlugInFunction must be called before calling any of the NPP_* functions for this view's plugin.
 
134
// This is necessary to ensure that plug-ins are not destroyed while WebKit calls into them.  Some plug-ins (Flash
 
135
// at least) are written with the assumption that nothing they do in their plug-in functions can cause NPP_Destroy()
 
136
// to be called.  Unfortunately, this is not true, especially if the plug-in uses NPN_Invoke() to execute a
 
137
// document.write(), which clears the document and destroys the plug-in.
 
138
// See <rdar://problem/4480737>.
 
139
- (void)willCallPlugInFunction;
 
140
 
 
141
// -didCallPlugInFunction should be called after returning from a plug-in function.  It should be called exactly
 
142
// once for every call to -willCallPlugInFunction.
 
143
// See <rdar://problem/4480737>.
 
144
- (void)didCallPlugInFunction;
 
145
 
 
146
- (void)handleMouseMoved:(NSEvent *)event;
 
147
- (void)handleMouseEntered:(NSEvent *)event;
 
148
- (void)handleMouseExited:(NSEvent *)event;
 
149
 
 
150
- (uint32_t)checkIfAllowedToLoadURL:(const char*)urlCString frame:(const char*)frameNameCString callbackFunc:(void (*)(NPP npp, uint32_t checkID, NPBool allowed, void* context))callbackFunc context:(void*)context;
 
151
- (void)cancelCheckIfAllowedToLoadURL:(uint32_t)checkID;
 
152
 
 
153
@end
 
154
 
 
155
@interface WebNetscapePluginView (WebInternal)
 
156
- (BOOL)sendEvent:(void*)event isDrawRect:(BOOL)eventIsDrawRect;
 
157
- (NPEventModel)eventModel;
 
158
- (CALayer *)pluginLayer;
 
159
- (NPError)loadRequest:(NSURLRequest *)request inTarget:(NSString *)target withNotifyData:(void *)notifyData sendNotification:(BOOL)sendNotification;
 
160
- (NPError)getURLNotify:(const char *)URL target:(const char *)target notifyData:(void *)notifyData;
 
161
- (NPError)getURL:(const char *)URL target:(const char *)target;
 
162
- (NPError)postURLNotify:(const char *)URL target:(const char *)target len:(UInt32)len buf:(const char *)buf file:(NPBool)file notifyData:(void *)notifyData;
 
163
- (NPError)postURL:(const char *)URL target:(const char *)target len:(UInt32)len buf:(const char *)buf file:(NPBool)file;
 
164
- (NPError)newStream:(NPMIMEType)type target:(const char *)target stream:(NPStream**)stream;
 
165
- (NPError)write:(NPStream*)stream len:(SInt32)len buffer:(void *)buffer;
 
166
- (NPError)destroyStream:(NPStream*)stream reason:(NPReason)reason;
 
167
- (void)status:(const char *)message;
 
168
- (const char *)userAgent;
 
169
- (void)invalidateRect:(NPRect *)invalidRect;
 
170
- (void)invalidateRegion:(NPRegion)invalidateRegion;
 
171
- (void)forceRedraw;
 
172
- (NPError)getVariable:(NPNVariable)variable value:(void *)value;
 
173
- (NPError)setVariable:(NPPVariable)variable value:(void *)value;
 
174
- (uint32_t)scheduleTimerWithInterval:(uint32_t)interval repeat:(NPBool)repeat timerFunc:(void (*)(NPP npp, uint32_t timerID))timerFunc;
 
175
- (void)unscheduleTimer:(uint32_t)timerID;
 
176
- (NPError)popUpContextMenu:(NPMenu *)menu;
 
177
- (NPError)getVariable:(NPNURLVariable)variable forURL:(const char*)url value:(char**)value length:(uint32_t*)length;
 
178
- (NPError)setVariable:(NPNURLVariable)variable forURL:(const char*)url value:(const char*)value length:(uint32_t)length;
 
179
- (NPError)getAuthenticationInfoWithProtocol:(const char*) protocol host:(const char*)host port:(int32_t)port scheme:(const char*)scheme realm:(const char*)realm
 
180
                                    username:(char**)username usernameLength:(uint32_t*)usernameLength 
 
181
                                    password:(char**)password passwordLength:(uint32_t*)passwordLength;
 
182
- (char*)resolveURL:(const char*)url forTarget:(const char*)target;
 
183
@end
 
184
 
 
185
WKNBrowserContainerCheckFuncs *browserContainerCheckFuncs();
 
186
 
 
187
#endif
 
188