Back to index

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

#include <nsEmbedChromeRegistry.h>

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

List of all members.

Public Member Functions

 nsEmbedChromeRegistry ()
virtual ~nsEmbedChromeRegistry ()
nsresult Init ()
NS_DECL_ISUPPORTS
NS_DECL_NSICHROMEREGISTRY
nsresult 
ReadChromeRegistry ()
nsresult ProcessNewChromeBuffer (char *aBuffer, PRInt32 aLength)
PRInt32 ProcessChromeLine (const char *aBuffer, PRInt32 aLength)
nsresult RegisterChrome (const nsACString &aChromeType, const nsACString &aChromeProfile, const nsACString &aChromeLocType, const nsACString &aChromeLocation)
nsresult RegisterChrome (PRInt32 aChromeType, PRBool aChromeIsProfile, PRBool aChromeIsURL, const nsACString &aChromeLocation)
nsIURI convertChromeURL (in nsIURI aChromeURL)
 Resolve a chrome URL to an loadable URI using the information in the registry.
void checkForNewChrome ()
 refresh the chrome list at runtime, looking for new packages/etc

Public Attributes

const PRInt32 NONE = 0
const PRInt32 PARTIAL = 1
const PRInt32 FULL = 2

Private Attributes

nsCOMPtr< nsISupportsArraymEmptyArray

Detailed Description

Definition at line 47 of file nsEmbedChromeRegistry.h.


Constructor & Destructor Documentation

Definition at line 159 of file nsEmbedChromeRegistry.cpp.

{
}
virtual nsEmbedChromeRegistry::~nsEmbedChromeRegistry ( ) [inline, virtual]

Definition at line 51 of file nsEmbedChromeRegistry.h.

{};

Member Function Documentation

refresh the chrome list at runtime, looking for new packages/etc

nsIURI nsIChromeRegistry::convertChromeURL ( in nsIURI  aChromeURL) [inherited]

Resolve a chrome URL to an loadable URI using the information in the registry.

Does not modify aChromeURL.

Chrome URLs are allowed to be specified in "shorthand", leaving the "file" portion off. In that case, the URL is expanded to:

chrome://package/provider/package.ext

where "ext" is:

"xul" for a "content" package, "css" for a "skin" package, and "dtd" for a "locale" package.

Parameters:
aChromeURLthe URL that is to be converted.

Definition at line 164 of file nsEmbedChromeRegistry.cpp.

{
    NS_ASSERTION(0, "Creating embedding chrome registry\n");
    nsresult rv;
    
    rv = NS_NewISupportsArray(getter_AddRefs(mEmptyArray));
    if (NS_FAILED(rv)) return rv;

    rv = ReadChromeRegistry();
    if (NS_FAILED(rv)) return rv;
    
    return NS_OK;
}

Here is the call graph for this function:

Definition at line 234 of file nsEmbedChromeRegistry.cpp.

{
    PRInt32 bytesProcessed = 0;
    chromeToken tokens[MAX_TOKENS];
    PRInt32 tokenCount = 0;
    PRBool expectingToken = PR_TRUE;
    
    while (bytesProcessed <= aLength &&
           *aBuffer != '\n' && *aBuffer != '\r' &&
           tokenCount < MAX_TOKENS) {

        if (*aBuffer == ',') {
            tokenCount++;
            expectingToken = PR_TRUE;
        }
        else if (expectingToken)
            tokens[tokenCount].tokenStart = aBuffer;
        else
            tokens[tokenCount].tokenEnd = aBuffer;


        aBuffer++;
        bytesProcessed++;
    }
    NS_ASSERTION(tokenCount == 4, "Unexpected tokens in line");

    nsDependentCSubstring
        chromeType(tokens[0].tokenStart, tokens[0].tokenEnd);
    nsDependentCSubstring
        chromeProfile(tokens[1].tokenStart, tokens[1].tokenEnd);
    nsDependentCSubstring
        chromeLocType(tokens[2].tokenStart, tokens[2].tokenEnd);
    nsDependentCSubstring
        chromeLocation(tokens[3].tokenStart, tokens[3].tokenEnd);
    
    RegisterChrome(chromeType, chromeProfile, chromeLocType, chromeLocation);
    return bytesProcessed;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 217 of file nsEmbedChromeRegistry.cpp.

{
    while (aLength > 0) {
        PRInt32 processedBytes = ProcessChromeLine(aBuffer, aLength);
        aBuffer += processedBytes;
        aLength -= processedBytes;
    }
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 179 of file nsEmbedChromeRegistry.cpp.

{
    nsresult rv;
    nsCOMPtr<nsIProperties> directoryService =
        do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv);
    if (NS_FAILED(rv)) return rv;

    nsCOMPtr<nsILocalFile> listFile;
    rv = directoryService->Get(NS_APP_CHROME_DIR, NS_GET_IID(nsILocalFile),
                               getter_AddRefs(listFile));
    if (NS_FAILED(rv)) return rv;

    rv = listFile->AppendRelativeNativePath(NS_LITERAL_CSTRING("installed-chrome.txt"));
    if (NS_FAILED(rv)) return rv;

    PRFileDesc *file;
    rv = listFile->OpenNSPRFileDesc(PR_RDONLY, 0, &file);
    if (NS_FAILED(rv)) return rv;

    PRFileInfo finfo;

    if (PR_GetOpenFileInfo(file, &finfo) == PR_SUCCESS) {
        char *dataBuffer = new char[finfo.size+1];
        if (dataBuffer) {
            PRInt32 bufferSize = PR_Read(file, dataBuffer, finfo.size);
            if (bufferSize > 0) {
                dataBuffer[bufferSize] = '\r';
                rv = ProcessNewChromeBuffer(dataBuffer, bufferSize);
            }
            delete [] dataBuffer;
        }
    }
    PR_Close(file);

    return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsEmbedChromeRegistry::RegisterChrome ( const nsACString &  aChromeType,
const nsACString &  aChromeProfile,
const nsACString &  aChromeLocType,
const nsACString &  aChromeLocation 
)

Definition at line 274 of file nsEmbedChromeRegistry.cpp.

{
    PRInt32 chromeType;
    if (aChromeType.EqualsLiteral("skin"))
        chromeType = CHROME_TYPE_SKIN;
    else if (aChromeType.EqualsLiteral("locale"))
        chromeType = CHROME_TYPE_LOCALE;
    else
        chromeType = CHROME_TYPE_CONTENT;

    PRBool chromeIsProfile =
        aChromeProfile.EqualsLiteral("profile");

    PRBool chromeIsURL =
        aChromeProfile.EqualsLiteral("url");

    return RegisterChrome(chromeType, chromeIsProfile, chromeIsURL,
                          aChromeLocation);
}

Here is the caller graph for this function:

nsresult nsEmbedChromeRegistry::RegisterChrome ( PRInt32  aChromeType,
PRBool  aChromeIsProfile,
PRBool  aChromeIsURL,
const nsACString &  aChromeLocation 
)

Definition at line 298 of file nsEmbedChromeRegistry.cpp.

{


    return NS_OK;
}

Member Data Documentation

Definition at line 51 of file nsIChromeRegistry.idl.

Definition at line 73 of file nsEmbedChromeRegistry.h.

Definition at line 49 of file nsIChromeRegistry.idl.

Definition at line 50 of file nsIChromeRegistry.idl.


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