WebPlugin.h 6.0 KB

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