summaryrefslogtreecommitdiff
path: root/content/browser/download/base_file.h
diff options
context:
space:
mode:
authorPrimiano Tucci <primiano@google.com>2014-09-30 14:45:55 +0100
committerPrimiano Tucci <primiano@google.com>2014-09-30 14:45:55 +0100
commit1320f92c476a1ad9d19dba2a48c72b75566198e9 (patch)
treeea7f149ccad687b22c18a72b729646568b2d54fb /content/browser/download/base_file.h
parent39b78c562f50ad7d5551ee861121f899239525a2 (diff)
downloadchromium_org-1320f92c476a1ad9d19dba2a48c72b75566198e9.tar.gz
Merge from Chromium at DEPS revision 267aeeb8d85c
This commit was generated by merge_to_master.py. Change-Id: Id3aac9713b301fae64408cdaee0888724eeb7c0e
Diffstat (limited to 'content/browser/download/base_file.h')
-rw-r--r--content/browser/download/base_file.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/content/browser/download/base_file.h b/content/browser/download/base_file.h
index a14c5daef3..037aecca3b 100644
--- a/content/browser/download/base_file.h
+++ b/content/browser/download/base_file.h
@@ -56,7 +56,10 @@ class CONTENT_EXPORT BaseFile {
DownloadInterruptReason AppendDataToFile(const char* data, size_t data_len);
// Rename the download file. Returns a DownloadInterruptReason indicating the
- // result of the operation.
+ // result of the operation. A return code of NONE indicates that the rename
+ // was successful. After a failure, the full_path() and in_progress() can be
+ // used to determine the last known filename and whether the file is available
+ // for writing or retrying the rename.
virtual DownloadInterruptReason Rename(const base::FilePath& full_path);
// Detach the file so it is not deleted on destruction.
@@ -79,8 +82,15 @@ class CONTENT_EXPORT BaseFile {
// Windows to ensure the correct app client ID is available.
DownloadInterruptReason AnnotateWithSourceInformation();
- base::FilePath full_path() const { return full_path_; }
+ // Returns the last known path to the download file. Can be empty if there's
+ // no file.
+ const base::FilePath& full_path() const { return full_path_; }
+
+ // Returns true if the file is open. If true, the file can be written to or
+ // renamed.
bool in_progress() const { return file_.IsValid(); }
+
+ // Returns the number of bytes in the file pointed to by full_path().
int64 bytes_so_far() const { return bytes_so_far_; }
// Fills |hash| with the hash digest for the file.