Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Private Attributes
MRJSecurityContext Class Reference

#include <MRJSecurityContext.h>

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

List of all members.

Public Member Functions

 MRJSecurityContext (const char *location)
 Security Considerations.
 ~MRJSecurityContext ()
NS_DECL_ISUPPORTS NS_IMETHOD Implies (const char *target, const char *action, PRBool *bAllowedAccess)
 Get the security context to be used in LiveConnect.
NS_IMETHOD GetOrigin (char *buf, int len)
 Get the origin associated with the context.
NS_IMETHOD GetCertificateID (char *buf, int len)
 Get the certificate associated with the context.
nsILiveconnectgetConnection ()
 MRJSecurityContext (const char *location)
 ~MRJSecurityContext ()
NS_DECL_ISUPPORTS NS_IMETHOD Implies (const char *target, const char *action, PRBool *bAllowedAccess)
 Get the security context to be used in LiveConnect.
NS_IMETHOD GetOrigin (char *buf, int len)
 Get the origin associated with the context.
NS_IMETHOD GetCertificateID (char *buf, int len)
 Get the certificate associated with the context.
nsILiveconnectgetConnection ()

Private Attributes

char * mLocation
nsILiveconnectmConnection

Detailed Description

Definition at line 43 of file MRJSecurityContext.h.


Constructor & Destructor Documentation

Security Considerations.

Definition at line 201 of file LiveConnectNativeMethods.cpp.

    :   mLocation(nsnull), mConnection(nsnull)
{
    mLocation = ::strdup(location);
    if (mLocation) {
        // find the 3rd slash of the URL, hopefully it's in canonical form.
        char* colon = ::strchr(mLocation, ':');
        if (colon) {
            if (colon[1] == '/' && colon[2] == '/') {
                char* slash = ::strchr(colon + 3, '/');
                if (slash) *slash = '\0';
            }
        }
    }

    if (theComponentManager) {
        theComponentManager->CreateInstance(kLiveConnectCID, nsnull, NS_GET_IID(nsILiveconnect),
                                            (void**)&mConnection);
    } else {
        mConnection = theLiveConnectManager;
        NS_IF_ADDREF(mConnection);
    }
}

Here is the call graph for this function:

Definition at line 225 of file LiveConnectNativeMethods.cpp.


Member Function Documentation

NS_METHOD MRJSecurityContext::GetCertificateID ( char *  buf,
int  len 
) [virtual]

Get the certificate associated with the context.

Parameters:
buf-- Result buffer (managed by the caller.)
len-- Buffer length.
Returns:
-- NS_OK if the codebase string was obtained. -- NS_FALSE otherwise.

Implements nsISecurityContext.

Definition at line 251 of file LiveConnectNativeMethods.cpp.

{
    // ACTION: Implement me.
    return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHOD MRJSecurityContext::GetCertificateID ( char *  buf,
int  len 
) [virtual]

Get the certificate associated with the context.

Parameters:
buf-- Result buffer (managed by the caller.)
len-- Buffer length.
Returns:
-- NS_OK if the codebase string was obtained. -- NS_FALSE otherwise.

Implements nsISecurityContext.

Definition at line 54 of file MRJSecurityContext.h.

{ return mConnection; }

Here is the caller graph for this function:

Definition at line 55 of file MRJSecurityContext.h.

{ return mConnection; }
NS_METHOD MRJSecurityContext::GetOrigin ( char *  buf,
int  len 
) [virtual]

Get the origin associated with the context.

Parameters:
buf-- Result buffer (managed by the caller.)
len-- Buffer length.
Returns:
-- NS_OK if the codebase string was obtained. -- NS_FALSE otherwise.

Implements nsISecurityContext.

Definition at line 241 of file LiveConnectNativeMethods.cpp.

{
    if (mLocation) {
        ::strncpy(buf, mLocation, len);
        return NS_OK;
    }
    return NS_ERROR_FAILURE;
}
NS_IMETHOD MRJSecurityContext::GetOrigin ( char *  buf,
int  len 
) [virtual]

Get the origin associated with the context.

Parameters:
buf-- Result buffer (managed by the caller.)
len-- Buffer length.
Returns:
-- NS_OK if the codebase string was obtained. -- NS_FALSE otherwise.

Implements nsISecurityContext.

NS_METHOD MRJSecurityContext::Implies ( const char *  target,
const char *  action,
PRBool bAllowedAccess 
) [virtual]

Get the security context to be used in LiveConnect.

This is used for JavaScript <--> Java.

Parameters:
target-- Possible target.
action-- Possible action on the target.
Returns:
-- NS_OK if the target and action is permitted on the security context. -- NS_FALSE otherwise.

Implements nsISecurityContext.

Definition at line 234 of file LiveConnectNativeMethods.cpp.

{
    *bAllowedAccess = (target != NULL && action == NULL);
    return NS_OK;
}
NS_DECL_ISUPPORTS NS_IMETHOD MRJSecurityContext::Implies ( const char *  target,
const char *  action,
PRBool bAllowedAccess 
) [virtual]

Get the security context to be used in LiveConnect.

This is used for JavaScript <--> Java.

Parameters:
target-- Possible target.
action-- Possible action on the target.
Returns:
-- NS_OK if the target and action is permitted on the security context. -- NS_FALSE otherwise.

Implements nsISecurityContext.


Member Data Documentation

Definition at line 58 of file MRJSecurityContext.h.

Definition at line 57 of file MRJSecurityContext.h.


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