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

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

Issue 10689093: Move Rename functionality from DownloadFileManager to DownloadFileImple. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Upload fater merging past revert to figure out if I still have a patch. Created 8 years, 5 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_file_manager.cc
diff --git a/content/browser/download/download_file_manager.cc b/content/browser/download/download_file_manager.cc
index 4fc4a86f991362d07e631f7e03a77434912e5dbe..7bebd92ef3970f5544759752c5048d4642fe2bef 100644
--- a/content/browser/download/download_file_manager.cc
+++ b/content/browser/download/download_file_manager.cc
@@ -195,42 +195,14 @@ void DownloadFileManager::RenameDownloadFile(
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
DownloadFile* download_file = GetDownloadFile(global_id);
if (!download_file) {
- BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
- base::Bind(callback, FilePath()));
- return;
- }
-
- FilePath new_path(full_path);
- if (!overwrite_existing_file) {
- // Make the file unique if requested.
- int uniquifier =
- file_util::GetUniquePathNumber(new_path, FILE_PATH_LITERAL(""));
- if (uniquifier > 0) {
- new_path = new_path.InsertBeforeExtensionASCII(
- StringPrintf(" (%d)", uniquifier));
- }
- }
-
- // Do the actual rename
- content::DownloadInterruptReason rename_error =
- download_file->Rename(new_path);
- if (content::DOWNLOAD_INTERRUPT_REASON_NONE != rename_error) {
- DownloadManager* download_manager = download_file->GetDownloadManager();
- DCHECK(download_manager);
-
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
- base::Bind(&DownloadManager::OnDownloadInterrupted,
- download_manager,
- global_id.local(),
- download_file->BytesSoFar(),
- download_file->GetHashState(),
- rename_error));
-
- new_path.clear();
+ base::Bind(callback, content::DOWNLOAD_INTERRUPT_REASON_FILE_FAILED,
+ FilePath()));
+ return;
}
- BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
- base::Bind(callback, new_path));
+
+ download_file->Rename(full_path, overwrite_existing_file, callback);
}
int DownloadFileManager::NumberOfActiveDownloads() const {
« no previous file with comments | « content/browser/download/download_file_manager.h ('k') | content/browser/download/download_file_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698