Replace void* with int32 for passing download_id to SelectFileDialog::Listener.
BUG=NONE
TEST=trybot runs.
Review URL: http://codereview.chromium.org/9589003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@124851 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/content/browser/download/download_manager_impl.cc b/content/browser/download/download_manager_impl.cc
index 028cb01..b1730f1 100644
--- a/content/browser/download/download_manager_impl.cc
+++ b/content/browser/download/download_manager_impl.cc
@@ -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)