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

Unified Diff: content/browser/download/download_manager_impl.cc

Issue 9589003: Replace void* with int32 for passing download_id to SelectFileDialog::Listener. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix browser/unit tests Created 8 years, 10 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
Index: content/browser/download/download_manager_impl.cc
===================================================================
--- content/browser/download/download_manager_impl.cc (revision 124549)
+++ content/browser/download/download_manager_impl.cc (working copy)
@@ -360,10 +360,6 @@
// We must ask the user for the place to put the download.
WebContents* contents = download->GetWebContents();
- // |id_ptr| will be deleted in either FileSelected() or
- // FileSelectionCancelled().
- int32* id_ptr = new int32;
- *id_ptr = download_id;
FilePath target_path;
// If |download| is a potentially dangerous file, then |suggested_path|
// contains the intermediate name instead of the final download
@@ -375,7 +371,7 @@
target_path = suggested_path;
delegate_->ChooseDownloadPath(contents, target_path,
- reinterpret_cast<void*>(id_ptr));
+ download_id);
FOR_EACH_OBSERVER(Observer, observers_,
SelectFileDialogDisplayed(this, download_id));
} else {
@@ -862,14 +858,10 @@
observers_.RemoveObserver(observer);
}
-void DownloadManagerImpl::FileSelected(const FilePath& path, void* params) {
+void DownloadManagerImpl::FileSelected(const FilePath& path,
+ int32 download_id) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- int32* id_ptr = reinterpret_cast<int32*>(params);
- DCHECK(id_ptr != NULL);
- int32 download_id = *id_ptr;
- delete id_ptr;
-
DownloadItem* download = GetActiveDownloadItem(download_id);
if (!download)
return;
@@ -883,14 +875,10 @@
ContinueDownloadWithPath(download, path);
}
-void DownloadManagerImpl::FileSelectionCanceled(void* params) {
+void DownloadManagerImpl::FileSelectionCanceled(int32 download_id) {
// The user didn't pick a place to save the file, so need to cancel the
// download that's already in progress to the temporary location.
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- int32* id_ptr = reinterpret_cast<int32*>(params);
- DCHECK(id_ptr != NULL);
- int32 download_id = *id_ptr;
- delete id_ptr;
DownloadItem* download = GetActiveDownloadItem(download_id);
if (!download)
« no previous file with comments | « content/browser/download/download_manager_impl.h ('k') | content/browser/download/download_manager_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698