Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
nsJVMPluginTagInfo Class Reference

#include <nsJVMPluginTagInfo.h>

Inheritance diagram for nsJVMPluginTagInfo:
Inheritance graph
[legend]
Collaboration diagram for nsJVMPluginTagInfo:
Collaboration graph
[legend]

List of all members.

Public Member Functions

NS_DECL_AGGREGATED NS_IMETHOD GetCode (const char **result)
NS_IMETHOD GetCodeBase (const char **result)
NS_IMETHOD GetArchive (const char **result)
NS_IMETHOD GetName (const char **result)
NS_IMETHOD GetMayScript (PRBool *result)

Static Public Member Functions

static NS_METHOD Create (nsISupports *outer, const nsIID &aIID, void **aInstancePtr, nsIPluginTagInfo2 *info)

Protected Member Functions

 nsJVMPluginTagInfo (nsISupports *outer, nsIPluginTagInfo2 *info)
virtual ~nsJVMPluginTagInfo (void)

Protected Attributes

nsIPluginTagInfo2fPluginTagInfo
char * fSimulatedCodebase
char * fSimulatedCode

Detailed Description

Definition at line 51 of file nsJVMPluginTagInfo.h.


Constructor & Destructor Documentation

nsJVMPluginTagInfo::nsJVMPluginTagInfo ( nsISupports *  outer,
nsIPluginTagInfo2 info 
) [protected]

Definition at line 53 of file nsJVMPluginTagInfo.cpp.

Here is the caller graph for this function:

nsJVMPluginTagInfo::~nsJVMPluginTagInfo ( void  ) [protected, virtual]

Member Function Documentation

NS_METHOD nsJVMPluginTagInfo::Create ( nsISupports *  outer,
const nsIID aIID,
void **  aInstancePtr,
nsIPluginTagInfo2 info 
) [static]

Definition at line 216 of file nsJVMPluginTagInfo.cpp.

{
        if(!aInstancePtr)
            return NS_ERROR_INVALID_POINTER;

    if (outer && !aIID.Equals(NS_GET_IID(nsISupports)))
        return NS_ERROR_INVALID_ARG;

    nsJVMPluginTagInfo* jvmTagInfo = new nsJVMPluginTagInfo(outer, info);
    if (jvmTagInfo == NULL)
        return NS_ERROR_OUT_OF_MEMORY;

        nsresult result = jvmTagInfo->AggregatedQueryInterface(aIID, aInstancePtr);
        if (NS_FAILED(result)) goto error;

    result = jvmTagInfo->QueryInterface(kIPluginTagInfo2IID,
                                            (void**)&jvmTagInfo->fPluginTagInfo);
    if (NS_FAILED(result)) goto error;
    return result;

  error:
    delete jvmTagInfo;
    return result;
}

Here is the call graph for this function:

NS_METHOD nsJVMPluginTagInfo::GetArchive ( const char **  result) [virtual]

Implements nsIJVMPluginTagInfo.

Definition at line 176 of file nsJVMPluginTagInfo.cpp.

{
    return fPluginTagInfo->GetAttribute("archive", result);
}
NS_METHOD nsJVMPluginTagInfo::GetCode ( const char **  result) [virtual]

Implements nsIJVMPluginTagInfo.

Definition at line 110 of file nsJVMPluginTagInfo.cpp.

{
    if (fSimulatedCode) {
        *result = fSimulatedCode;
        return NS_OK;
    }

    const char* code;
    nsresult err = fPluginTagInfo->GetAttribute("code", &code);
    if (err == NS_OK && code) {
        fSimulatedCode = PL_strdup(code);
        oji_StandardizeCodeAttribute(fSimulatedCode);
        *result = fSimulatedCode;
        return NS_OK;
    }

    const char* classid;
    err = fPluginTagInfo->GetAttribute("classid", &classid);
    if (err == NS_OK && classid && PL_strncasecmp(classid, "java:", 5) == 0) {
        fSimulatedCode = PL_strdup(classid + 5); // skip "java:"
        oji_StandardizeCodeAttribute(fSimulatedCode);
        *result = fSimulatedCode;
        return NS_OK;
    }

    // XXX what about "javaprogram:" and "javabean:"?
    return NS_ERROR_FAILURE;
}

Here is the call graph for this function:

NS_METHOD nsJVMPluginTagInfo::GetCodeBase ( const char **  result) [virtual]

Implements nsIJVMPluginTagInfo.

Definition at line 140 of file nsJVMPluginTagInfo.cpp.

{
    // If we've already cached and computed the value, use it...
    if (fSimulatedCodebase) {
        *result = fSimulatedCodebase;
        return NS_OK;
    }

    // See if it's supplied as an attribute...
    const char* codebase;
    nsresult err = fPluginTagInfo->GetAttribute("codebase", &codebase);
    if (err == NS_OK && codebase != NULL) {
        *result = codebase;
        return NS_OK;
    }

    // Okay, we'll need to simulate it from the layout tag's base URL.
    const char* docBase;
    err = fPluginTagInfo->GetDocumentBase(&docBase);
    if (err != NS_OK) return err;
    codebase = (const char*) docBase;

    if ((fSimulatedCodebase = PL_strdup(codebase)) != NULL) {
        char* lastSlash = PL_strrchr(fSimulatedCodebase, '/');

        // chop of the filename from the original document base URL to
        // generate the codebase.
        if (lastSlash != NULL)
            *(lastSlash + 1) = '\0';
    }
    
    *result = fSimulatedCodebase;
    return NS_OK;
}

Here is the call graph for this function:

Implements nsIJVMPluginTagInfo.

Definition at line 200 of file nsJVMPluginTagInfo.cpp.

{
    const char* attr;
    *result = PR_FALSE;

    nsresult err = fPluginTagInfo->GetAttribute("mayscript", &attr);
    if (err) return err;

    if (PL_strcasecmp(attr, "true") == 0)
    {
       *result = PR_TRUE;
    }
    return NS_OK;
}

Here is the call graph for this function:

NS_METHOD nsJVMPluginTagInfo::GetName ( const char **  result) [virtual]

Implements nsIJVMPluginTagInfo.

Definition at line 182 of file nsJVMPluginTagInfo.cpp.

{
    const char* attrName;
    nsPluginTagType type;
    nsresult err = fPluginTagInfo->GetTagType(&type);
    if (err != NS_OK) return err;
    switch (type) {
      case nsPluginTagType_Applet:
        attrName = "name";
        break;
      default:
        attrName = "id";
        break;
    }
    return fPluginTagInfo->GetAttribute(attrName, result);
}

Here is the caller graph for this function:


Member Data Documentation

Definition at line 89 of file nsJVMPluginTagInfo.h.

Definition at line 91 of file nsJVMPluginTagInfo.h.

Definition at line 90 of file nsJVMPluginTagInfo.h.


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