102477 - Turn on download manager, take 2. r=law sr=ben a=dbaron

This commit is contained in:
blakeross%telocity.com 2002-03-17 21:18:26 +00:00
Родитель f7e4a39bac
Коммит d03c035489
7 изменённых файлов: 98 добавлений и 40 удалений

Просмотреть файл

@ -9,3 +9,4 @@ nsIURILoader.idl
nsIDocumentLoader.idl
nsIWebProgress.idl
nsIWebProgressListener.idl
nsIDownload.idl

Просмотреть файл

@ -54,6 +54,7 @@ XPIDLSRCS = \
nsIURIContentListener.idl \
nsIURILoader.idl \
nsCURILoader.idl \
nsIDownload.idl \
nsIDocumentLoader.idl \
nsIWebProgress.idl \
nsIWebProgressListener.idl \

Просмотреть файл

@ -51,6 +51,7 @@ XPIDLSRCS= \
.\nsIDocumentLoader.idl \
.\nsIWebProgress.idl \
.\nsIWebProgressListener.idl \
.\nsIDownload.idl \
$(NULL)
LIBRARY_NAME=uriloaderbase_s

Просмотреть файл

@ -39,6 +39,7 @@
#include "nsCURILoader.h"
#include "nsIWebProgress.h"
#include "nsIWebProgressListener.h"
#include "nsIDownload.h"
#include "nsReadableUtils.h"
// 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
// 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 );
if (progressDlg)
nsCOMPtr<nsIDownload> dl = do_CreateInstance("@mozilla.org/download;1", &rv);
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.
progressDlg->SetSource( mSourceUrl );
progressDlg->SetStartTime( mTimeDownloadStarted );
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.
mMimeInfo->GetApplicationDescription(getter_Copies(openWith));
if (openWith.IsEmpty())
{
// Opening with an application; use either description or application file name.
nsXPIDLString openWith;
mMimeInfo->GetApplicationDescription(getter_Copies(openWith));
if (openWith.IsEmpty())
nsCOMPtr<nsIFile> appl;
mMimeInfo->GetPreferredApplicationHandler(getter_AddRefs(appl));
if (appl)
{
nsCOMPtr<nsIFile> appl;
mMimeInfo->GetPreferredApplicationHandler(getter_AddRefs(appl));
if (appl)
nsCOMPtr<nsILocalFile> file = do_QueryInterface(appl);
if (file)
{
nsCOMPtr<nsILocalFile> file = do_QueryInterface(appl);
if (file)
{
file->GetUnicodeLeafName(getter_Copies(openWith));
}
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;
}

Просмотреть файл

@ -790,6 +790,20 @@
<FILEKIND>Text</FILEKIND>
<FILEFLAGS></FILEFLAGS>
</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>
<LINKORDER>
<FILEREF>
@ -842,6 +856,16 @@
<PATH>nsIExternalProtocolService.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</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>
</TARGET>
<TARGET>
@ -1581,6 +1605,20 @@
<FILEKIND>Text</FILEKIND>
<FILEFLAGS></FILEFLAGS>
</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>
<LINKORDER>
<FILEREF>
@ -1633,6 +1671,16 @@
<PATH>nsIExternalProtocolService.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</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>
</TARGET>
</TARGETLIST>
@ -1703,6 +1751,18 @@
<PATH>nsIExternalProtocolService.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</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>
</PROJECT>

Просмотреть файл

@ -45,6 +45,10 @@ REQUIRES = xpcom \
dom \
pref \
docshell \
downloadmanager\
webbrowserpersist \
progressDlg \
uriloader \
webshell \
$(NULL)

Просмотреть файл

@ -739,7 +739,7 @@
</LINKORDER>
</TARGET>
<TARGET>
<NAME>download-manager.xpt</NAME>
<NAME>downloadmanager.xpt</NAME>
<SETTINGLIST>
<!-- Settings for "Source Trees" panel -->
@ -798,7 +798,7 @@
<SETTING><NAME>Linker</NAME><VALUE>xpt Linker</VALUE></SETTING>
<SETTING><NAME>PreLinker</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>Path</NAME><VALUE>:</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_importlib</NAME><VALUE></VALUE></SETTING>
<PANELDATA><NAME>xpidl Settings</NAME><VALUE>
00010003010114646F776E6C6F61642D6D616E616765722E7870740000000000
00010003010113646F776E6C6F61646D616E616765722E787074740000000000
0000000000000000
</VALUE></PANELDATA>
</SETTINGLIST>
@ -1427,7 +1427,7 @@
<TARGETORDER>
<ORDEREDTARGET><NAME>headers</NAME></ORDEREDTARGET>
<ORDEREDTARGET><NAME>download-manager.xpt</NAME></ORDEREDTARGET>
<ORDEREDTARGET><NAME>downloadmanager.xpt</NAME></ORDEREDTARGET>
</TARGETORDER>
<GROUPLIST>