OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 // |
5 // Objects that handle file operations for downloads, on the download thread. | 5 // Objects that handle file operations for downloads, on the download thread. |
6 // | 6 // |
7 // The DownloadFileManager owns a set of DownloadFile objects, each of which | 7 // The DownloadFileManager owns a set of DownloadFile objects, each of which |
8 // represent one in progress download and performs the disk IO for that | 8 // represent one in progress download and performs the disk IO for that |
9 // download. The DownloadFileManager itself is a singleton object owned by the | 9 // download. The DownloadFileManager itself is a singleton object owned by the |
10 // ResourceDispatcherHost. | 10 // ResourceDispatcherHost. |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 92 |
93 // Write a new chunk of data to the file. Returns true on success. | 93 // Write a new chunk of data to the file. Returns true on success. |
94 bool AppendDataToFile(const char* data, int data_len); | 94 bool AppendDataToFile(const char* data, int data_len); |
95 | 95 |
96 // Abort the download and automatically close the file. | 96 // Abort the download and automatically close the file. |
97 void Cancel(); | 97 void Cancel(); |
98 | 98 |
99 // Rename the download file. Returns 'true' if the rename was successful. | 99 // Rename the download file. Returns 'true' if the rename was successful. |
100 bool Rename(const FilePath& full_path); | 100 bool Rename(const FilePath& full_path); |
101 | 101 |
| 102 // Informs the OS that this file came from the internet. |
| 103 void AnnotateWithSourceInformation(); |
| 104 |
102 // Accessors. | 105 // Accessors. |
103 int64 bytes_so_far() const { return bytes_so_far_; } | 106 int64 bytes_so_far() const { return bytes_so_far_; } |
104 int id() const { return id_; } | 107 int id() const { return id_; } |
105 FilePath full_path() const { return full_path_; } | 108 FilePath full_path() const { return full_path_; } |
106 int child_id() const { return child_id_; } | 109 int child_id() const { return child_id_; } |
107 int render_view_id() const { return render_view_id_; } | 110 int render_view_id() const { return render_view_id_; } |
108 int request_id() const { return request_id_; } | 111 int request_id() const { return request_id_; } |
109 bool path_renamed() const { return path_renamed_; } | 112 bool path_renamed() const { return path_renamed_; } |
110 bool in_progress() const { return file_ != NULL; } | 113 bool in_progress() const { return file_ != NULL; } |
111 void set_in_progress(bool in_progress) { in_progress_ = in_progress; } | 114 void set_in_progress(bool in_progress) { in_progress_ = in_progress; } |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 // Used for progress updates on the UI thread, mapping download->id() to bytes | 284 // Used for progress updates on the UI thread, mapping download->id() to bytes |
282 // received so far. Written to by the file thread and read by the UI thread. | 285 // received so far. Written to by the file thread and read by the UI thread. |
283 typedef base::hash_map<int, int64> ProgressMap; | 286 typedef base::hash_map<int, int64> ProgressMap; |
284 ProgressMap ui_progress_; | 287 ProgressMap ui_progress_; |
285 Lock progress_lock_; | 288 Lock progress_lock_; |
286 | 289 |
287 DISALLOW_COPY_AND_ASSIGN(DownloadFileManager); | 290 DISALLOW_COPY_AND_ASSIGN(DownloadFileManager); |
288 }; | 291 }; |
289 | 292 |
290 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_H_ | 293 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_H_ |
OLD | NEW |