Chromium Code Reviews| Index: chrome/browser/download/download_file.h |
| diff --git a/chrome/browser/download/download_file.h b/chrome/browser/download/download_file.h |
| index 97057a6d7cb769428af44cf7c59564acfe6d3b4d..1f4f1641f2e5a1bf043ce82ebc47fba0c079f8a4 100644 |
| --- a/chrome/browser/download/download_file.h |
| +++ b/chrome/browser/download/download_file.h |
| @@ -18,6 +18,7 @@ |
| #include "googleurl/src/gurl.h" |
| struct DownloadCreateInfo; |
| +class ResourceDispatcherHost; |
|
darin (slow to review)
2010/07/21 04:44:03
it would be nice if we limited the number of class
|
| // These objects live exclusively on the download thread and handle the writing |
| // operations for one download. These objects live only for the duration that |
| @@ -30,8 +31,9 @@ class DownloadFile { |
| bool Initialize(); |
| - // Write a new chunk of data to the file. Returns true on success. |
| - bool AppendDataToFile(const char* data, int data_len); |
| + // Write a new chunk of data to the file. Returns true on success (all bytes |
| + // written to the file). |
| + bool AppendDataToFile(const char* data, size_t data_len); |
| // Abort the download and automatically close the file. |
| void Cancel(); |
| @@ -39,19 +41,19 @@ class DownloadFile { |
| // Rename the download file. Returns 'true' if the rename was successful. |
| bool Rename(const FilePath& full_path); |
| + // Indicate that the download has finished. No new data will be received. |
| + void Finish(); |
| + |
| // Informs the OS that this file came from the internet. |
| void AnnotateWithSourceInformation(); |
| + // Cancels the download request associated with this file. |
| + void CancelDownloadRequest(ResourceDispatcherHost* rdh); |
| + |
| // Accessors. |
| - int64 bytes_so_far() const { return bytes_so_far_; } |
| int id() const { return id_; } |
| - FilePath full_path() const { return full_path_; } |
| - int child_id() const { return child_id_; } |
| - int render_view_id() const { return render_view_id_; } |
| - int request_id() const { return request_id_; } |
| bool path_renamed() const { return path_renamed_; } |
| bool in_progress() const { return file_stream_ != NULL; } |
| - void set_in_progress(bool in_progress) { in_progress_ = in_progress; } |
| private: |
| // Open or Close the OS file stream. The stream is opened in the constructor |
| @@ -75,30 +77,19 @@ class DownloadFile { |
| // IDs for looking up the tab we are associated with. |
| int child_id_; |
| - int render_view_id_; |
| // Handle for informing the ResourceDispatcherHost of a UI based cancel. |
| int request_id_; |
| - // Amount of data received up to this point. We may not know in advance how |
| - // much data to expect since some servers don't provide that information. |
| - int64 bytes_so_far_; |
| - |
| // Full path to the downloaded file. |
| FilePath full_path_; |
| // Whether the download is still using its initial temporary path. |
| bool path_renamed_; |
| - // Whether the download is still receiving data. |
| - bool in_progress_; |
| - |
| // RAII handle to keep the system from sleeping while we're downloading. |
| PowerSaveBlocker dont_sleep_; |
| - // The provider used to save the download data. |
| - DownloadSaveInfo save_info_; |
| - |
| DISALLOW_COPY_AND_ASSIGN(DownloadFile); |
| }; |