From 065a782ee4fe115de4ef6ddbc7928b34a386c912 Mon Sep 17 00:00:00 2001 From: "bzbarsky%mit.edu" Date: Fri, 30 Nov 2001 01:10:10 +0000 Subject: [PATCH] backing this out. need to get some build magic on the mac first. :( git-svn-id: svn://10.0.0.236/trunk@109303 18797224-902f-48f8-a5cc-f745e15eee43 --- .../exthandler/nsExternalHelperAppService.cpp | 70 +------------------ .../exthandler/nsExternalHelperAppService.h | 5 -- 2 files changed, 3 insertions(+), 72 deletions(-) diff --git a/mozilla/uriloader/exthandler/nsExternalHelperAppService.cpp b/mozilla/uriloader/exthandler/nsExternalHelperAppService.cpp index 3a7e81e8fc1..8e5dcecd014 100644 --- a/mozilla/uriloader/exthandler/nsExternalHelperAppService.cpp +++ b/mozilla/uriloader/exthandler/nsExternalHelperAppService.cpp @@ -31,7 +31,6 @@ #include "nsAppDirectoryServiceDefs.h" #include "nsXPIDLString.h" #include "nsReadableUtils.h" -#include "nsUnicharUtils.h" #include "nsMemory.h" #include "nsIStreamListener.h" #include "nsIMIMEService.h" @@ -416,12 +415,12 @@ nsresult nsExternalHelperAppService::FillContentHandlerProperties(const char * a // save to disk FillLiteralValueFromTarget(contentTypeHandlerNodeResource,kNC_SaveToDisk, &stringValue); NS_NAMED_LITERAL_STRING( trueString, "true" ); - if (stringValue && trueString.Equals(stringValue)) + if (trueString.Equals(stringValue)) aMIMEInfo->SetPreferredAction(nsIMIMEInfo::saveToDisk); // handle internal FillLiteralValueFromTarget(contentTypeHandlerNodeResource,kNC_HandleInternal, &stringValue); - if (stringValue && trueString.Equals(stringValue)) + if (trueString.Equals(stringValue)) aMIMEInfo->SetPreferredAction(nsIMIMEInfo::handleInternally); // always ask --> these fields aren't stored in the data source anymore @@ -497,8 +496,7 @@ nsresult nsExternalHelperAppService::GetMIMEInfoForMimeTypeFromDS(const char * a if (NS_SUCCEEDED(rv) && exists) { // create a mime info object and we'll fill it in based on the values from the data source - nsCOMPtr mimeInfo (do_CreateInstance(NS_MIMEINFO_CONTRACTID, &rv)); - NS_ENSURE_SUCCESS(rv, rv); + nsCOMPtr mimeInfo (do_CreateInstance(NS_MIMEINFO_CONTRACTID)); rv = FillTopLevelProperties(aContentType, contentTypeNodeResource, rdf, mimeInfo); NS_ENSURE_SUCCESS(rv, rv); rv = FillContentHandlerProperties(aContentType, contentTypeNodeResource, rdf, mimeInfo); @@ -514,59 +512,6 @@ nsresult nsExternalHelperAppService::GetMIMEInfoForMimeTypeFromDS(const char * a return rv; } -nsresult nsExternalHelperAppService::GetMIMEInfoForExtensionFromDS(const char * aFileExtension, nsIMIMEInfo ** aMIMEInfo) -{ - nsresult rv = NS_OK; - - rv = InitDataSource(); - if (NS_FAILED(rv)) return rv; - - // if we have a data source then use the information found in that - if (mOverRideDataSource) - { - // Get the RDF service. - nsCOMPtr rdf = do_GetService(kRDFServiceCID, &rv); - NS_ENSURE_SUCCESS(rv, rv); - - NS_ConvertUTF8toUCS2 extension(aFileExtension); - ToUpperCase(extension); - nsCOMPtr extensionLiteral; - rv = rdf->GetLiteral(extension.get(), getter_AddRefs( extensionLiteral)); - NS_ENSURE_SUCCESS(rv, rv); - - nsCOMPtr contentTypeNodeResource; - rv = mOverRideDataSource->GetSource(kNC_FileExtensions, - extensionLiteral, - PR_TRUE, - getter_AddRefs(contentTypeNodeResource)); - nsCAutoString contentTypeStr; - if (NS_SUCCEEDED(rv)) - { - const PRUnichar* contentType = nsnull; - rv = FillLiteralValueFromTarget(contentTypeNodeResource, kNC_Value, &contentType); - if (contentType) - contentTypeStr.AssignWithConversion(contentType); - } - if (NS_SUCCEEDED(rv)) - { - // create a mime info object and we'll fill it in based on the values from the data source - nsCOMPtr mimeInfo (do_CreateInstance(NS_MIMEINFO_CONTRACTID, &rv)); - NS_ENSURE_SUCCESS(rv, rv); - rv = FillTopLevelProperties(contentTypeStr.get(), contentTypeNodeResource, rdf, mimeInfo); - NS_ENSURE_SUCCESS(rv, rv); - rv = FillContentHandlerProperties(contentTypeStr.get(), contentTypeNodeResource, rdf, mimeInfo); - - *aMIMEInfo = mimeInfo; - NS_IF_ADDREF(*aMIMEInfo); - } // if we have a node in the graph for this extension - else - *aMIMEInfo = nsnull; - } // if we have a data source - else - rv = NS_ERROR_FAILURE; - return rv; -} - ////////////////////////////////////////////////////////////////////////////////////////////////////// // begin external protocol service default implementation... ////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -1419,15 +1364,6 @@ NS_IMETHODIMP nsExternalHelperAppService::GetFromExtension(const char *aFileExt, *_retval = (nsIMIMEInfo *) mMimeInfoCache->Get(&key); NS_IF_ADDREF(*_retval); - - // if we don't have a match in our hash table, then query the user provided - // data source - if (!*_retval) - rv = GetMIMEInfoForExtensionFromDS(aFileExt, _retval); - - // if we still don't have a match, then we give up, we don't know - // anything about it... return an error. - if (!*_retval) rv = NS_ERROR_FAILURE; return rv; } diff --git a/mozilla/uriloader/exthandler/nsExternalHelperAppService.h b/mozilla/uriloader/exthandler/nsExternalHelperAppService.h index 58acd6ee38e..465781bc541 100644 --- a/mozilla/uriloader/exthandler/nsExternalHelperAppService.h +++ b/mozilla/uriloader/exthandler/nsExternalHelperAppService.h @@ -76,11 +76,6 @@ public: // see if we have a mime info object representing this content type. The user over ride information is contained // in a in memory data source.... nsresult GetMIMEInfoForMimeTypeFromDS(const char * aContentType, nsIMIMEInfo ** aMIMEInfo); - - // GetMIMEInfoForExtensionFromDS --> Given an extension, look up the user override information to - // see if we have a mime info object representing this extension. The user over ride information is contained - // in a in memory data source.... - nsresult GetMIMEInfoForExtensionFromDS(const char * aFileExtension, nsIMIMEInfo ** aMIMEInfo); // GetFileTokenForPath must be implemented by each platform. // platformAppPath --> a platform specific path to an application that we got out of the