Bug 469023 - network.protocol-handler.warn-external-default does not work with hildon platform. r=bugmail,doug
--- a/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
+++ b/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
@@ -114,16 +114,28 @@ nsMIMEInfoUnix::LaunchDefaultWithFile(ns
if (!mDefaultApplication)
return NS_ERROR_FILE_NOT_FOUND;
return LaunchWithIProcess(mDefaultApplication, nativePath);
}
#ifdef MOZ_PLATFORM_HILDON
+/* static */ PRBool
+nsMIMEInfoUnix::HandlerExists(const char *aProtocolScheme)
+{
+ PRBool isEnabled = PR_FALSE;
+ HildonURIAction *action = hildon_uri_get_default_action(aProtocolScheme, nsnull);
+ if (action) {
+ isEnabled = PR_TRUE;
+ hildon_uri_action_unref(action);
+ }
+ return isEnabled;
+}
+
NS_IMETHODIMP
nsMIMEInfoUnix::GetPossibleApplicationHandlers(nsIMutableArray ** aPossibleAppHandlers)
{
if (!mPossibleApplications) {
mPossibleApplications = do_CreateInstance(NS_ARRAY_CONTRACTID);
if (!mPossibleApplications)
return NS_ERROR_OUT_OF_MEMORY;
--- a/uriloader/exthandler/unix/nsMIMEInfoUnix.h
+++ b/uriloader/exthandler/unix/nsMIMEInfoUnix.h
@@ -44,16 +44,17 @@
class nsMIMEInfoUnix : public nsMIMEInfoImpl
{
public:
nsMIMEInfoUnix(const char *aMIMEType = "") : nsMIMEInfoImpl(aMIMEType) {}
nsMIMEInfoUnix(const nsACString& aMIMEType) : nsMIMEInfoImpl(aMIMEType) {}
nsMIMEInfoUnix(const nsACString& aType, HandlerClass aClass) :
nsMIMEInfoImpl(aType, aClass) {}
+ static PRBool HandlerExists(const char *aProtocolScheme);
protected:
NS_IMETHOD GetHasDefaultHandler(PRBool *_retval);
virtual NS_HIDDEN_(nsresult) LoadUriInternal(nsIURI *aURI);
virtual NS_HIDDEN_(nsresult) LaunchDefaultWithFile(nsIFile *aFile);
#ifdef MOZ_PLATFORM_HILDON
--- a/uriloader/exthandler/unix/nsOSHelperAppService.cpp
+++ b/uriloader/exthandler/unix/nsOSHelperAppService.cpp
@@ -1270,16 +1270,20 @@ nsresult nsOSHelperAppService::OSProtoco
*aHandlerExists = (NS_SUCCEEDED(rv1) && exists && NS_SUCCEEDED(rv2) && isExecutable);
LOG((" handler exists: %s\n", *aHandlerExists ? "yes" : "no"));
}
#ifdef MOZ_WIDGET_GTK2
// Check the GConf registry for a protocol handler
if (!*aHandlerExists)
*aHandlerExists = nsGNOMERegistry::HandlerExists(aProtocolScheme);
+#ifdef MOZ_PLATFORM_HILDON
+ if (!*aHandlerExists)
+ *aHandlerExists = nsMIMEInfoUnix::HandlerExists(aProtocolScheme);
+#endif
#endif
return NS_OK;
}
NS_IMETHODIMP nsOSHelperAppService::GetApplicationDescription(const nsACString& aScheme, nsAString& _retval)
{
nsCOMPtr<nsIFile> appFile;