Home | History | Annotate | Download | only in Plugins
      1 /*
      2  * Copyright (C) 2004 Apple Computer, 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 #import <Cocoa/Cocoa.h>
     30 #import <JavaScriptCore/WebKitAvailability.h>
     31 
     32 /*!
     33     WebPlugIn is an informal protocol that enables interaction between an application
     34     and web related plug-ins it may contain.
     35 */
     36 
     37 @interface NSObject (WebPlugIn)
     38 
     39 /*!
     40     @method webPlugInInitialize
     41     @abstract Tell the plug-in to perform one-time initialization.
     42     @discussion This method must be only called once per instance of the plug-in
     43     object and must be called before any other methods in this protocol.
     44 */
     45 - (void)webPlugInInitialize;
     46 
     47 /*!
     48     @method webPlugInStart
     49     @abstract Tell the plug-in to start normal operation.
     50     @discussion The plug-in usually begins drawing, playing sounds and/or
     51     animation in this method.  This method must be called before calling webPlugInStop.
     52     This method may called more than once, provided that the application has
     53     already called webPlugInInitialize and that each call to webPlugInStart is followed
     54     by a call to webPlugInStop.
     55 */
     56 - (void)webPlugInStart;
     57 
     58 /*!
     59     @method webPlugInStop
     60     @abstract Tell the plug-in to stop normal operation.
     61     @discussion webPlugInStop must be called before this method.  This method may be
     62     called more than once, provided that the application has already called
     63     webPlugInInitialize and that each call to webPlugInStop is preceded by a call to
     64     webPlugInStart.
     65 */
     66 - (void)webPlugInStop;
     67 
     68 /*!
     69     @method webPlugInDestroy
     70     @abstract Tell the plug-in perform cleanup and prepare to be deallocated.
     71     @discussion The plug-in typically releases memory and other resources in this
     72     method.  If the plug-in has retained the WebPlugInContainer, it must release
     73     it in this mehthod.  This method must be only called once per instance of the
     74     plug-in object.  No other methods in this interface may be called after the
     75     application has called webPlugInDestroy.
     76 */
     77 - (void)webPlugInDestroy;
     78 
     79 /*!
     80     @method webPlugInSetIsSelected:
     81     @discusssion Informs the plug-in whether or not it is selected.  This is typically
     82     used to allow the plug-in to alter it's appearance when selected.
     83 */
     84 - (void)webPlugInSetIsSelected:(BOOL)isSelected;
     85 
     86 /*!
     87     @method objectForWebScript
     88     @discussion objectForWebScript is used to expose a plug-in's scripting interface.  The
     89     methods of the object are exposed to the script environment.  See the WebScripting
     90     informal protocol for more details.
     91     @result Returns the object that exposes the plug-in's interface.  The class of this
     92     object can implement methods from the WebScripting informal protocol.
     93 */
     94 - (id)objectForWebScript;
     95 
     96 /*!
     97     @method webPlugInMainResourceDidReceiveResponse:
     98     @abstract Called on the plug-in when WebKit receives -connection:didReceiveResponse:
     99     for the plug-in's main resource.
    100     @discussion This method is only sent to the plug-in if the
    101     WebPlugInShouldLoadMainResourceKey argument passed to the plug-in was NO.
    102 */
    103 - (void)webPlugInMainResourceDidReceiveResponse:(NSURLResponse *)response WEBKIT_OBJC_METHOD_ANNOTATION(AVAILABLE_IN_WEBKIT_VERSION_4_0);
    104 
    105 /*!
    106     @method webPlugInMainResourceDidReceiveData:
    107     @abstract Called on the plug-in when WebKit recieves -connection:didReceiveData:
    108     for the plug-in's main resource.
    109     @discussion This method is only sent to the plug-in if the
    110     WebPlugInShouldLoadMainResourceKey argument passed to the plug-in was NO.
    111 */
    112 - (void)webPlugInMainResourceDidReceiveData:(NSData *)data WEBKIT_OBJC_METHOD_ANNOTATION(AVAILABLE_IN_WEBKIT_VERSION_4_0);
    113 
    114 /*!
    115     @method webPlugInMainResourceDidFailWithError:
    116     @abstract Called on the plug-in when WebKit receives -connection:didFailWithError:
    117     for the plug-in's main resource.
    118     @discussion This method is only sent to the plug-in if the
    119     WebPlugInShouldLoadMainResourceKey argument passed to the plug-in was NO.
    120 */
    121 - (void)webPlugInMainResourceDidFailWithError:(NSError *)error WEBKIT_OBJC_METHOD_ANNOTATION(AVAILABLE_IN_WEBKIT_VERSION_4_0);
    122 
    123 /*!
    124     @method webPlugInMainResourceDidFinishLoading
    125     @abstract Called on the plug-in when WebKit receives -connectionDidFinishLoading:
    126     for the plug-in's main resource.
    127     @discussion This method is only sent to the plug-in if the
    128     WebPlugInShouldLoadMainResourceKey argument passed to the plug-in was NO.
    129 */
    130 - (void)webPlugInMainResourceDidFinishLoading WEBKIT_OBJC_METHOD_ANNOTATION(AVAILABLE_IN_WEBKIT_VERSION_4_0);
    131 
    132 @end
    133