Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1476)

Unified Diff: chrome/browser/download/download_manager.cc

Issue 7112011: Change DownloadProcessHandle to be more of an encapsulated class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged to LKGR. Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/download/download_manager.h ('k') | chrome/browser/download/download_process_handle.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/download/download_manager.cc
diff --git a/chrome/browser/download/download_manager.cc b/chrome/browser/download/download_manager.cc
index 58090f2d492e18f00c5dc16dca08589f9e43e6e1..7475915ffe9742c6ad31f3678f4973417a787350 100644
--- a/chrome/browser/download/download_manager.cc
+++ b/chrome/browser/download/download_manager.cc
@@ -23,7 +23,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_request_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"
@@ -472,8 +472,8 @@ void DownloadManager::OnPathExistenceAvailable(int32 download_id,
if (!select_file_dialog_.get())
select_file_dialog_ = SelectFileDialog::Create(this);
- DownloadProcessHandle process_handle = download->process_handle();
- TabContents* contents = process_handle.GetTabContents();
+ DownloadRequestHandle request_handle = download->request_handle();
+ TabContents* contents = request_handle.GetTabContents();
SelectFileDialog::FileTypeInfo file_type_info;
FilePath::StringType extension = suggested_path.Extension();
if (!extension.empty()) {
@@ -749,15 +749,13 @@ void DownloadManager::DownloadCancelled(int32 download_id) {
download_history_->UpdateEntry(download);
}
- DownloadCancelledInternal(download_id, download->process_handle());
+ DownloadCancelledInternal(download_id, download->request_handle());
}
void DownloadManager::DownloadCancelledInternal(
- int download_id, DownloadProcessHandle process_handle) {
+ int download_id, DownloadRequestHandle request_handle) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- // Cancel the network request. RDH is guaranteed to outlive the IO thread.
- download_util::CancelDownloadRequest(
- g_browser_process->resource_dispatcher_host(), process_handle);
+ request_handle.CancelRequest();
BrowserThread::PostTask(
BrowserThread::FILE, FROM_HERE,
@@ -801,38 +799,11 @@ void DownloadManager::OnDownloadError(int32 download_id,
file_manager_, &DownloadFileManager::CancelDownload, download_id));
}
-void DownloadManager::PauseDownload(int32 download_id, bool pause) {
- DownloadMap::iterator it = in_progress_.find(download_id);
- if (it == in_progress_.end())
- return;
-
- DownloadItem* download = it->second;
- if (pause == download->is_paused())
- return;
-
- BrowserThread::PostTask(
- BrowserThread::IO, FROM_HERE,
- NewRunnableMethod(this,
- &DownloadManager::PauseDownloadRequest,
- g_browser_process->resource_dispatcher_host(),
- download->process_handle(),
- pause));
-}
-
void DownloadManager::UpdateAppIcon() {
if (status_updater_)
status_updater_->Update();
}
-void DownloadManager::PauseDownloadRequest(ResourceDispatcherHost* rdh,
- DownloadProcessHandle process_handle,
- bool pause) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- rdh->PauseRequest(process_handle.child_id(),
- process_handle.request_id(),
- pause);
-}
-
void DownloadManager::RemoveDownload(int64 download_handle) {
DownloadMap::iterator it = history_downloads_.find(download_handle);
if (it == history_downloads_.end())
@@ -1047,7 +1018,7 @@ void DownloadManager::FileSelectionCanceled(void* params) {
VLOG(20) << __FUNCTION__ << "()"
<< " download = " << download->DebugString(true);
- DownloadCancelledInternal(download_id, download->process_handle());
+ DownloadCancelledInternal(download_id, download->request_handle());
}
// TODO(phajdan.jr): This is apparently not being exercised in tests.
@@ -1162,8 +1133,8 @@ void DownloadManager::ShowDownloadInBrowser(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.
- DownloadProcessHandle process_handle = download->process_handle();
- TabContents* contents = process_handle.GetTabContents();
+ DownloadRequestHandle request_handle = download->request_handle();
+ TabContents* contents = request_handle.GetTabContents();
TabContentsWrapper* wrapper = NULL;
if (contents)
wrapper = TabContentsWrapper::GetCurrentWrapperForContents(contents);
« no previous file with comments | « chrome/browser/download/download_manager.h ('k') | chrome/browser/download/download_process_handle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698