From c5191e5271381602b62b2ac1b22fd2bc4948f72d Mon Sep 17 00:00:00 2001 From: "blakeross%telocity.com" Date: Sat, 23 Feb 2002 02:34:27 +0000 Subject: [PATCH] Download manager. Not part of build. --- .../src/nsDownloadManager.cpp | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/xpfe/components/download-manager/src/nsDownloadManager.cpp b/xpfe/components/download-manager/src/nsDownloadManager.cpp index 875885f4381f..5a70e1ae4bf6 100644 --- a/xpfe/components/download-manager/src/nsDownloadManager.cpp +++ b/xpfe/components/download-manager/src/nsDownloadManager.cpp @@ -51,6 +51,7 @@ #include "nsIWebBrowserPersist.h" #include "nsIObserver.h" #include "nsIProgressDialog.h" +#include "nsIWindowWatcher.h" /* Outstanding issues/todo: * 1. Using the target path as an identifier is not sufficient because it's not unique on mac. @@ -260,9 +261,8 @@ nsDownloadManager::AssertProgressInfo() res = do_QueryInterface(supports); res->GetValue(&id); nsCStringKey key(id); - if (mCurrDownloadItems->Exists(&key)) { + if (mCurrDownloadItems->Exists(&key)) { // if not, must be a finished download; don't need to update info nsIDownloadItem* item = NS_STATIC_CAST(nsIDownloadItem*, mCurrDownloadItems->Get(&key)); - if (!item) continue; // must be a finished download; don't need to update info // update percentage item->GetPercentComplete(&percentComplete); @@ -296,7 +296,6 @@ nsDownloadManager::AddDownload(nsIDownloadItem* aDownloadItem) if (NS_FAILED(rv)) return rv; DownloadItem* item = NS_STATIC_CAST(DownloadItem*, aDownloadItem); - if (!item) return NS_ERROR_FAILURE; item->SetDownloadManager(this); @@ -459,12 +458,17 @@ nsDownloadManager::Open(nsIDOMWindow* aParent) // if we ever have the capability to display the UI of third party dl managers, // we'll open their UI here instead. + nsresult rv; + nsCOMPtr ww = do_GetService("@mozilla.org/embedcomp/window-watcher;1", &rv); + if (NS_FAILED(rv)) return rv; + nsCOMPtr newWindow; - nsCOMPtr internalWin = do_QueryInterface(aParent); - nsresult rv = internalWin->OpenDialog(NS_LITERAL_STRING(DOWNLOAD_MANAGER_URL), - NS_LITERAL_STRING("_blank"), - NS_LITERAL_STRING("chrome,titlebar,dependent,centerscreen"), - nsnull, getter_AddRefs(newWindow)); + rv = ww->OpenWindow(aParent, + DOWNLOAD_MANAGER_URL, + "_blank", + "chrome,titlebar,dependent,centerscreen", + nsnull, + getter_AddRefs(newWindow)); if (NS_FAILED(rv)) return rv;