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
This commit is contained in:
bzbarsky%mit.edu 2001-11-30 01:10:10 +00:00
parent 74891049b2
commit 065a782ee4
2 changed files with 3 additions and 72 deletions

View File

@ -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<nsIMIMEInfo> mimeInfo (do_CreateInstance(NS_MIMEINFO_CONTRACTID, &rv));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIMIMEInfo> 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<nsIRDFService> rdf = do_GetService(kRDFServiceCID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
NS_ConvertUTF8toUCS2 extension(aFileExtension);
ToUpperCase(extension);
nsCOMPtr<nsIRDFLiteral> extensionLiteral;
rv = rdf->GetLiteral(extension.get(), getter_AddRefs( extensionLiteral));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIRDFResource> 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<nsIMIMEInfo> 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;
}

View File

@ -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