diff --git a/uriloader/exthandler/os2/nsOSHelperAppService.cpp b/uriloader/exthandler/os2/nsOSHelperAppService.cpp index 02f73c00769..91ecd21c576 100644 --- a/uriloader/exthandler/os2/nsOSHelperAppService.cpp +++ b/uriloader/exthandler/os2/nsOSHelperAppService.cpp @@ -1502,6 +1502,27 @@ nsOSHelperAppService::GetMIMEInfoFromOS(const nsACString& aType, return retval; } +already_AddRefed +nsOSHelperAppService::GetProtocolInfoFromOS(const nsACString &aScheme) +{ + NS_ASSERTION(!aScheme.IsEmpty(), "No scheme was specified!"); + + PRBool exists; + nsresult rv = OSProtocolHandlerExists(nsPromiseFlatCString(aScheme).get(), + &exists); + NS_ENSURE_SUCCESS(rv, nsnull); + + nsMIMEInfoOS2 *handlerInfo = new nsMIMEInfoOS2(); + NS_ENSURE_TRUE(handlerInfo, nsnull); + NS_ADDREF(handlerInfo); + + nsAutoString desc; + GetApplicationDescription(aScheme, desc); + handlerInfo->SetDefaultDescription(desc); + + return handlerInfo; +} + NS_IMETHODIMP nsOSHelperAppService::GetApplicationDescription(const nsACString& aScheme, nsAString& _retval) diff --git a/uriloader/exthandler/os2/nsOSHelperAppService.h b/uriloader/exthandler/os2/nsOSHelperAppService.h index 0e6f43e085c..0be60ae3644 100644 --- a/uriloader/exthandler/os2/nsOSHelperAppService.h +++ b/uriloader/exthandler/os2/nsOSHelperAppService.h @@ -62,6 +62,7 @@ public: already_AddRefed GetMIMEInfoFromOS(const nsACString& aMimeType, const nsACString& aFileExt, PRBool *aFound); + already_AddRefed GetProtocolInfoFromOS(const nsACString &aScheme); // override nsIExternalProtocolService methods NS_IMETHODIMP GetApplicationDescription(const nsACString& aScheme, nsAString& _retval);