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/OwnPtr.h> 35 #import <wtf/PassRefPtr.h> 36 #import <wtf/RefPtr.h> 37 #import <wtf/RetainPtr.h> 38 39 @class DOMElement; 40 @class WebDataSource; 41 @class WebFrame; 42 @class WebView; 43 44 namespace WebCore { 45 class CString; 46 class HTMLPlugInElement; 47 } 48 49 class WebHaltablePlugin; 50 51 @interface WebBaseNetscapePluginView : NSView 52 { 53 RetainPtr<WebNetscapePluginPackage> _pluginPackage; 54 55 WebFrame *_webFrame; 56 57 int _mode; 58 59 BOOL _triedAndFailedToCreatePlugin; 60 BOOL _loadManually; 61 BOOL _shouldFireTimers; 62 BOOL _isStarted; 63 BOOL _hasFocus; 64 BOOL _isCompletelyObscured; 65 BOOL _isPrivateBrowsingEnabled; 66 BOOL _isHalted; 67 BOOL _hasBeenHalted; 68 69 RefPtr<WebCore::HTMLPlugInElement> _element; 70 RetainPtr<NSString> _MIMEType; 71 RetainPtr<NSURL> _baseURL; 72 RetainPtr<NSURL> _sourceURL; 73 74 OwnPtr<WebHaltablePlugin> _haltable; 75 76 NSTrackingRectTag _trackingTag; 77 } 78 79 - (id)initWithFrame:(NSRect)r 80 pluginPackage:(WebNetscapePluginPackage *)thePluginPackage 81 URL:(NSURL *)URL 82 baseURL:(NSURL *)baseURL 83 MIMEType:(NSString *)MIME 84 attributeKeys:(NSArray *)keys 85 attributeValues:(NSArray *)values 86 loadManually:(BOOL)loadManually 87 element:(PassRefPtr<WebCore::HTMLPlugInElement>)element; 88 89 - (WebNetscapePluginPackage *)pluginPackage; 90 91 - (NSURL *)URLWithCString:(const char *)URLCString; 92 - (NSMutableURLRequest *)requestWithURLCString:(const char *)URLCString; 93 94 // Subclasses must override these. 95 - (void)handleMouseMoved:(NSEvent *)event; 96 - (void)setAttributeKeys:(NSArray *)keys andValues:(NSArray *)values; 97 - (void)focusChanged; 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)halt; 116 - (void)resumeFromHalt; 117 - (BOOL)isHalted; 118 - (BOOL)hasBeenHalted; 119 120 - (void)addWindowObservers; 121 - (void)removeWindowObservers; 122 - (BOOL)shouldClipOutPlugin; 123 124 - (BOOL)convertFromX:(double)sourceX andY:(double)sourceY space:(NPCoordinateSpace)sourceSpace 125 toX:(double *)destX andY:(double *)destY space:(NPCoordinateSpace)destSpace; 126 - (WebCore::CString)resolvedURLStringForURL:(const char*)url target:(const char*)target; 127 128 - (void)invalidatePluginContentRect:(NSRect)rect; 129 130 @end 131 132 133 namespace WebKit { 134 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) 135 WebCore::CString proxiesForURL(NSURL *); 136 #endif 137 138 bool getAuthenticationInfo(const char* protocolStr, const char* hostStr, int32_t port, const char* schemeStr, const char* realmStr, 139 WebCore::CString& username, WebCore::CString& password); 140 } 141 142 #endif 143 144