Back to index

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

List of all members.

Public Member Functions

 ProtocolRegistryEntry (const char *protocol)
nsresult set ()
nsresult reset ()
PRBool isAlreadySet () const
nsCString currentSetting (PRBool *currentUndefined=0) const
const char * valueNameArg () const
nsCString fullName () const

Public Attributes

nsCString protocol
HKEY baseKey
PRBool isNull
nsCString keyName
nsCString valueName
nsCString setting

Detailed Description

Definition at line 187 of file nsWindowsHooksUtil.cpp.


Constructor & Destructor Documentation

ProtocolRegistryEntry::ProtocolRegistryEntry ( const char *  protocol) [inline]

Definition at line 189 of file nsWindowsHooksUtil.cpp.

        : SavedRegistryEntry( HKEY_LOCAL_MACHINE, "", "", thisApplication().get() ),
          protocol( protocol ) {
        keyName = "Software\\Classes\\";
        keyName += protocol;
        keyName += "\\shell\\open\\command";

        // Append appropriate suffix to setting.
        if ( this->protocol.Equals( "chrome" ) || this->protocol.Equals( "MozillaXUL" ) ) {
            // Use "-chrome" command line flag.
            setting += chromeSuffix;
        } else {
            // Use standard "-url" command line flag.
            setting += shortcutSuffix;
        }
    }

Member Function Documentation

nsCString RegistryEntry::currentSetting ( PRBool currentUndefined = 0) const [inherited]

Definition at line 725 of file nsWindowsHooksUtil.cpp.

                                                                          {
    nsCString result;

    if ( currentlyUndefined ) {
        *currentlyUndefined = PR_TRUE;
    }

    HKEY   key;
    LONG   rc = ::RegOpenKey( baseKey, keyName.get(), &key );
    if ( rc == ERROR_SUCCESS ) {
        if (!IsNT()) {
            char buffer[4096] = { 0 };
            DWORD len = sizeof buffer;
            rc = ::RegQueryValueExA( key, valueNameArg(), NULL, NULL,
                 (LPBYTE)buffer, &len );
            if ( rc == ERROR_SUCCESS ) {
                nsAutoString uResult;
                NS_CopyNativeToUnicode(nsDependentCString(buffer), uResult);
                CopyUTF16toUTF8(uResult, result);
                if ( currentlyUndefined ) {
                    *currentlyUndefined = PR_FALSE; // Indicate entry is present
                }
            }
        } else {
            PRUnichar buffer[4096] = { 0 };
            DWORD len = sizeof buffer;
            rc = ::RegQueryValueExW( key,
                 NS_ConvertASCIItoUTF16(valueNameArg()).get(), NULL, NULL,
                 (LPBYTE)buffer, &len );
            if ( rc == ERROR_SUCCESS ) {
                CopyUTF16toUTF8(buffer, result);
                if ( currentlyUndefined ) {
                    *currentlyUndefined = PR_FALSE; // Indicate entry is present
                }
            }
        }
        ::RegCloseKey( key );
    }

    return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsCString RegistryEntry::fullName ( ) const [inherited]

Definition at line 302 of file nsWindowsHooksUtil.cpp.

                                        {
    nsCString result;
    if ( baseKey == HKEY_CURRENT_USER ) {
        result = "HKEY_CURRENT_USER\\";
    } else if ( baseKey == HKEY_LOCAL_MACHINE ) {
        result = "HKEY_LOCAL_MACHINE\\";
    } else {
        result = "\\";
    }
    result += keyName;
    if ( !valueName.IsEmpty() ) {
        result += "[";
        result += valueName;
        result += "]";
    }
    return result;
}

Here is the caller graph for this function:

PRBool RegistryEntry::isAlreadySet ( ) const [inherited]

Definition at line 321 of file nsWindowsHooksUtil.cpp.

                                         {
    PRBool result = FALSE;

    nsCAutoString current( currentSetting() );

    result = ( current == setting );

    return result;
}

Here is the call graph for this function:

Reimplemented from SavedRegistryEntry.

Reimplemented in FileTypeRegistryEntry.

Definition at line 629 of file nsWindowsHooksUtil.cpp.

                                      {
    // Restore this entry.
    nsresult rv = SavedRegistryEntry::reset();

    // Do same for corresponding DDE entry.
    DDERegistryEntry( protocol.get() ).reset();
    // Reset icon.
    ProtocolIconRegistryEntry( protocol.get() ).reset();

    // For http:, on WindowsXP, we need to do some extra cleanup.
    if ( protocol.EqualsLiteral( "http" ) ) {
        resetWindowsXP();
    }

    return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Reimplemented from SavedRegistryEntry.

Reimplemented in EditableFileTypeRegistryEntry, and FileTypeRegistryEntry.

Definition at line 524 of file nsWindowsHooksUtil.cpp.

                                    {
    // If the protocol is http, then we have to do special stuff.
    // We must take care of this first because setting the "protocol entry"
    // for http will cause WindowsXP to do stuff automatically for us,
    // thereby making it impossible for us to propertly reset.
    if ( protocol.EqualsLiteral( "http" ) ) {
        setWindowsXP();
    }

    // Set this entry.
    nsresult rv = SavedRegistryEntry::set();

    // Save and set corresponding DDE entry(ies).
    DDERegistryEntry( protocol.get() ).set();
    // Set icon.
    ProtocolIconRegistryEntry( protocol.get() ).set();

    return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

const char* RegistryEntry::valueNameArg ( ) const [inline, inherited]

Definition at line 148 of file nsWindowsHooksUtil.cpp.

                                     {
        return valueName.IsEmpty() ? NULL : valueName.get();
    }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 129 of file nsWindowsHooksUtil.cpp.

Definition at line 130 of file nsWindowsHooksUtil.cpp.

Definition at line 131 of file nsWindowsHooksUtil.cpp.

Definition at line 188 of file nsWindowsHooksUtil.cpp.

Definition at line 133 of file nsWindowsHooksUtil.cpp.

Definition at line 132 of file nsWindowsHooksUtil.cpp.


The documentation for this struct was generated from the following file: