зеркало из https://github.com/mozilla/gecko-dev.git
work for bug #38374
helperApps.rdf is now mimeTypes.rdf. use the file locator to get the mimeTypes file. fix the unix implementation of nsOSHelperAppService.cpp to go to the base class to determine what application to launch. r=mscott
This commit is contained in:
Родитель
3ebd82946c
Коммит
b4bc92c13e
|
@ -658,7 +658,7 @@ sub MakeResourceAliases()
|
|||
_copy(":mozilla:profile:defaults:bookmarks.html","$default_profile_dir"."bookmarks.html");
|
||||
_copy(":mozilla:profile:defaults:panels.rdf","$default_profile_dir"."panels.rdf");
|
||||
_copy(":mozilla:profile:defaults:search.rdf","$default_profile_dir"."search.rdf");
|
||||
_copy(":mozilla:profile:defaults:helperApps.rdf","$default_profile_dir"."helperApps.rdf");
|
||||
_copy(":mozilla:profile:defaults:mimeTypes.rdf","$default_profile_dir"."mimeTypes.rdf");
|
||||
|
||||
# make a dup in en-US
|
||||
my($default_profile_dir_en_US) = "$default_profile_dir"."en-US:";
|
||||
|
@ -667,7 +667,7 @@ sub MakeResourceAliases()
|
|||
_copy(":mozilla:profile:defaults:bookmarks.html","$default_profile_dir_en_US"."bookmarks.html");
|
||||
_copy(":mozilla:profile:defaults:panels.rdf","$default_profile_dir_en_US"."panels.rdf");
|
||||
_copy(":mozilla:profile:defaults:search.rdf","$default_profile_dir_en_US"."search.rdf");
|
||||
_copy(":mozilla:profile:defaults:helperApps.rdf","$default_profile_dir_en_US"."helperApps.rdf");
|
||||
_copy(":mozilla:profile:defaults:mimeTypes.rdf","$default_profile_dir_en_US"."mimeTypes.rdf");
|
||||
}
|
||||
|
||||
# Default _pref_ directory stuff
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
bookmarks.html
|
||||
panels.rdf
|
||||
search.rdf
|
||||
helperApps.rdf
|
||||
mimeTypes.rdf
|
||||
|
|
|
@ -31,7 +31,7 @@ FILES := \
|
|||
bookmarks.html \
|
||||
panels.rdf \
|
||||
search.rdf \
|
||||
helperApps.rdf \
|
||||
mimeTypes.rdf \
|
||||
$(NULL)
|
||||
|
||||
FILES := $(addprefix $(srcdir)/, $(FILES))
|
||||
|
|
|
@ -1,49 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:NC="http://home.netscape.com/NC-rdf#">
|
||||
|
||||
<Description about="urn:mimetypes">
|
||||
<NC:MIME-types>
|
||||
<Seq>
|
||||
<li resource="urn:mimetype:application/pdf"/>
|
||||
<li resource="urn:mimetype:text/html"/>
|
||||
</Seq>
|
||||
</NC:MIME-types>
|
||||
</Description>
|
||||
|
||||
<Description about="urn:mimetype:application/pdf">
|
||||
<NC:value>application/pdf</NC:value>
|
||||
<NC:description>Portable Document Format</NC:description>
|
||||
<NC:editable>true</NC:editable>
|
||||
<NC:fileExtensions>
|
||||
<NC:fileExtension>pdf</NC:fileExtension>
|
||||
<NC:fileExtension>foo</NC:fileExtension>
|
||||
</NC:fileExtensions>
|
||||
<NC:handler>
|
||||
<NC:saveToDisk>true</NC:saveToDisk>
|
||||
<NC:handleInternal>false</NC:handleInternal>
|
||||
<NC:externalApplication>
|
||||
<NC:prettyName>Adobe Acrobat</NC:prettyName>
|
||||
<NC:path>C:\Program Files\Adobe\acrobat.exe</NC:path>
|
||||
</NC:externalApplication>
|
||||
</NC:handler>
|
||||
</Description>
|
||||
|
||||
<Description about="urn:mimetype:text/html">
|
||||
<NC:value>text/html</NC:value>
|
||||
<NC:description>Hypertext Document</NC:description>
|
||||
<NC:editable>false</NC:editable>
|
||||
<NC:fileExtensions>
|
||||
<NC:fileExtension>htm</NC:fileExtension>
|
||||
<NC:fileExtension>html</NC:fileExtension>
|
||||
</NC:fileExtensions>
|
||||
<NC:handler>
|
||||
<NC:saveToDisk>false</NC:saveToDisk>
|
||||
<NC:handleInternal>true</NC:handleInternal>
|
||||
<NC:externalApplication>
|
||||
<NC:prettyName></NC:prettyName>
|
||||
<NC:path></NC:path>
|
||||
</NC:externalApplication>
|
||||
</NC:handler>
|
||||
</Description>
|
||||
</RDF>
|
|
@ -28,7 +28,7 @@ FILES=\
|
|||
bookmarks.html \
|
||||
panels.rdf \
|
||||
search.rdf \
|
||||
helperApps.rdf \
|
||||
mimeTypes.rdf \
|
||||
$(NULL)
|
||||
|
||||
install::
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:NC="http://home.netscape.com/NC-rdf#">
|
||||
|
||||
<Description about="urn:mimetypes">
|
||||
<NC:MIME-types>
|
||||
<Seq>
|
||||
<li resource="urn:mimetype:application/pdf"/>
|
||||
<li resource="urn:mimetype:text/html"/>
|
||||
</Seq>
|
||||
</NC:MIME-types>
|
||||
</Description>
|
||||
|
||||
<Description about="urn:mimetype:application/pdf">
|
||||
<NC:value>application/pdf</NC:value>
|
||||
<NC:description>Portable Document Format</NC:description>
|
||||
<NC:editable>true</NC:editable>
|
||||
<NC:fileExtensions about="urn:mimetype:extension:application/pdf:pdf">pdf</NC:fileExtensions>
|
||||
<NC:fileExtensions about="urn:mimetype:extension:application/pdf:foo">foo</NC:fileExtensions>
|
||||
<NC:handlerProp>
|
||||
<NC:handler about="urn:mimetype:handler:application/pdf">
|
||||
<NC:saveToDisk about="urn:mimetype:handler:saveToDisk:application/pdf">false</NC:saveToDisk>
|
||||
<NC:handleInternal>false</NC:handleInternal>
|
||||
<NC:alwaysAsk>false</NC:alwaysAsk>
|
||||
<NC:externalApplicationProp>
|
||||
<NC:externalApplication about="urn:mimetype:externalApplication:application/pdf">
|
||||
<NC:prettyName>Adobe Acrobat</NC:prettyName>
|
||||
<NC:path>/usr/bin/xpdf</NC:path>
|
||||
</NC:externalApplication>
|
||||
</NC:externalApplicationProp>
|
||||
</NC:handler>
|
||||
</NC:handlerProp>
|
||||
</Description>
|
||||
|
||||
<Description about="urn:mimetype:text/html">
|
||||
<NC:value>text/html</NC:value>
|
||||
<NC:description>Hypertext Document</NC:description>
|
||||
<NC:editable>false</NC:editable>
|
||||
<NC:fileExtensions about="urn:mimetype:extension:text/html:htm">htm</NC:fileExtensions>
|
||||
<NC:fileExtensions about="urn:mimetype:extension:text/html:html">html</NC:fileExtensions>
|
||||
<NC:handlerProp>
|
||||
<NC:handler about="urn:mimetype:handler:text/html">
|
||||
<NC:saveToDisk>false</NC:saveToDisk>
|
||||
<NC:handleInternal>true</NC:handleInternal>
|
||||
<NC:handleInternal>false</NC:handleInternal>
|
||||
<NC:externalApplicationProp>
|
||||
<NC:externalApplication>
|
||||
<NC:prettyName></NC:prettyName>
|
||||
<NC:path></NC:path>
|
||||
</NC:externalApplication>
|
||||
</NC:externalApplicationProp>
|
||||
</NC:handler>
|
||||
</NC:handlerProp>
|
||||
</Description>
|
||||
</RDF>
|
|
@ -77,7 +77,6 @@
|
|||
|
||||
// hack for copying panels.rdf into migrated profile dir
|
||||
#define PANELS_RDF_FILE "panels.rdf"
|
||||
#define HELPERAPPS_RDF_FILE "helperApps.rdf"
|
||||
|
||||
// A default profile name, in case automigration 4x profile fails
|
||||
#define DEFAULT_PROFILE_NAME "default"
|
||||
|
@ -1419,8 +1418,6 @@ nsProfile::MigrateProfile(const PRUnichar* profileName, PRBool showProgressAsMod
|
|||
// is complete, this will be removed.
|
||||
rv = CopyDefaultFile(profDefaultsDir, newProfDir, PANELS_RDF_FILE);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = CopyDefaultFile(profDefaultsDir, newProfDir, HELPERAPPS_RDF_FILE);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
// hack finish.
|
||||
|
||||
rv = SetProfileDir(profileName, newProfDir);
|
||||
|
|
|
@ -144,35 +144,19 @@ NS_IMETHODIMP nsOSHelperAppService::CanHandleContent(const char *aMimeContentTyp
|
|||
NS_IMETHODIMP nsOSHelperAppService::DoContent(const char *aMimeContentType, nsIURI *aURI, nsISupports *aWindowContext,
|
||||
PRBool *aAbortProcess, nsIStreamListener ** aStreamListener)
|
||||
{
|
||||
// look up the content type and get a platform specific handle to the app we want to use for this
|
||||
// download...create a nsExternalAppHandler, bind the application token to it (as a nsIFile??) and return this
|
||||
// as the stream listener to use...
|
||||
|
||||
// eventually when we start trying to hook up some UI we may need to insert code here to throw up a dialog
|
||||
// and ask the user if they wish to use this app to open this content type...
|
||||
|
||||
// now bind the handler to the application we want to launch when we the handler is done
|
||||
// receiving all the data...
|
||||
|
||||
|
||||
printf("fix this hardcoding\n");
|
||||
|
||||
nsCAutoString fileExtension;
|
||||
fileExtension = ".mp3";
|
||||
|
||||
// create an application that represents this app name...
|
||||
nsExternalApplication * application = nsnull;
|
||||
NS_NEWXPCOM(application, nsExternalApplication);
|
||||
|
||||
if (application)
|
||||
application->SetAppRegistryName("xmms");
|
||||
|
||||
nsCOMPtr<nsISupports> appSupports = do_QueryInterface(application);
|
||||
|
||||
// this code is incomplete and just here to get things started..
|
||||
nsExternalAppHandler * handler = CreateNewExternalHandler(appSupports, fileExtension);
|
||||
handler->QueryInterface(NS_GET_IID(nsIStreamListener), (void **) aStreamListener);
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// see if we have user specified information for handling this content type by giving the base class
|
||||
// first crack at it...
|
||||
|
||||
rv = nsExternalHelperAppService::DoContent(aMimeContentType, aURI, aWindowContext, aAbortProcess, aStreamListener);
|
||||
|
||||
// this is important!! if do content for the base class returned any success code, then assume we are done
|
||||
// and don't even play around with
|
||||
if (NS_SUCCEEDED(rv)) return NS_OK;
|
||||
|
||||
// there is no registry on linux (like there is on win32)
|
||||
*aStreamListener = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -150,6 +150,7 @@ class NS_APPSHELL nsSpecialFileSpec : public nsFileSpec
|
|||
, App_UsersPanels50 = App_FileBase + 90
|
||||
, App_SearchFile50 = App_FileBase + 100
|
||||
, App_SearchDirectory50 = App_FileBase + 101
|
||||
, App_UsersMimeTypes50 = App_FileBase + 102
|
||||
};
|
||||
//nsSpecialFileSpec();
|
||||
nsSpecialFileSpec(Type aType);
|
||||
|
|
|
@ -128,6 +128,7 @@ struct DirectoryTable DirectoryTable[] =
|
|||
{"app.local.store.file.5", nsSpecialFileSpec::App_LocalStore50 },
|
||||
{"app.history.file.5", nsSpecialFileSpec::App_History50 },
|
||||
{"app.user.panels.5", nsSpecialFileSpec::App_UsersPanels50 },
|
||||
{"app.user.mimeTypes.5", nsSpecialFileSpec::App_UsersMimeTypes50},
|
||||
|
||||
// MailNews:
|
||||
|
||||
|
@ -643,6 +644,32 @@ void nsSpecialFileSpec::operator = (Type aType)
|
|||
break;
|
||||
}
|
||||
break;
|
||||
case App_UsersMimeTypes50:
|
||||
{
|
||||
*this = nsSpecialFileSpec(App_UserProfileDirectory50);
|
||||
*this += "mimeTypes.rdf";
|
||||
|
||||
if (!(this->Exists())) {
|
||||
// find the default mimeTypes.rdf file
|
||||
// something like bin/defaults/profile/mimeTypes.rdf
|
||||
nsFileSpec defaultMimeTypesFile;
|
||||
GetProfileDefaultsFolder(defaultMimeTypesFile);
|
||||
defaultMimeTypesFile += "mimeTypes.rdf";
|
||||
|
||||
// get the users profile directory
|
||||
*this = nsSpecialFileSpec(App_UserProfileDirectory50);
|
||||
|
||||
// copy the default mimeTypes.rdf to <profile>/mimeTypes.rdf
|
||||
nsresult rv = defaultMimeTypesFile.CopyToDir(*this);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to copy mimeTypes.rdf");
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// set this to <profile>/mimeTypes.rdf
|
||||
*this += "mimeTypes.rdf";
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case App_UsersPanels50:
|
||||
{
|
||||
*this = nsSpecialFileSpec(App_UserProfileDirectory50);
|
||||
|
|
Загрузка…
Ссылка в новой задаче