| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_HISTORY_DOWNLOAD_ROW_H_ | 5 #ifndef CHROME_BROWSER_HISTORY_DOWNLOAD_ROW_H_ |
| 6 #define CHROME_BROWSER_HISTORY_DOWNLOAD_ROW_H_ | 6 #define CHROME_BROWSER_HISTORY_DOWNLOAD_ROW_H_ |
| 7 | 7 |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/time.h" | 9 #include "base/time.h" |
| 10 #include "content/public/browser/download_interrupt_reasons.h" |
| 10 #include "content/public/browser/download_item.h" | 11 #include "content/public/browser/download_item.h" |
| 11 #include "googleurl/src/gurl.h" | 12 #include "googleurl/src/gurl.h" |
| 12 | 13 |
| 13 namespace history { | 14 namespace history { |
| 14 | 15 |
| 15 // Contains the information that is stored in the download system's persistent | 16 // Contains the information that is stored in the download system's persistent |
| 16 // store (or refers to it). DownloadHistory uses this to communicate with the | 17 // store (or refers to it). DownloadHistory uses this to communicate with the |
| 17 // DownloadDatabase through the HistoryService. | 18 // DownloadDatabase through the HistoryService. |
| 18 struct DownloadRow { | 19 struct DownloadRow { |
| 19 DownloadRow(); | 20 DownloadRow(); |
| 20 DownloadRow( | 21 DownloadRow( |
| 21 const FilePath& path, | 22 const FilePath& current_path, |
| 22 const GURL& url, | 23 const FilePath& target_path, |
| 24 const std::vector<GURL>& url_chain, |
| 23 const GURL& referrer, | 25 const GURL& referrer, |
| 24 const base::Time& start, | 26 const base::Time& start, |
| 25 const base::Time& end, | 27 const base::Time& end, |
| 26 int64 received, | 28 int64 received, |
| 27 int64 total, | 29 int64 total, |
| 28 content::DownloadItem::DownloadState download_state, | 30 content::DownloadItem::DownloadState download_state, |
| 31 content::DownloadInterruptReason interrupt_reason, |
| 29 int64 handle, | 32 int64 handle, |
| 30 bool download_opened); | 33 bool download_opened); |
| 31 ~DownloadRow(); | 34 ~DownloadRow(); |
| 32 | 35 |
| 33 // The current path to the downloaded file. | 36 // The current path to the download (potentially different from final if |
| 34 // TODO(benjhayden/asanka): Persist the target filename as well. | 37 // download is in progress or interrupted). |
| 35 FilePath path; | 38 FilePath current_path; |
| 36 | 39 |
| 37 // The URL from which we are downloading. This is the final URL after any | 40 // The target path where the download will go when it's complete. |
| 38 // redirection by the server for |url_chain|. Is not changed by | 41 FilePath target_path; |
| 42 |
| 43 // The URL redirect chain through which we are downloading. The front |
| 44 // is the url that the initial request went to, and the back is the |
| 45 // url from which we ended up getting data. This is not changed by |
| 39 // UpdateDownload(). | 46 // UpdateDownload(). |
| 40 GURL url; | 47 std::vector<GURL> url_chain; |
| 41 | 48 |
| 42 // The URL that referred us. Is not changed by UpdateDownload(). | 49 // The URL that referred us. Is not changed by UpdateDownload(). |
| 43 GURL referrer_url; | 50 GURL referrer_url; |
| 44 | 51 |
| 45 // The time when the download started. Is not changed by UpdateDownload(). | 52 // The time when the download started. Is not changed by UpdateDownload(). |
| 46 base::Time start_time; | 53 base::Time start_time; |
| 47 | 54 |
| 48 // The time when the download completed. | 55 // The time when the download completed. |
| 49 base::Time end_time; | 56 base::Time end_time; |
| 50 | 57 |
| 51 // The number of bytes received (so far). | 58 // The number of bytes received (so far). |
| 52 int64 received_bytes; | 59 int64 received_bytes; |
| 53 | 60 |
| 54 // The total number of bytes in the download. Is not changed by | 61 // The total number of bytes in the download. Is not changed by |
| 55 // UpdateDownload(). | 62 // UpdateDownload(). |
| 56 int64 total_bytes; | 63 int64 total_bytes; |
| 57 | 64 |
| 58 // The current state of the download. | 65 // The current state of the download. |
| 59 content::DownloadItem::DownloadState state; | 66 content::DownloadItem::DownloadState state; |
| 60 | 67 |
| 68 // The reason the download was interrupted, if |
| 69 // state == DownloadItem::INTERRUPTED |
| 70 content::DownloadInterruptReason interrupt_reason; |
| 71 |
| 61 // The handle of the download in the database. Is not changed by | 72 // The handle of the download in the database. Is not changed by |
| 62 // UpdateDownload(). | 73 // UpdateDownload(). |
| 63 int64 db_handle; | 74 int64 db_handle; |
| 64 | 75 |
| 65 // Whether this download has ever been opened from the browser. | 76 // Whether this download has ever been opened from the browser. |
| 66 bool opened; | 77 bool opened; |
| 67 }; | 78 }; |
| 68 | 79 |
| 69 } // namespace history | 80 } // namespace history |
| 70 | 81 |
| 71 #endif // CHROME_BROWSER_HISTORY_DOWNLOAD_ROW_H_ | 82 #endif // CHROME_BROWSER_HISTORY_DOWNLOAD_ROW_H_ |
| OLD | NEW |