bug 283606 make nsOSHelperAppService::GetApplicationDescription get a

friendly description
r=darin sr=bz a=asa
This commit is contained in:
cbiesinger%web.de 2005-08-16 22:00:21 +00:00
parent e9fbf5f581
commit 650c1f9ce5
2 changed files with 14 additions and 8 deletions

View File

@ -234,12 +234,18 @@ NS_IMETHODIMP nsOSHelperAppService::GetApplicationDescription(const nsACString&
if (!regKey)
return NS_ERROR_NOT_AVAILABLE;
// |getApplicationDescription| in nsIExternalProtocolService takes
// |AUTF8String| for aScheme, but for now, we can assume that it's ASCII
NS_ConvertASCIItoUTF16 cmdString(aScheme);
cmdString.AppendLiteral("\\shell\\open\\command");
NS_ConvertASCIItoUTF16 buf(aScheme);
nsCOMPtr<nsIFile> app;
GetDefaultAppInfo(buf, _retval, getter_AddRefs(app));
if (!_retval.Equals(buf))
return NS_OK;
// Fall back to full path
buf.AppendLiteral("\\shell\\open\\command");
nsresult rv = regKey->Open(nsIWindowsRegKey::ROOT_KEY_CLASSES_ROOT,
cmdString,
buf,
nsIWindowsRegKey::ACCESS_QUERY_VALUE);
if (NS_FAILED(rv))
return NS_ERROR_NOT_AVAILABLE;
@ -372,7 +378,8 @@ static void RemoveParameters(nsString& aPath)
// are actually DLLs invoked via rundll32.exe)
//
nsresult
nsOSHelperAppService::GetDefaultAppInfo(nsAString& aTypeName, nsAString& aDefaultDescription,
nsOSHelperAppService::GetDefaultAppInfo(const nsAString& aTypeName,
nsAString& aDefaultDescription,
nsIFile** aDefaultApplication)
{
#ifdef WINCE

View File

@ -1,5 +1,4 @@
/* -*- Mode: C++; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@ -71,7 +70,7 @@ public:
static PRBool GetValueString(HKEY hKey, const PRUnichar* pValueName, nsAString& result);
protected:
nsresult GetDefaultAppInfo(nsAString& aTypeName, nsAString& aDefaultDescription, nsIFile** aDefaultApplication);
nsresult GetDefaultAppInfo(const nsAString& aTypeName, nsAString& aDefaultDescription, nsIFile** aDefaultApplication);
// Lookup a mime info by extension, using an optional type hint
already_AddRefed<nsMIMEInfoWin> GetByExtension(const nsAFlatString& aFileExt, const char *aTypeHint = nsnull);
nsresult FindOSMimeInfoForType(const char * aMimeContentType, nsIURI * aURI, char ** aFileExtension, nsIMIMEInfo ** aMIMEInfo);