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

Unified Diff: content/browser/download/download_file.h

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
« no previous file with comments | « no previous file | content/browser/download/download_file_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/download/download_file.h
diff --git a/content/browser/download/download_file.h b/content/browser/download/download_file.h
index 59e8b9b14804fcd8b46ef557fb3d117218916230..e707a26ca10607149db7f8e14d587451e6d20cb8 100644
--- a/content/browser/download/download_file.h
+++ b/content/browser/download/download_file.h
@@ -8,6 +8,7 @@
#include <string>
#include "base/basictypes.h"
+#include "base/callback_forward.h"
#include "base/file_path.h"
#include "content/common/content_export.h"
#include "content/public/browser/download_id.h"
@@ -23,6 +24,13 @@ class DownloadManager;
// cancelled, the DownloadFile is destroyed.
class CONTENT_EXPORT DownloadFile {
public:
+ // Callback used with Rename(). On a successful rename |reason| will be
+ // DOWNLOAD_INTERRUPT_REASON_NONE and |path| the path the rename
+ // was done to. On a failed rename, |reason| will contain the
+ // error.
+ typedef base::Callback<void(content::DownloadInterruptReason reason,
+ const FilePath& path)> RenameCompletionCallback;
+
virtual ~DownloadFile() {}
// If calculate_hash is true, sha256 hash will be calculated.
@@ -30,9 +38,14 @@ class CONTENT_EXPORT DownloadFile {
// error code on failure.
virtual DownloadInterruptReason Initialize() = 0;
- // Rename the download file.
- // Returns net::OK on success, or a network error code on failure.
- virtual DownloadInterruptReason Rename(const FilePath& full_path) = 0;
+ // Rename the download file to |full_path|. If that file exists and
+ // |overwrite_existing_file| is false, |full_path| will be uniquified by
+ // suffixing " (<number>)" to the file name before the extension.
+ // Upon completion, |callback| will be called on the UI thread
+ // as per the comment above.
+ virtual void Rename(const FilePath& full_path,
+ bool overwrite_existing_file,
+ const RenameCompletionCallback& callback) = 0;
// Detach the file so it is not deleted on destruction.
virtual void Detach() = 0;
« no previous file with comments | « no previous file | content/browser/download/download_file_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698