Mac OS X Reference Library Apple Developer Connection spyglass button

WebPlugIn Protocol Reference

(informal protocol)

Framework
/System/Library/Frameworks/WebKit.framework
Availability
Available in Mac OS X v10.3.9 and later.
Declared in
WebPlugin.h
Companion guides

Overview

The WebPlugIn informal protocol defines methods that enable interaction between an application using the WebKit framework and any WebKit-based plug-ins it may use.

Tasks

Accessing the Scripting Environment

Using Plug-in State Information

Controlling the Plug-in

Main Resource Messages

Instance Methods

objectForWebScript

Returns an object that exposes the plug-in’s scripting interface. (required)

- (id)objectForWebScript

Return Value

An object representing the plug-in’s scripting interface.

Discussion

The methods of the object are exposed to the script environment. Messages sent to the returned object will be invoked in the scripting environment. See the WebScripting Protocol Reference informal protocol for more details.

Availability
  • Available in Mac OS X v10.3.9 and later.
Related Sample Code
Declared In
WebPlugin.h

webPlugInDestroy

Prepares the plug-in for deallocation. (required)

- (void)webPlugInDestroy

Discussion

Typically, this method releases the memory and other resources used by the plug-in. For example, if the plug-in retained a WebPlugInContainer object, this method should release that object. Do not send any other messages to the plug-in after invoking this method, because calling this method destroys the plug-in. No other methods in this interface may be called after the application has called this method.

Availability
  • Available in Mac OS X v10.3.9 and later.
Related Sample Code
Declared In
WebPlugin.h

webPlugInInitialize

Initializes the plug-in. (required)

- (void)webPlugInInitialize

Discussion

Tells the plug-in to perform one-time initialization. This method must be called only once per instance of the plug-in object, before any other methods in the protocol are called.

Availability
  • Available in Mac OS X v10.3.9 and later.
Related Sample Code
Declared In
WebPlugin.h

webPlugInMainResourceDidFailWithError:

Invoked when an error occurs loading the main resource. (required)

- (void)webPlugInMainResourceDidFailWithError:(NSError *)error

Parameters
error

An error object containing details of why the connection failed to load the request successfully.

Discussion

This message is invoked when the underlying NSURLConnection object for the main resource sends the connection:didFailWithError: message to its delegate.

Availability
  • Available in Mac OS X v10.6 and later.
See Also
Declared In
WebPlugin.h

webPlugInMainResourceDidFinishLoading

Invoked when the connection successfully finishes loading data. (required)

- (void)webPlugInMainResourceDidFinishLoading

Discussion

This message is invoked when the WebPlugInShouldLoadMainResourceKey plug-in command-line argument is set to NO and the underlying NSURLConnection object for the main resource sends the connectionDidFinishLoading: message to its delegate.

Availability
  • Available in Mac OS X v10.6 and later.
See Also
Declared In
WebPlugin.h

webPlugInMainResourceDidReceiveData:

Invoked when the connection loads data incrementally. (required)

- (void)webPlugInMainResourceDidReceiveData:(NSData *)data

Parameters
data

The newly available data.

Discussion

This message is invoked when the WebPlugInShouldLoadMainResourceKey plug-in command-line argument is set to NO and the underlying NSURLConnection object for the main resource sends the connection:didReceiveData: message to its delegate.

Availability
  • Available in Mac OS X v10.6 and later.
See Also
Declared In
WebPlugin.h

webPlugInMainResourceDidReceiveResponse:

Invoked when the connection receives sufficient data to construct the URL response for its request. (required)

- (void)webPlugInMainResourceDidReceiveResponse:(NSURLResponse *)response

Parameters
response

The URL response for the connection's request.

Discussion

This message is invoked when the WebPlugInShouldLoadMainResourceKey plug-in command-line argument is set to NO and the underlying NSURLConnection object for the main resource sends the connection:didReceiveResponse: message to its delegate.

Availability
  • Available in Mac OS X v10.6 and later.
See Also
Declared In
WebPlugin.h

webPlugInSetIsSelected:

Controls plug-in behavior based on its selection. (required)

- (void)webPlugInSetIsSelected:(BOOL)selected

Parameters
isSelected

If YES, the plug-in is currently selected. Otherwise, it is not selected.

Discussion

This may be used, for example, to change the plug-in’s appearance when it is selected by the user.

Availability
  • Available in Mac OS X v10.3.9 and later.
Declared In
WebPlugin.h

webPlugInStart

Tells the plug-in to start normal operation. (required)

- (void)webPlugInStart

Discussion

The plug-in usually begins its primary task (such as drawing, playing sounds, or animating) in this method. This method may be called more than once, provided that the application has already called webPlugInInitialize and that each call to this method is followed later by a call to webPlugInStop.

Availability
  • Available in Mac OS X v10.3.9 and later.
Related Sample Code
Declared In
WebPlugin.h

webPlugInStop

Tells the plug-in to stop normal operation. (required)

- (void)webPlugInStop

Discussion

This method may be called more than once, provided that the application has already called webPlugInInitialize and that each call to this method is preceded by a call to webPlugInStart.

Availability
  • Available in Mac OS X v10.3.9 and later.
Related Sample Code
Declared In
WebPlugin.h


Last updated: 2009-03-27

Did this document help you? Yes It's good, but... Not helpful...