OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // Each download is represented by a DownloadItem, and all DownloadItems | 5 // Each download is represented by a DownloadItem, and all DownloadItems |
6 // are owned by the DownloadManager which maintains a global list of all | 6 // are owned by the DownloadManager which maintains a global list of all |
7 // downloads. DownloadItems are created when a user initiates a download, | 7 // downloads. DownloadItems are created when a user initiates a download, |
8 // and exist for the duration of the browser life time. | 8 // and exist for the duration of the browser life time. |
9 // | 9 // |
10 // Download observers: | 10 // Download observers: |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
181 void OnDownloadRenamedToFinalName(const FilePath& full_path); | 181 void OnDownloadRenamedToFinalName(const FilePath& full_path); |
182 | 182 |
183 // Returns true if this item matches |query|. |query| must be lower-cased. | 183 // Returns true if this item matches |query|. |query| must be lower-cased. |
184 bool MatchesQuery(const string16& query) const; | 184 bool MatchesQuery(const string16& query) const; |
185 | 185 |
186 // Accessors | 186 // Accessors |
187 DownloadState state() const { return state_; } | 187 DownloadState state() const { return state_; } |
188 FilePath full_path() const { return full_path_; } | 188 FilePath full_path() const { return full_path_; } |
189 void set_path_uniquifier(int uniquifier) { path_uniquifier_ = uniquifier; } | 189 void set_path_uniquifier(int uniquifier) { path_uniquifier_ = uniquifier; } |
190 GURL url() const { return url_; } | 190 GURL url() const { return url_; } |
191 GURL original_url() const { return original_url_; } | |
Paweł Hajdan Jr.
2011/01/13 08:47:59
We try to avoid adding more accessors like this on
Randy Smith (Not in Mondays)
2011/01/14 19:43:21
It's sorta like the difference between structures
| |
191 GURL referrer_url() const { return referrer_url_; } | 192 GURL referrer_url() const { return referrer_url_; } |
192 std::string mime_type() const { return mime_type_; } | 193 std::string mime_type() const { return mime_type_; } |
193 std::string original_mime_type() const { return original_mime_type_; } | 194 std::string original_mime_type() const { return original_mime_type_; } |
194 int64 total_bytes() const { return total_bytes_; } | 195 int64 total_bytes() const { return total_bytes_; } |
195 void set_total_bytes(int64 total_bytes) { total_bytes_ = total_bytes; } | 196 void set_total_bytes(int64 total_bytes) { total_bytes_ = total_bytes; } |
196 int64 received_bytes() const { return received_bytes_; } | 197 int64 received_bytes() const { return received_bytes_; } |
197 int32 id() const { return id_; } | 198 int32 id() const { return id_; } |
198 base::Time start_time() const { return start_time_; } | 199 base::Time start_time() const { return start_time_; } |
199 void set_db_handle(int64 handle) { db_handle_ = handle; } | 200 void set_db_handle(int64 handle) { db_handle_ = handle; } |
200 int64 db_handle() const { return db_handle_; } | 201 int64 db_handle() const { return db_handle_; } |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
252 // Full path to the downloaded or downloading file. | 253 // Full path to the downloaded or downloading file. |
253 FilePath full_path_; | 254 FilePath full_path_; |
254 | 255 |
255 // A number that should be appended to the path to make it unique, or 0 if the | 256 // A number that should be appended to the path to make it unique, or 0 if the |
256 // path should be used as is. | 257 // path should be used as is. |
257 int path_uniquifier_; | 258 int path_uniquifier_; |
258 | 259 |
259 // The URL from whence we came. | 260 // The URL from whence we came. |
260 GURL url_; | 261 GURL url_; |
261 | 262 |
263 // The original URL before any redirection. | |
Paweł Hajdan Jr.
2011/01/13 08:47:59
Now we have three URLs, and it's super-easy to con
Randy Smith (Not in Mondays)
2011/01/14 19:43:21
I agree with this. I'd suggest changing the doc o
| |
264 GURL original_url_; | |
265 | |
262 // The URL of the page that initiated the download. | 266 // The URL of the page that initiated the download. |
263 GURL referrer_url_; | 267 GURL referrer_url_; |
264 | 268 |
265 // The mimetype of the download | 269 // The mimetype of the download |
266 std::string mime_type_; | 270 std::string mime_type_; |
267 | 271 |
268 // The value of the content type header received when downloading | 272 // The value of the content type header received when downloading |
269 // this item. |mime_type_| may be different because of type sniffing. | 273 // this item. |mime_type_| may be different because of type sniffing. |
270 std::string original_mime_type_; | 274 std::string original_mime_type_; |
271 | 275 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
338 // Did the user open the item either directly or indirectly (such as by | 342 // Did the user open the item either directly or indirectly (such as by |
339 // setting always open files of this type)? The shelf also sets this field | 343 // setting always open files of this type)? The shelf also sets this field |
340 // when the user closes the shelf before the item has been opened but should | 344 // when the user closes the shelf before the item has been opened but should |
341 // be treated as though the user opened it. | 345 // be treated as though the user opened it. |
342 bool opened_; | 346 bool opened_; |
343 | 347 |
344 DISALLOW_COPY_AND_ASSIGN(DownloadItem); | 348 DISALLOW_COPY_AND_ASSIGN(DownloadItem); |
345 }; | 349 }; |
346 | 350 |
347 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_H_ | 351 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_H_ |
OLD | NEW |