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 COMPONENTS_HISTORY_CORE_BROWSER_DOWNLOAD_ROW_H_ |
6 #define CHROME_BROWSER_HISTORY_DOWNLOAD_ROW_H_ | 6 #define COMPONENTS_HISTORY_CORE_BROWSER_DOWNLOAD_ROW_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
13 #include "content/public/browser/download_danger_type.h" | 13 #include "components/history/core/browser/download_types.h" |
14 #include "content/public/browser/download_interrupt_reasons.h" | |
15 #include "content/public/browser/download_item.h" | |
16 #include "url/gurl.h" | 14 #include "url/gurl.h" |
17 | 15 |
18 namespace history { | 16 namespace history { |
19 | 17 |
20 // Contains the information that is stored in the download system's persistent | 18 // Contains the information that is stored in the download system's persistent |
21 // store (or refers to it). DownloadHistory uses this to communicate with the | 19 // store (or refers to it). DownloadHistory uses this to communicate with the |
22 // DownloadDatabase through the HistoryService. | 20 // DownloadDatabase through the HistoryService. |
23 struct DownloadRow { | 21 struct DownloadRow { |
24 DownloadRow(); | 22 DownloadRow(); |
25 DownloadRow( | 23 DownloadRow(const base::FilePath& current_path, |
26 const base::FilePath& current_path, | 24 const base::FilePath& target_path, |
27 const base::FilePath& target_path, | 25 const std::vector<GURL>& url_chain, |
28 const std::vector<GURL>& url_chain, | 26 const GURL& referrer, |
29 const GURL& referrer, | 27 const std::string& mime_type, |
30 const std::string& mime_type, | 28 const std::string& original_mime_type, |
31 const std::string& original_mime_type, | 29 const base::Time& start, |
32 const base::Time& start, | 30 const base::Time& end, |
33 const base::Time& end, | 31 const std::string& etag, |
34 const std::string& etag, | 32 const std::string& last_modified, |
35 const std::string& last_modified, | 33 int64 received, |
36 int64 received, | 34 int64 total, |
37 int64 total, | 35 DownloadState download_state, |
38 content::DownloadItem::DownloadState download_state, | 36 DownloadDangerType danger_type, |
39 content::DownloadDangerType danger_type, | 37 DownloadInterruptReason interrupt_reason, |
40 content::DownloadInterruptReason interrupt_reason, | 38 DownloadId id, |
41 uint32 id, | 39 bool download_opened, |
42 bool download_opened, | 40 const std::string& ext_id, |
43 const std::string& ext_id, | 41 const std::string& ext_name); |
44 const std::string& ext_name); | |
45 ~DownloadRow(); | 42 ~DownloadRow(); |
46 | 43 |
47 // The current path to the download (potentially different from final if | 44 // The current path to the download (potentially different from final if |
48 // download is in progress or interrupted). | 45 // download is in progress or interrupted). |
49 base::FilePath current_path; | 46 base::FilePath current_path; |
50 | 47 |
51 // The target path where the download will go when it's complete. | 48 // The target path where the download will go when it's complete. |
52 base::FilePath target_path; | 49 base::FilePath target_path; |
53 | 50 |
54 // The URL redirect chain through which we are downloading. The front | 51 // The URL redirect chain through which we are downloading. The front |
(...skipping 24 matching lines...) Expand all Loading... |
79 std::string last_modified; | 76 std::string last_modified; |
80 | 77 |
81 // The number of bytes received (so far). | 78 // The number of bytes received (so far). |
82 int64 received_bytes; | 79 int64 received_bytes; |
83 | 80 |
84 // The total number of bytes in the download. Is not changed by | 81 // The total number of bytes in the download. Is not changed by |
85 // UpdateDownload(). | 82 // UpdateDownload(). |
86 int64 total_bytes; | 83 int64 total_bytes; |
87 | 84 |
88 // The current state of the download. | 85 // The current state of the download. |
89 content::DownloadItem::DownloadState state; | 86 DownloadState state; |
90 | 87 |
91 // Whether and how the download is dangerous. | 88 // Whether and how the download is dangerous. |
92 content::DownloadDangerType danger_type; | 89 DownloadDangerType danger_type; |
93 | 90 |
94 // The reason the download was interrupted, if | 91 // The reason the download was interrupted, if state == kStateInterrupted. |
95 // state == DownloadItem::INTERRUPTED | 92 DownloadInterruptReason interrupt_reason; |
96 content::DownloadInterruptReason interrupt_reason; | |
97 | 93 |
98 // The id of the download in the database. Is not changed by UpdateDownload(). | 94 // The id of the download in the database. Is not changed by UpdateDownload(). |
99 uint32 id; | 95 DownloadId id; |
100 | 96 |
101 // Whether this download has ever been opened from the browser. | 97 // Whether this download has ever been opened from the browser. |
102 bool opened; | 98 bool opened; |
103 | 99 |
104 // The id and name of the extension that created this download. | 100 // The id and name of the extension that created this download. |
105 std::string by_ext_id; | 101 std::string by_ext_id; |
106 std::string by_ext_name; | 102 std::string by_ext_name; |
107 }; | 103 }; |
108 | 104 |
109 } // namespace history | 105 } // namespace history |
110 | 106 |
111 #endif // CHROME_BROWSER_HISTORY_DOWNLOAD_ROW_H_ | 107 #endif // COMPONENTS_HISTORY_CORE_BROWSER_DOWNLOAD_ROW_H_ |
OLD | NEW |