2 * Copyright (C) 2004 Apple Computer, Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
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.
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.
29 #import <Foundation/Foundation.h>
30 #import <WebKit/WebKitAvailability.h>
33 #import <AppKit/AppKit.h>
37 WebPlugIn is an informal protocol that enables interaction between an application
38 and web related plug-ins it may contain.
41 @interface NSObject (WebPlugIn)
44 @method webPlugInInitialize
45 @abstract Tell the plug-in to perform one-time initialization.
46 @discussion This method must be only called once per instance of the plug-in
47 object and must be called before any other methods in this protocol.
49 - (void)webPlugInInitialize;
52 @method webPlugInStart
53 @abstract Tell the plug-in to start normal operation.
54 @discussion The plug-in usually begins drawing, playing sounds and/or
55 animation in this method. This method must be called before calling webPlugInStop.
56 This method may called more than once, provided that the application has
57 already called webPlugInInitialize and that each call to webPlugInStart is followed
58 by a call to webPlugInStop.
60 - (void)webPlugInStart;
64 @abstract Tell the plug-in to stop normal operation.
65 @discussion webPlugInStop must be called before this method. This method may be
66 called more than once, provided that the application has already called
67 webPlugInInitialize and that each call to webPlugInStop is preceded by a call to
70 - (void)webPlugInStop;
73 @method webPlugInDestroy
74 @abstract Tell the plug-in perform cleanup and prepare to be deallocated.
75 @discussion The plug-in typically releases memory and other resources in this
76 method. If the plug-in has retained the WebPlugInContainer, it must release
77 it in this mehthod. This method must be only called once per instance of the
78 plug-in object. No other methods in this interface may be called after the
79 application has called webPlugInDestroy.
81 - (void)webPlugInDestroy;
85 @method webPlugInSetIsSelected:
86 @discusssion Informs the plug-in whether or not it is selected. This is typically
87 used to allow the plug-in to alter it's appearance when selected.
89 - (void)webPlugInSetIsSelected:(BOOL)isSelected;
93 @property objectForWebScript
94 @discussion objectForWebScript is used to expose a plug-in's scripting interface. The
95 methods of the object are exposed to the script environment. See the WebScripting
96 informal protocol for more details.
97 @result Returns the object that exposes the plug-in's interface. The class of this
98 object can implement methods from the WebScripting informal protocol.
100 @property (nonatomic, readonly, strong) id objectForWebScript;
103 @method webPlugInMainResourceDidReceiveResponse:
104 @abstract Called on the plug-in when WebKit receives -connection:didReceiveResponse:
105 for the plug-in's main resource.
106 @discussion This method is only sent to the plug-in if the
107 WebPlugInShouldLoadMainResourceKey argument passed to the plug-in was NO.
109 - (void)webPlugInMainResourceDidReceiveResponse:(NSURLResponse *)response WEBKIT_AVAILABLE_MAC(10_6);
112 @method webPlugInMainResourceDidReceiveData:
113 @abstract Called on the plug-in when WebKit recieves -connection:didReceiveData:
114 for the plug-in's main resource.
115 @discussion This method is only sent to the plug-in if the
116 WebPlugInShouldLoadMainResourceKey argument passed to the plug-in was NO.
118 - (void)webPlugInMainResourceDidReceiveData:(NSData *)data WEBKIT_AVAILABLE_MAC(10_6);
121 @method webPlugInMainResourceDidFailWithError:
122 @abstract Called on the plug-in when WebKit receives -connection:didFailWithError:
123 for the plug-in's main resource.
124 @discussion This method is only sent to the plug-in if the
125 WebPlugInShouldLoadMainResourceKey argument passed to the plug-in was NO.
127 - (void)webPlugInMainResourceDidFailWithError:(NSError *)error WEBKIT_AVAILABLE_MAC(10_6);
130 @method webPlugInMainResourceDidFinishLoading
131 @abstract Called on the plug-in when WebKit receives -connectionDidFinishLoading:
132 for the plug-in's main resource.
133 @discussion This method is only sent to the plug-in if the
134 WebPlugInShouldLoadMainResourceKey argument passed to the plug-in was NO.
136 - (void)webPlugInMainResourceDidFinishLoading WEBKIT_AVAILABLE_MAC(10_6);