Index: content/browser/download/download_item_impl.cc |
diff --git a/content/browser/download/download_item_impl.cc b/content/browser/download/download_item_impl.cc |
index dea260257a420705d4c9cc834d38f7f1a1c33ff0..354cf02100a0243e35245e24217035861327c4d9 100644 |
--- a/content/browser/download/download_item_impl.cc |
+++ b/content/browser/download/download_item_impl.cc |
@@ -616,7 +616,7 @@ bool DownloadItemImpl::GetFileExternallyRemoved() const { |
return file_externally_removed_; |
} |
-void DownloadItemImpl::DeleteFile() { |
+void DownloadItemImpl::DeleteFile(const base::Callback<void(bool)>& callback) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
if ((GetState() != DownloadItem::COMPLETE) || |
asanka
2014/01/16 16:05:51
Can you also check whether current_path_ is empty
benjhayden
2014/01/16 17:09:18
Done.
|
file_externally_removed_) { |
@@ -625,11 +625,21 @@ void DownloadItemImpl::DeleteFile() { |
BrowserThread::PostTaskAndReplyWithResult( |
BrowserThread::FILE, FROM_HERE, |
base::Bind(&DeleteDownloadedFile, current_path_), |
- base::Bind(&DownloadItemImpl::OnDownloadedFileRemoved, |
- weak_ptr_factory_.GetWeakPtr())); |
+ base::Bind(&DownloadItemImpl::DeleteFileDone, |
+ weak_ptr_factory_.GetWeakPtr(), |
+ callback)); |
current_path_.clear(); |
} |
+void DownloadItemImpl::DeleteFileDone( |
+ const base::Callback<void(bool)>& callback, |
+ bool success) { |
+ if (success) { |
asanka
2014/01/16 16:05:51
Nit: no braces
benjhayden
2014/01/16 17:09:18
Done.
|
+ OnDownloadedFileRemoved(); |
+ } |
+ callback.Run(success); |
+} |
+ |
bool DownloadItemImpl::IsDangerous() const { |
#if defined(OS_WIN) |
// TODO(noelutz): At this point only the windows views UI supports |
@@ -947,9 +957,7 @@ void DownloadItemImpl::NotifyRemoved() { |
FOR_EACH_OBSERVER(Observer, observers_, OnDownloadRemoved(this)); |
} |
-void DownloadItemImpl::OnDownloadedFileRemoved(bool success) { |
- if (!success) |
- return; |
+void DownloadItemImpl::OnDownloadedFileRemoved() { |
file_externally_removed_ = true; |
VLOG(20) << __FUNCTION__ << " download=" << DebugString(true); |
UpdateObservers(); |