OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_HISTORY_DOWNLOAD_ROW_H_ | |
6 #define CHROME_BROWSER_HISTORY_DOWNLOAD_ROW_H_ | |
7 | |
8 #include <string> | |
9 #include <vector> | |
10 | |
11 #include "base/files/file_path.h" | |
12 #include "base/time/time.h" | |
13 #include "content/public/browser/download_danger_type.h" | |
14 #include "content/public/browser/download_interrupt_reasons.h" | |
15 #include "content/public/browser/download_item.h" | |
16 #include "url/gurl.h" | |
17 | |
18 namespace history { | |
19 | |
20 // 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 | |
22 // DownloadDatabase through the HistoryService. | |
23 struct DownloadRow { | |
24 DownloadRow(); | |
25 DownloadRow( | |
26 const base::FilePath& current_path, | |
27 const base::FilePath& target_path, | |
28 const std::vector<GURL>& url_chain, | |
29 const GURL& referrer, | |
30 const std::string& mime_type, | |
31 const std::string& original_mime_type, | |
32 const base::Time& start, | |
33 const base::Time& end, | |
34 const std::string& etag, | |
35 const std::string& last_modified, | |
36 int64 received, | |
37 int64 total, | |
38 content::DownloadItem::DownloadState download_state, | |
39 content::DownloadDangerType danger_type, | |
40 content::DownloadInterruptReason interrupt_reason, | |
41 uint32 id, | |
42 bool download_opened, | |
43 const std::string& ext_id, | |
44 const std::string& ext_name); | |
45 ~DownloadRow(); | |
46 | |
47 // The current path to the download (potentially different from final if | |
48 // download is in progress or interrupted). | |
49 base::FilePath current_path; | |
50 | |
51 // The target path where the download will go when it's complete. | |
52 base::FilePath target_path; | |
53 | |
54 // The URL redirect chain through which we are downloading. The front | |
55 // is the url that the initial request went to, and the back is the | |
56 // url from which we ended up getting data. This is not changed by | |
57 // UpdateDownload(). | |
58 std::vector<GURL> url_chain; | |
59 | |
60 // The URL that referred us. Is not changed by UpdateDownload(). | |
61 GURL referrer_url; | |
62 | |
63 // The MIME type of the download, might be based on heuristics. | |
64 std::string mime_type; | |
65 | |
66 // The original MIME type of the download. | |
67 std::string original_mime_type; | |
68 | |
69 // The time when the download started. Is not changed by UpdateDownload(). | |
70 base::Time start_time; | |
71 | |
72 // The time when the download completed. | |
73 base::Time end_time; | |
74 | |
75 // Contents of most recently seen ETag header. | |
76 std::string etag; | |
77 | |
78 // Contents of most recently seen Last-Modified header. | |
79 std::string last_modified; | |
80 | |
81 // The number of bytes received (so far). | |
82 int64 received_bytes; | |
83 | |
84 // The total number of bytes in the download. Is not changed by | |
85 // UpdateDownload(). | |
86 int64 total_bytes; | |
87 | |
88 // The current state of the download. | |
89 content::DownloadItem::DownloadState state; | |
90 | |
91 // Whether and how the download is dangerous. | |
92 content::DownloadDangerType danger_type; | |
93 | |
94 // The reason the download was interrupted, if | |
95 // state == DownloadItem::INTERRUPTED | |
96 content::DownloadInterruptReason interrupt_reason; | |
97 | |
98 // The id of the download in the database. Is not changed by UpdateDownload(). | |
99 uint32 id; | |
100 | |
101 // Whether this download has ever been opened from the browser. | |
102 bool opened; | |
103 | |
104 // The id and name of the extension that created this download. | |
105 std::string by_ext_id; | |
106 std::string by_ext_name; | |
107 }; | |
108 | |
109 } // namespace history | |
110 | |
111 #endif // CHROME_BROWSER_HISTORY_DOWNLOAD_ROW_H_ | |
OLD | NEW |