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