• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #import <Cocoa/Cocoa.h>
31 
32 #import "WebNetscapePluginPackage.h"
33 #import "WebPluginContainerCheck.h"
34 #import <wtf/Forward.h>
35 #import <wtf/OwnPtr.h>
36 #import <wtf/PassRefPtr.h>
37 #import <wtf/RefPtr.h>
38 #import <wtf/RetainPtr.h>
39 
40 @class DOMElement;
41 @class WebDataSource;
42 @class WebFrame;
43 @class WebView;
44 
45 namespace WebCore {
46     class HTMLPlugInElement;
47 }
48 
49 class WebHaltablePlugin;
50 
51 // Also declared in WebCore/WidgetMac.mm
52 @interface NSView (Widget)
53 - (void)visibleRectDidChange;
54 @end
55 
56 @interface WebBaseNetscapePluginView : NSView
57 {
58     RetainPtr<WebNetscapePluginPackage> _pluginPackage;
59 
60     WebFrame *_webFrame;
61 
62     int _mode;
63 
64     BOOL _triedAndFailedToCreatePlugin;
65     BOOL _loadManually;
66     BOOL _shouldFireTimers;
67     BOOL _isStarted;
68     BOOL _hasFocus;
69     BOOL _isCompletelyObscured;
70     BOOL _isPrivateBrowsingEnabled;
71     BOOL _isHalted;
72     BOOL _hasBeenHalted;
73     BOOL _snapshotting;
74 
75     RefPtr<WebCore::HTMLPlugInElement> _element;
76     RetainPtr<NSString> _MIMEType;
77     RetainPtr<NSURL> _baseURL;
78     RetainPtr<NSURL> _sourceURL;
79     RetainPtr<NSImage> _cachedSnapshot;
80 
81     OwnPtr<WebHaltablePlugin> _haltable;
82 
83     NSTrackingRectTag _trackingTag;
84 }
85 
86 - (id)initWithFrame:(NSRect)r
87       pluginPackage:(WebNetscapePluginPackage *)thePluginPackage
88                 URL:(NSURL *)URL
89             baseURL:(NSURL *)baseURL
90            MIMEType:(NSString *)MIME
91       attributeKeys:(NSArray *)keys
92     attributeValues:(NSArray *)values
93        loadManually:(BOOL)loadManually
94             element:(PassRefPtr<WebCore::HTMLPlugInElement>)element;
95 
96 - (WebNetscapePluginPackage *)pluginPackage;
97 
98 - (NSURL *)URLWithCString:(const char *)URLCString;
99 - (NSMutableURLRequest *)requestWithURLCString:(const char *)URLCString;
100 
101 // Subclasses must override these.
102 // The "handle" prefix is needed to avoid overriding NSView methods.
103 - (void)handleMouseMoved:(NSEvent *)event;
104 - (void)handleMouseEntered:(NSEvent *)event;
105 - (void)handleMouseExited:(NSEvent *)event;
106 - (void)setAttributeKeys:(NSArray *)keys andValues:(NSArray *)values;
107 - (void)focusChanged;
108 
109 - (WebFrame *)webFrame;
110 - (WebDataSource *)dataSource;
111 - (WebView *)webView;
112 - (NSWindow *)currentWindow;
113 - (WebCore::HTMLPlugInElement*)element;
114 
115 - (void)removeTrackingRect;
116 - (void)resetTrackingRect;
117 
118 - (void)stopTimers;
119 - (void)startTimers;
120 - (void)restartTimers;
121 
122 - (void)start;
123 - (void)stop;
124 
125 - (void)halt;
126 - (void)resumeFromHalt;
127 - (BOOL)isHalted;
128 - (BOOL)hasBeenHalted;
129 
130 - (void)addWindowObservers;
131 - (void)removeWindowObservers;
132 - (BOOL)shouldClipOutPlugin;
133 - (BOOL)inFlatteningPaint;
134 
135 - (BOOL)supportsSnapshotting;
136 - (void)cacheSnapshot;
137 - (void)clearCachedSnapshot;
138 
139 - (BOOL)convertFromX:(double)sourceX andY:(double)sourceY space:(NPCoordinateSpace)sourceSpace
140                  toX:(double *)destX andY:(double *)destY space:(NPCoordinateSpace)destSpace;
141 - (WTF::CString)resolvedURLStringForURL:(const char*)url target:(const char*)target;
142 
143 - (void)invalidatePluginContentRect:(NSRect)rect;
144 
145 - (NSRect)actualVisibleRectInWindow; // takes transforms into account.
146 
147 #ifndef BUILDING_ON_TIGER
148 - (CALayer *)pluginLayer;
149 #endif
150 
151 @end
152 
153 
154 namespace WebKit {
155 bool getAuthenticationInfo(const char* protocolStr, const char* hostStr, int32_t port, const char* schemeStr, const char* realmStr,
156                            WTF::CString& username, WTF::CString& password);
157 }
158 
159 #endif
160 
161