Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes | Protected Attributes
CPluginInstancePeer Class Reference
Inheritance diagram for CPluginInstancePeer:
Inheritance graph
[legend]
Collaboration diagram for CPluginInstancePeer:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 CPluginInstancePeer (nsIPluginInstance *pluginInstance, NPP npp, nsMIMEType typeString, nsPluginMode type, PRUint16 attribute_cnt, const char **attribute_list, const char **values_list)
virtual ~CPluginInstancePeer (void)
NS_DECL_ISUPPORTS NS_IMETHOD GetValue (nsPluginInstancePeerVariable variable, void *value)
NS_IMETHOD SetValue (nsPluginInstancePeerVariable variable, void *value)
NS_IMETHOD GetMIMEType (nsMIMEType *result)
NS_IMETHOD GetMode (nsPluginMode *result)
NS_IMETHOD GetAttributes (PRUint16 &n, const char *const *&names, const char *const *&values)
NS_IMETHOD GetAttribute (const char *name, const char **result)
NS_IMETHOD NewStream (nsMIMEType type, const char *target, nsIOutputStream **result)
NS_IMETHOD ShowStatus (const char *message)
NS_IMETHOD SetWindowSize (PRUint32 width, PRUint32 height)
nsIPluginInstanceGetInstance (void)
NPP GetNPPInstance (void)
void SetWindow (NPWindow *window)
NPWindowGetWindow ()
 CPluginInstancePeer (nsIPluginInstance *pluginInstance, NPP npp, nsMIMEType typeString, nsPluginMode type, PRUint16 attribute_cnt, const char **attribute_list, const char **values_list)
virtual ~CPluginInstancePeer (void)
NS_DECL_ISUPPORTS NS_IMETHOD GetValue (nsPluginInstancePeerVariable variable, void *value)
 Returns the value of a variable associated with the plugin manager.
NS_IMETHOD SetValue (nsPluginInstancePeerVariable variable, void *value)
NS_IMETHOD GetMIMEType (nsMIMEType *result)
 Returns the MIME type of the plugin instance.
NS_IMETHOD GetMode (nsPluginMode *result)
 Returns the mode of the plugin instance, i.e.
NS_IMETHOD NewStream (nsMIMEType type, const char *target, nsIOutputStream **result)
 This operation is called by the plugin instance when it wishes to send a stream of data to the browser.
NS_IMETHOD ShowStatus (const char *message)
 This operation causes status information to be displayed on the window associated with the plugin instance.
NS_IMETHOD SetWindowSize (PRUint32 width, PRUint32 height)
 Set the desired size of the window in which the plugin instance lives.
NS_IMETHOD GetAttributes (PRUint16 &n, const char *const *&names, const char *const *&values)
NS_IMETHOD GetAttribute (const char *name, const char **result)
NS_IMETHOD GetDOMElement (nsIDOMElement **result)
 Returns the DOM element corresponding to the tag which references this plugin in the document.
NS_IMETHOD GetJavaEnv (JRIEnv **resultingEnv)
 Returns a JRI env corresponding to the current Java thread of the browser.
NS_IMETHOD GetJavaPeer (jref *resultingJavaPeer)
 Returns a JRI reference to the Java peer object associated with the plugin instance.
nsIPluginInstanceGetInstance (void)
NPP GetNPPInstance (void)
void SetWindow (NPWindow *window)
NPWindowGetWindow ()
void getValue (in nsPluginInstancePeerVariable aVariable, in voidPtr aValue)
 Returns the value of a variable associated with the plugin manager.
void newStream (in nsMIMEType aType, in string aTarget, out nsIOutputStream aResult)
 This operation is called by the plugin instance when it wishes to send a stream of data to the browser.
void showStatus (in string aMessage)
 This operation causes status information to be displayed on the window associated with the plugin instance.
void setWindowSize (in unsigned long aWidth, in unsigned long aHeight)
 Set the desired size of the window in which the plugin instance lives.
void getAttributes (in PRUint16Ref aCount, in constCharStarConstStar aNames, in constCharStarConstStar aValues)
 QueryInterface on nsIPluginInstancePeer to get this.
void getAttribute (in string aName, out constCharPtr aResult)
 Gets the value for the named attribute.
void getJavaEnv (out JRIEnvPtr aEnv)
 Returns a JRI env corresponding to the current Java thread of the browser.
void getJavaPeer (out jref aJavaPeer)
 Returns a JRI reference to the Java peer object associated with the plugin instance.

Public Attributes

readonly attribute nsMIMEType MIMEType
 Returns the MIME type of the plugin instance.
readonly attribute nsPluginMode mode
 Returns the mode of the plugin instance, i.e.

Protected Attributes

NPP npp
nsIPluginInstancemInstance
NPWindowmWindow
nsMIMEType typeString
nsPluginMode type
PRUint16 attribute_cnt
char ** attribute_list
char ** values_list

Detailed Description

Definition at line 300 of file badapter.cpp.


Constructor & Destructor Documentation

CPluginInstancePeer::CPluginInstancePeer ( nsIPluginInstance pluginInstance,
NPP  npp,
nsMIMEType  typeString,
nsPluginMode  type,
PRUint16  attribute_cnt,
const char **  attribute_list,
const char **  values_list 
)

Definition at line 1364 of file badapter.cpp.

    :  mInstance(pluginInstance), mWindow(NULL),
              npp(npp), typeString(typeString), type(type), attribute_cnt(attr_cnt),
              attribute_list(NULL), values_list(NULL)
{
    NS_IF_ADDREF(mInstance);

    attribute_list = (char**) NPN_MemAlloc(attr_cnt * sizeof(const char*));
    values_list = (char**) NPN_MemAlloc(attr_cnt * sizeof(const char*));

    if (attribute_list != NULL && values_list != NULL) {
        for (int i = 0; i < attribute_cnt; i++)   {
            attribute_list[i] = (char*) NPN_MemAlloc(strlen(attr_list[i]) + 1);
            if (attribute_list[i] != NULL)
                strcpy(attribute_list[i], attr_list[i]);

            values_list[i] = (char*) NPN_MemAlloc(strlen(val_list[i]) + 1);
            if (values_list[i] != NULL)
                strcpy(values_list[i], val_list[i]);
        }
    }
}

Here is the call graph for this function:

Definition at line 1393 of file badapter.cpp.

Here is the call graph for this function:

CPluginInstancePeer::CPluginInstancePeer ( nsIPluginInstance pluginInstance,
NPP  npp,
nsMIMEType  typeString,
nsPluginMode  type,
PRUint16  attribute_cnt,
const char **  attribute_list,
const char **  values_list 
)

Member Function Documentation

void nsIPluginTagInfo::getAttribute ( in string  aName,
out constCharPtr  aResult 
) [inherited]

Gets the value for the named attribute.

Parameters:
aName- the name of the attribute to find
aResult- the resulting attribute
Returns:
- NS_OK if this operation was successful, NS_ERROR_FAILURE if this operation failed. result is set to NULL if the attribute is not found else to the found value.
NS_METHOD CPluginInstancePeer::GetAttribute ( const char *  name,
const char **  result 
)

Definition at line 1515 of file badapter.cpp.

{
    for (int i=0; i < attribute_cnt; i++)  {
#if defined(XP_UNIX) || defined(XP_MAC)
        if (strcasecmp(name, attribute_list[i]) == 0)
#else
            if (stricmp(name, attribute_list[i]) == 0) 
#endif
            {
                *result = values_list[i];
                return NS_OK;
            }
    }

    return NS_ERROR_FAILURE;
}

Here is the call graph for this function:

NS_IMETHOD CPluginInstancePeer::GetAttribute ( const char *  name,
const char **  result 
)

QueryInterface on nsIPluginInstancePeer to get this.

(Corresponds to NPP_New's argc, argn, and argv arguments.) Get a ptr to the paired list of attribute names and values, returns the length of the array.

Each name or value is a null-terminated string.

NS_METHOD CPluginInstancePeer::GetAttributes ( PRUint16 n,
const char *const *&  names,
const char *const *&  values 
)

Definition at line 1467 of file badapter.cpp.

NS_IMETHOD CPluginInstancePeer::GetAttributes ( PRUint16 n,
const char *const *&  names,
const char *const *&  values 
)

Returns the DOM element corresponding to the tag which references this plugin in the document.

REMIND: do we need to expose as an nsISupports * to avoid introducing runtime dependencies on XPCOM?

Parameters:
result- resulting DOM element
Returns:
- NS_OK if this operation was successful

PENDING

Definition at line 2267 of file BackwardAdapter.cpp.

{
       return NS_OK;
}

Definition at line 353 of file badapter.cpp.

{ return mInstance; }

Here is the caller graph for this function:

Definition at line 717 of file BackwardAdapter.cpp.

{ return mInstance; }

Returns a JRI env corresponding to the current Java thread of the browser.

(Corresponds to NPN_GetJavaEnv.)

Returns a JRI env corresponding to the current Java thread of the browser.

(Corresponds to NPN_GetJavaEnv.)

Returns:
- NS_OK if this operation was successful

Definition at line 2177 of file BackwardAdapter.cpp.

{
       *resultingEnv = NPN_GetJavaEnv();
       return NS_OK;
}

Here is the call graph for this function:

Returns a JRI reference to the Java peer object associated with the plugin instance.

This object is an instance of the class specified by nsIJRILiveConnectPlugin::GetJavaClass.

(Corresponds to NPN_GetJavaPeer.)

Returns a JRI reference to the Java peer object associated with the plugin instance.

This object is an instance of the class specified by nsIJRILiveConnectPlugin::GetJavaClass.

(Corresponds to NPN_GetJavaPeer.)

Parameters:
resultingJavaPeer- a resulting reference to the Java instance
Returns:
- NS_OK if this operation was successful

Definition at line 2194 of file BackwardAdapter.cpp.

{
       *resultingJavaPeer = NPN_GetJavaPeer(npp);
       return NS_OK;
}

Here is the call graph for this function:

Definition at line 1443 of file badapter.cpp.

{
    *result = typeString;
    return NS_OK;
}

Returns the MIME type of the plugin instance.

(Corresponds to NPP_New's MIMEType argument.)

Parameters:
result- resulting MIME type
Returns:
- NS_OK if this operation was successful

Definition at line 1455 of file badapter.cpp.

{
    *result = type;
    return NS_OK;
}

Returns the mode of the plugin instance, i.e.

whether the plugin is embedded in the html, or full page.

(Corresponds to NPP_New's mode argument.)

Parameters:
result- the resulting mode
Returns:
- NS_OK if this operation was successful

Definition at line 354 of file badapter.cpp.

{ return npp; }

Definition at line 718 of file BackwardAdapter.cpp.

{ return npp; }
void nsIPluginInstancePeer::getValue ( in nsPluginInstancePeerVariable  aVariable,
in voidPtr  aValue 
) [inherited]

Returns the value of a variable associated with the plugin manager.

(Corresponds to NPN_GetValue.)

Parameters:
aVariable- the plugin manager variable to get
aValue- the address of where to store the resulting value
Returns:
- NS_OK if this operation was successful

Definition at line 1414 of file badapter.cpp.

{
#ifdef XP_UNIX
    return fromNPError[NPN_GetValue(NULL, (NPNVariable)varMap[(int)variable], value)];
#else
    return fromNPError[NPERR_GENERIC_ERROR];
#endif // XP_UNIX
}

Here is the call graph for this function:

Returns the value of a variable associated with the plugin manager.

(Corresponds to NPN_GetValue.)

Parameters:
variable- the plugin manager variable to get
value- the address of where to store the resulting value
Returns:
- NS_OK if this operation was successful

Definition at line 357 of file badapter.cpp.

{ return mWindow; }

Definition at line 721 of file BackwardAdapter.cpp.

{ return mWindow; }
void nsIPluginInstancePeer::newStream ( in nsMIMEType  aType,
in string  aTarget,
out nsIOutputStream  aResult 
) [inherited]

This operation is called by the plugin instance when it wishes to send a stream of data to the browser.

It constructs a new output stream to which the plugin may send the data. When complete, the Close and Release methods should be called on the output stream.

(Corresponds to NPN_NewStream.)

Parameters:
aType- MIME type of the stream to create
aTarget- the target window name to receive the data
aResult- the resulting output stream
Returns:
- NS_OK if this operation was successful
NS_METHOD CPluginInstancePeer::NewStream ( nsMIMEType  type,
const char *  target,
nsIOutputStream **  result 
)

Definition at line 1536 of file badapter.cpp.

{
    assert( npp != NULL );
    
    // Create a new NPStream.
    NPStream* stream = NULL;
    NPError error = NPN_NewStream(npp, (NPMIMEType)type, target, &stream);
    if (error != NPERR_NO_ERROR)
        return fromNPError[error];
    
    // Create a new Plugin Manager Stream.
    // XXX - Do we have to Release() the manager stream before doing this?
    // XXX - See the BAM doc for more info.
    CPluginManagerStream* mstream = new CPluginManagerStream(npp, stream);
    if (mstream == NULL)
        return NS_ERROR_OUT_OF_MEMORY;
    mstream->AddRef();
    *result = (nsIOutputStream* )mstream;

    return NS_OK;
}

Here is the call graph for this function:

NS_IMETHOD CPluginInstancePeer::NewStream ( nsMIMEType  type,
const char *  target,
nsIOutputStream **  result 
)

This operation is called by the plugin instance when it wishes to send a stream of data to the browser.

It constructs a new output stream to which the plugin may send the data. When complete, the Close and Release methods should be called on the output stream.

(Corresponds to NPN_NewStream.)

Parameters:
type- type MIME type of the stream to create
target- the target window name to receive the data
result- the resulting output stream
Returns:
- NS_OK if this operation was successful

Definition at line 1428 of file badapter.cpp.

{
#ifdef XP_UNIX
    return fromNPError[NPN_SetValue(NULL, (NPPVariable)varMap[(int)variable], value)];
#else
    return fromNPError[NPERR_GENERIC_ERROR];
#endif // XP_UNIX
}

Here is the call graph for this function:

Definition at line 356 of file badapter.cpp.

{ mWindow = window; }

Here is the caller graph for this function:

Definition at line 720 of file BackwardAdapter.cpp.

{ mWindow = window; }
void nsIPluginInstancePeer::setWindowSize ( in unsigned long  aWidth,
in unsigned long  aHeight 
) [inherited]

Set the desired size of the window in which the plugin instance lives.

Parameters:
aWidth- new window width
aHeight- new window height
Returns:
- NS_OK if this operation was successful

Definition at line 1573 of file badapter.cpp.

Here is the call graph for this function:

Set the desired size of the window in which the plugin instance lives.

Parameters:
width- new window width
height- new window height
Returns:
- NS_OK if this operation was successful
void nsIPluginInstancePeer::showStatus ( in string  aMessage) [inherited]

This operation causes status information to be displayed on the window associated with the plugin instance.

(Corresponds to NPN_Status.)

Parameters:
aMessage- the status message to display
Returns:
- NS_OK if this operation was successful

Definition at line 1564 of file badapter.cpp.

{
    assert( message != NULL );

    NPN_Status(npp, message);
       return NS_OK;
}

Here is the call graph for this function:

This operation causes status information to be displayed on the window associated with the plugin instance.

(Corresponds to NPN_Status.)

Parameters:
message- the status message to display
Returns:
- NS_OK if this operation was successful

Member Data Documentation

Definition at line 368 of file badapter.cpp.

Definition at line 369 of file badapter.cpp.

Returns the MIME type of the plugin instance.

(Corresponds to NPP_New's MIMEType argument.)

Parameters:
aMIMEType- resulting MIME type
Returns:
- NS_OK if this operation was successful

Definition at line 88 of file nsIPluginInstancePeer.idl.

Definition at line 364 of file badapter.cpp.

Returns the mode of the plugin instance, i.e.

whether the plugin is embedded in the html, or full page.

(Corresponds to NPP_New's mode argument.)

Parameters:
result- the resulting mode
Returns:
- NS_OK if this operation was successful

Definition at line 99 of file nsIPluginInstancePeer.idl.

Definition at line 365 of file badapter.cpp.

Definition at line 361 of file badapter.cpp.

Definition at line 367 of file badapter.cpp.

Definition at line 366 of file badapter.cpp.

char ** CPluginInstancePeer::values_list [protected]

Definition at line 370 of file badapter.cpp.


The documentation for this class was generated from the following files: