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

Unified Diff: chrome/browser/download/download_file_manager.h

Issue 2877008: Rename the download to its final name only after the download is finished (Closed)
Patch Set: rebase Created 10 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
« no previous file with comments | « chrome/browser/download/download_file.cc ('k') | chrome/browser/download/download_file_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/download/download_file_manager.h
diff --git a/chrome/browser/download/download_file_manager.h b/chrome/browser/download/download_file_manager.h
index bfccbfd788be3df9a41c891ca0be682be76eef77..22bb94e7d848e06e8e4a1c261ed2b3110f696048 100644
--- a/chrome/browser/download/download_file_manager.h
+++ b/chrome/browser/download/download_file_manager.h
@@ -62,6 +62,10 @@ class URLRequestContextGetter;
// Manages all in progress downloads.
class DownloadFileManager
: public base::RefCountedThreadSafe<DownloadFileManager> {
+
+ // For testing.
+ friend class DownloadManagerTest;
+
public:
explicit DownloadFileManager(ResourceDispatcherHost* rdh);
@@ -95,9 +99,17 @@ class DownloadFileManager
gfx::NativeView parent_window);
#endif
+ // The DownloadManager in the UI thread has provided an intermediate
+ // .crdownload name for the download specified by 'id'.
+ void OnIntermediateDownloadName(int id, const FilePath& full_path,
+ DownloadManager* download_manager);
+
// The download manager has provided a final name for a download. Sent from
// the UI thread and run on the download thread.
+ // |need_delete_crdownload| indicates if we explicitly delete the intermediate
+ // .crdownload file or not.
void OnFinalDownloadName(int id, const FilePath& full_path,
+ bool need_delete_crdownload,
DownloadManager* download_manager);
private:
@@ -129,6 +141,10 @@ class DownloadFileManager
// Called on the UI thread to remove a download from the UI progress table.
void RemoveDownloadFromUIProgress(int id);
+ // Called only from OnFinalDownloadName or OnIntermediateDownloadName
+ // on the FILE thread.
+ void CancelDownloadOnRename(int id);
+
// Unique ID for each DownloadFile.
int next_id_;
« no previous file with comments | « chrome/browser/download/download_file.cc ('k') | chrome/browser/download/download_file_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698