зеркало из https://github.com/mozilla/gecko-dev.git
102477 - Turn on download manager, take 2. r=law sr=ben a=dbaron
This commit is contained in:
Родитель
f7e4a39bac
Коммит
d03c035489
|
@ -9,3 +9,4 @@ nsIURILoader.idl
|
||||||
nsIDocumentLoader.idl
|
nsIDocumentLoader.idl
|
||||||
nsIWebProgress.idl
|
nsIWebProgress.idl
|
||||||
nsIWebProgressListener.idl
|
nsIWebProgressListener.idl
|
||||||
|
nsIDownload.idl
|
||||||
|
|
|
@ -54,6 +54,7 @@ XPIDLSRCS = \
|
||||||
nsIURIContentListener.idl \
|
nsIURIContentListener.idl \
|
||||||
nsIURILoader.idl \
|
nsIURILoader.idl \
|
||||||
nsCURILoader.idl \
|
nsCURILoader.idl \
|
||||||
|
nsIDownload.idl \
|
||||||
nsIDocumentLoader.idl \
|
nsIDocumentLoader.idl \
|
||||||
nsIWebProgress.idl \
|
nsIWebProgress.idl \
|
||||||
nsIWebProgressListener.idl \
|
nsIWebProgressListener.idl \
|
||||||
|
|
|
@ -51,6 +51,7 @@ XPIDLSRCS= \
|
||||||
.\nsIDocumentLoader.idl \
|
.\nsIDocumentLoader.idl \
|
||||||
.\nsIWebProgress.idl \
|
.\nsIWebProgress.idl \
|
||||||
.\nsIWebProgressListener.idl \
|
.\nsIWebProgressListener.idl \
|
||||||
|
.\nsIDownload.idl \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
LIBRARY_NAME=uriloaderbase_s
|
LIBRARY_NAME=uriloaderbase_s
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
#include "nsCURILoader.h"
|
#include "nsCURILoader.h"
|
||||||
#include "nsIWebProgress.h"
|
#include "nsIWebProgress.h"
|
||||||
#include "nsIWebProgressListener.h"
|
#include "nsIWebProgressListener.h"
|
||||||
|
#include "nsIDownload.h"
|
||||||
#include "nsReadableUtils.h"
|
#include "nsReadableUtils.h"
|
||||||
|
|
||||||
// used to manage our in memory data source of helper applications
|
// used to manage our in memory data source of helper applications
|
||||||
|
@ -1384,52 +1385,42 @@ nsresult nsExternalAppHandler::ShowProgressDialog()
|
||||||
{
|
{
|
||||||
// we are back from the helper app dialog (where the user chooses to save or open), but we aren't
|
// we are back from the helper app dialog (where the user chooses to save or open), but we aren't
|
||||||
// done processing the load. in this case, throw up a progress dialog so the user can see what's going on...
|
// done processing the load. in this case, throw up a progress dialog so the user can see what's going on...
|
||||||
nsresult rv = NS_OK;
|
nsresult rv;
|
||||||
|
nsCOMPtr<nsILocalFile> local = do_QueryInterface(mFinalFileDestination);
|
||||||
|
|
||||||
nsCOMPtr<nsIProgressDialog> progressDlg = do_CreateInstance( "@mozilla.org/progressdialog;1", &rv );
|
nsCOMPtr<nsIDownload> dl = do_CreateInstance("@mozilla.org/download;1", &rv);
|
||||||
if (progressDlg)
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
|
nsXPIDLString openWith(NS_LITERAL_STRING(""));
|
||||||
|
nsMIMEInfoHandleAction action = nsIMIMEInfo::saveToDisk;
|
||||||
|
mMimeInfo->GetPreferredAction(&action);
|
||||||
|
if (action != nsIMIMEInfo::saveToDisk)
|
||||||
{
|
{
|
||||||
// Wire up this progress dialog.
|
// Opening with an application; use either description or application file name.
|
||||||
progressDlg->SetSource( mSourceUrl );
|
mMimeInfo->GetApplicationDescription(getter_Copies(openWith));
|
||||||
progressDlg->SetStartTime( mTimeDownloadStarted );
|
if (openWith.IsEmpty())
|
||||||
progressDlg->SetObserver(this);
|
|
||||||
nsCOMPtr<nsILocalFile> local = do_QueryInterface(mFinalFileDestination);
|
|
||||||
progressDlg->SetTarget(local);
|
|
||||||
|
|
||||||
nsMIMEInfoHandleAction action = nsIMIMEInfo::saveToDisk;
|
|
||||||
mMimeInfo->GetPreferredAction(&action);
|
|
||||||
if (action != nsIMIMEInfo::saveToDisk)
|
|
||||||
{
|
{
|
||||||
// Opening with an application; use either description or application file name.
|
nsCOMPtr<nsIFile> appl;
|
||||||
nsXPIDLString openWith;
|
mMimeInfo->GetPreferredApplicationHandler(getter_AddRefs(appl));
|
||||||
mMimeInfo->GetApplicationDescription(getter_Copies(openWith));
|
if (appl)
|
||||||
if (openWith.IsEmpty())
|
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIFile> appl;
|
nsCOMPtr<nsILocalFile> file = do_QueryInterface(appl);
|
||||||
mMimeInfo->GetPreferredApplicationHandler(getter_AddRefs(appl));
|
if (file)
|
||||||
if (appl)
|
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsILocalFile> file = do_QueryInterface(appl);
|
file->GetUnicodeLeafName(getter_Copies(openWith));
|
||||||
if (file)
|
|
||||||
{
|
|
||||||
file->GetUnicodeLeafName(getter_Copies(openWith));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Tell progress dialog what we're opening with.
|
|
||||||
progressDlg->SetOpeningWith(openWith);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Open the dialog.
|
|
||||||
rv = progressDlg->Open(nsnull, nsnull);
|
|
||||||
|
|
||||||
if(NS_SUCCEEDED(rv))
|
|
||||||
{
|
|
||||||
// Send notifications to the dialog.
|
|
||||||
this->SetWebProgressListener(progressDlg);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rv = dl->Init(mSourceUrl, local, nsnull, openWith, mTimeDownloadStarted, nsnull);
|
||||||
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
|
dl->SetObserver(this);
|
||||||
|
nsCOMPtr<nsIWebProgressListener> listener = do_QueryInterface(dl);
|
||||||
|
if (listener)
|
||||||
|
SetWebProgressListener(listener);
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -790,6 +790,20 @@
|
||||||
<FILEKIND>Text</FILEKIND>
|
<FILEKIND>Text</FILEKIND>
|
||||||
<FILEFLAGS></FILEFLAGS>
|
<FILEFLAGS></FILEFLAGS>
|
||||||
</FILE>
|
</FILE>
|
||||||
|
<FILE>
|
||||||
|
<PATHTYPE>Name</PATHTYPE>
|
||||||
|
<PATH>nsIDownload.idl</PATH>
|
||||||
|
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||||
|
<FILEKIND>Text</FILEKIND>
|
||||||
|
<FILEFLAGS></FILEFLAGS>
|
||||||
|
</FILE>
|
||||||
|
<FILE>
|
||||||
|
<PATHTYPE>Name</PATHTYPE>
|
||||||
|
<PATH>nsIDownload.idl</PATH>
|
||||||
|
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||||
|
<FILEKIND>Text</FILEKIND>
|
||||||
|
<FILEFLAGS></FILEFLAGS>
|
||||||
|
</FILE>
|
||||||
</FILELIST>
|
</FILELIST>
|
||||||
<LINKORDER>
|
<LINKORDER>
|
||||||
<FILEREF>
|
<FILEREF>
|
||||||
|
@ -842,6 +856,16 @@
|
||||||
<PATH>nsIExternalProtocolService.idl</PATH>
|
<PATH>nsIExternalProtocolService.idl</PATH>
|
||||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||||
</FILEREF>
|
</FILEREF>
|
||||||
|
<FILEREF>
|
||||||
|
<PATHTYPE>Name</PATHTYPE>
|
||||||
|
<PATH>nsIDownload.idl</PATH>
|
||||||
|
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||||
|
</FILEREF>
|
||||||
|
<FILEREF>
|
||||||
|
<PATHTYPE>Name</PATHTYPE>
|
||||||
|
<PATH>nsIDownload.idl</PATH>
|
||||||
|
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||||
|
</FILEREF>
|
||||||
</LINKORDER>
|
</LINKORDER>
|
||||||
</TARGET>
|
</TARGET>
|
||||||
<TARGET>
|
<TARGET>
|
||||||
|
@ -1581,6 +1605,20 @@
|
||||||
<FILEKIND>Text</FILEKIND>
|
<FILEKIND>Text</FILEKIND>
|
||||||
<FILEFLAGS></FILEFLAGS>
|
<FILEFLAGS></FILEFLAGS>
|
||||||
</FILE>
|
</FILE>
|
||||||
|
<FILE>
|
||||||
|
<PATHTYPE>Name</PATHTYPE>
|
||||||
|
<PATH>nsIDownload.idl</PATH>
|
||||||
|
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||||
|
<FILEKIND>Text</FILEKIND>
|
||||||
|
<FILEFLAGS></FILEFLAGS>
|
||||||
|
</FILE>
|
||||||
|
<FILE>
|
||||||
|
<PATHTYPE>Name</PATHTYPE>
|
||||||
|
<PATH>nsIDownload.idl</PATH>
|
||||||
|
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||||
|
<FILEKIND>Text</FILEKIND>
|
||||||
|
<FILEFLAGS></FILEFLAGS>
|
||||||
|
</FILE>
|
||||||
</FILELIST>
|
</FILELIST>
|
||||||
<LINKORDER>
|
<LINKORDER>
|
||||||
<FILEREF>
|
<FILEREF>
|
||||||
|
@ -1633,6 +1671,16 @@
|
||||||
<PATH>nsIExternalProtocolService.idl</PATH>
|
<PATH>nsIExternalProtocolService.idl</PATH>
|
||||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||||
</FILEREF>
|
</FILEREF>
|
||||||
|
<FILEREF>
|
||||||
|
<PATHTYPE>Name</PATHTYPE>
|
||||||
|
<PATH>nsIDownload.idl</PATH>
|
||||||
|
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||||
|
</FILEREF>
|
||||||
|
<FILEREF>
|
||||||
|
<PATHTYPE>Name</PATHTYPE>
|
||||||
|
<PATH>nsIDownload.idl</PATH>
|
||||||
|
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||||
|
</FILEREF>
|
||||||
</LINKORDER>
|
</LINKORDER>
|
||||||
</TARGET>
|
</TARGET>
|
||||||
</TARGETLIST>
|
</TARGETLIST>
|
||||||
|
@ -1703,6 +1751,18 @@
|
||||||
<PATH>nsIExternalProtocolService.idl</PATH>
|
<PATH>nsIExternalProtocolService.idl</PATH>
|
||||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||||
</FILEREF>
|
</FILEREF>
|
||||||
|
<FILEREF>
|
||||||
|
<TARGETNAME>headers</TARGETNAME>
|
||||||
|
<PATHTYPE>Name</PATHTYPE>
|
||||||
|
<PATH>nsIDownload.idl</PATH>
|
||||||
|
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||||
|
</FILEREF>
|
||||||
|
<FILEREF>
|
||||||
|
<TARGETNAME>headers</TARGETNAME>
|
||||||
|
<PATHTYPE>Name</PATHTYPE>
|
||||||
|
<PATH>nsIDownload.idl</PATH>
|
||||||
|
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||||
|
</FILEREF>
|
||||||
</GROUPLIST>
|
</GROUPLIST>
|
||||||
|
|
||||||
</PROJECT>
|
</PROJECT>
|
||||||
|
|
|
@ -45,6 +45,10 @@ REQUIRES = xpcom \
|
||||||
dom \
|
dom \
|
||||||
pref \
|
pref \
|
||||||
docshell \
|
docshell \
|
||||||
|
downloadmanager\
|
||||||
|
webbrowserpersist \
|
||||||
|
progressDlg \
|
||||||
|
uriloader \
|
||||||
webshell \
|
webshell \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
|
|
|
@ -739,7 +739,7 @@
|
||||||
</LINKORDER>
|
</LINKORDER>
|
||||||
</TARGET>
|
</TARGET>
|
||||||
<TARGET>
|
<TARGET>
|
||||||
<NAME>download-manager.xpt</NAME>
|
<NAME>downloadmanager.xpt</NAME>
|
||||||
<SETTINGLIST>
|
<SETTINGLIST>
|
||||||
|
|
||||||
<!-- Settings for "Source Trees" panel -->
|
<!-- Settings for "Source Trees" panel -->
|
||||||
|
@ -798,7 +798,7 @@
|
||||||
<SETTING><NAME>Linker</NAME><VALUE>xpt Linker</VALUE></SETTING>
|
<SETTING><NAME>Linker</NAME><VALUE>xpt Linker</VALUE></SETTING>
|
||||||
<SETTING><NAME>PreLinker</NAME><VALUE></VALUE></SETTING>
|
<SETTING><NAME>PreLinker</NAME><VALUE></VALUE></SETTING>
|
||||||
<SETTING><NAME>PostLinker</NAME><VALUE></VALUE></SETTING>
|
<SETTING><NAME>PostLinker</NAME><VALUE></VALUE></SETTING>
|
||||||
<SETTING><NAME>Targetname</NAME><VALUE>download-manager.xpt</VALUE></SETTING>
|
<SETTING><NAME>Targetname</NAME><VALUE>downloadmanager.xpt</VALUE></SETTING>
|
||||||
<SETTING><NAME>OutputDirectory</NAME>
|
<SETTING><NAME>OutputDirectory</NAME>
|
||||||
<SETTING><NAME>Path</NAME><VALUE>:</VALUE></SETTING>
|
<SETTING><NAME>Path</NAME><VALUE>:</VALUE></SETTING>
|
||||||
<SETTING><NAME>PathFormat</NAME><VALUE>MacOS</VALUE></SETTING>
|
<SETTING><NAME>PathFormat</NAME><VALUE>MacOS</VALUE></SETTING>
|
||||||
|
@ -1390,7 +1390,7 @@
|
||||||
<SETTING><NAME>MWProject_X86_minsize</NAME><VALUE>4</VALUE></SETTING>
|
<SETTING><NAME>MWProject_X86_minsize</NAME><VALUE>4</VALUE></SETTING>
|
||||||
<SETTING><NAME>MWProject_X86_importlib</NAME><VALUE></VALUE></SETTING>
|
<SETTING><NAME>MWProject_X86_importlib</NAME><VALUE></VALUE></SETTING>
|
||||||
<PANELDATA><NAME>xpidl Settings</NAME><VALUE>
|
<PANELDATA><NAME>xpidl Settings</NAME><VALUE>
|
||||||
00010003010114646F776E6C6F61642D6D616E616765722E7870740000000000
|
00010003010113646F776E6C6F61646D616E616765722E787074740000000000
|
||||||
0000000000000000
|
0000000000000000
|
||||||
</VALUE></PANELDATA>
|
</VALUE></PANELDATA>
|
||||||
</SETTINGLIST>
|
</SETTINGLIST>
|
||||||
|
@ -1427,7 +1427,7 @@
|
||||||
|
|
||||||
<TARGETORDER>
|
<TARGETORDER>
|
||||||
<ORDEREDTARGET><NAME>headers</NAME></ORDEREDTARGET>
|
<ORDEREDTARGET><NAME>headers</NAME></ORDEREDTARGET>
|
||||||
<ORDEREDTARGET><NAME>download-manager.xpt</NAME></ORDEREDTARGET>
|
<ORDEREDTARGET><NAME>downloadmanager.xpt</NAME></ORDEREDTARGET>
|
||||||
</TARGETORDER>
|
</TARGETORDER>
|
||||||
|
|
||||||
<GROUPLIST>
|
<GROUPLIST>
|
||||||
|
|
Загрузка…
Ссылка в новой задаче