Bug #30157 --> add the ability to launch urls using OS default protocol handlers. (NOT PART OF THE BUILD)

code review will come when this is done and gets turned on.

part of the mac internet config stuff.
This commit is contained in:
mscott%netscape.com 2000-06-18 22:48:43 +00:00
Родитель 3b848d2cf2
Коммит 7438c28d5d
2 изменённых файлов: 48 добавлений и 1 удалений

Просмотреть файл

@ -27,6 +27,8 @@
#include "nsIURL.h"
#include "nsILocalFile.h"
#include <InternetConfig.h>
// this is a platform specific class that abstracts an application.
// we treat this object as a cookie when we pass it to an external app handler..
// the handler will present this cookie back to the helper app service along with a
@ -135,3 +137,43 @@ NS_IMETHODIMP nsOSHelperAppService::LaunchAppWithTempFile(nsIFile * aTempFile, n
else
return NS_ERROR_FAILURE;
}
// FIX ME --> implement
NS_IMETHODIMP nsOSHelperAppService::ExternalProtocolHandlerExists(const char * aProtocolScheme, PRBool * aHandlerExists)
{
// look up the protocol scheme in the windows registry....if we find a match then we have a handler for it...
*aHandlerExists = PR_FALSE;
return NS_OK;
}
// FIX ME --> implement
NS_IMETHODIMP nsOSHelperAppService::LoadUrl(nsIURI * aURL)
{
nsresult rv = NS_OK;
// use internet config to launch the uri
nsXPIDLCString uriStr;
pUri->GetSpec( getter_Copies( uriStr));
OSStatus err;
ICInstance inst;
long startSel;
long endSel = nsCRT::strlen( (const char *)uriStr);
err = ICStart(&inst, 'MOSS');
if (err == noErr)
{
err = ICFindConfigFile( inst, 0, nil);
if (err == noErr)
{
startSel = 0;
err = ICLaunchURL(inst, "\p", (char *)((const char *) uriStr), endSel, &startSel, &endSel);
if (err == noErr)
rv = NS_OK;
}
(void) ICStop(inst);
}
return rv;
}

Просмотреть файл

@ -28,7 +28,7 @@
// in addition to launching those applications. This is the Mac version.
#include "nsExternalHelperAppService.h"
#include "nsCExternalHelperApp.h"
#include "nsCExternalHandlerService.h"
#include "nsCOMPtr.h"
class nsOSHelperAppService : public nsExternalHelperAppService
@ -42,6 +42,11 @@ public:
NS_IMETHOD DoContent(const char *aMimeContentType, nsIURI *aURI, nsISupports *aWindowContext, PRBool *aAbortProcess, nsIStreamListener **_retval);
NS_IMETHOD LaunchAppWithTempFile(nsIFile * aTempFile, nsISupports * aAppCookie);
// override nsIExternalProtocolService methods
NS_IMETHOD ExternalProtocolHandlerExists(const char * aProtocolScheme, PRBool * aHandlerExists);
NS_IMETHOD LoadUrl(nsIURI * aURL);
protected:
// add any mac specific service state here