Index: chrome/browser/download/download_manager.cc |
diff --git a/chrome/browser/download/download_manager.cc b/chrome/browser/download/download_manager.cc |
index f7e05f7d20dd12d9141808959a504543c157f7a7..f7de9375d4ad278d7ee4f7a205f94fdd9c2db87b 100644 |
--- a/chrome/browser/download/download_manager.cc |
+++ b/chrome/browser/download/download_manager.cc |
@@ -21,6 +21,7 @@ |
#include "chrome/browser/download/download_history.h" |
#include "chrome/browser/download/download_item.h" |
#include "chrome/browser/download/download_prefs.h" |
+#include "chrome/browser/download/download_process_handle.h" |
#include "chrome/browser/download/download_safe_browsing_client.h" |
#include "chrome/browser/download/download_status_updater.h" |
#include "chrome/browser/download/download_util.h" |
@@ -432,8 +433,7 @@ void DownloadManager::OnPathExistenceAvailable(DownloadCreateInfo* info) { |
if (!select_file_dialog_.get()) |
select_file_dialog_ = SelectFileDialog::Create(this); |
- TabContents* contents = tab_util::GetTabContentsByID(info->child_id, |
- info->render_view_id); |
+ TabContents* contents = info->process_handle.GetTabContents(); |
SelectFileDialog::FileTypeInfo file_type_info; |
FilePath::StringType extension = info->suggested_path.Extension(); |
if (!extension.empty()) { |
@@ -713,12 +713,9 @@ void DownloadManager::DownloadCancelledInternal(int download_id, |
int request_id) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
// Cancel the network request. RDH is guaranteed to outlive the IO thread. |
- BrowserThread::PostTask( |
- BrowserThread::IO, FROM_HERE, |
- NewRunnableFunction(&download_util::CancelDownloadRequest, |
- g_browser_process->resource_dispatcher_host(), |
- render_process_id, |
- request_id)); |
+ DownloadProcessHandle process_handle(-1, render_process_id, request_id); |
+ process_handle.CancelDownload( |
+ g_browser_process->resource_dispatcher_host()); |
BrowserThread::PostTask( |
BrowserThread::FILE, FROM_HERE, |
@@ -983,8 +980,8 @@ void DownloadManager::FileSelectionCanceled(void* params) { |
// download that's already in progress to the temporary location. |
DownloadCreateInfo* info = reinterpret_cast<DownloadCreateInfo*>(params); |
DownloadCancelledInternal(info->download_id, |
- info->child_id, |
- info->request_id); |
+ info->process_handle.child_id(), |
Paweł Hajdan Jr.
2011/05/05 20:13:51
nit: Please convert DownloadCancelledInternal to t
ahendrickson
2011/05/06 16:16:50
Converted to use DownloadProcessHandle process_han
|
+ info->process_handle.child_id()); |
} |
void DownloadManager::DangerousDownloadValidated(DownloadItem* download) { |
@@ -1044,7 +1041,7 @@ void DownloadManager::OnCreateDownloadEntryComplete( |
// Show in the appropriate browser UI. |
// This includes buttons to save or cancel, for a dangerous download. |
- ShowDownloadInBrowser(info, download); |
+ ShowDownloadInBrowser(info.process_handle, download); |
// Inform interested objects about the new download. |
NotifyModelChanged(); |
@@ -1068,13 +1065,12 @@ void DownloadManager::OnCreateDownloadEntryComplete( |
} |
} |
-void DownloadManager::ShowDownloadInBrowser(const DownloadCreateInfo& info, |
- DownloadItem* download) { |
+void DownloadManager::ShowDownloadInBrowser( |
+ DownloadProcessHandle process_handle, DownloadItem* download) { |
// The 'contents' may no longer exist if the user closed the tab before we |
// get this start completion event. If it does, tell the origin TabContents |
// to display its download shelf. |
- TabContents* contents = tab_util::GetTabContentsByID(info.child_id, |
- info.render_view_id); |
+ TabContents* contents = process_handle.GetTabContents(); |
// If the contents no longer exists, we start the download in the last active |
// browser. This is not ideal but better than fully hiding the download from |