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 CONTENT_PUBlIC_BROWSER_DOWNLOAD_PERSISTENT_STORE_INFO_H_ | |
6 #define CONTENT_PUBlIC_BROWSER_DOWNLOAD_PERSISTENT_STORE_INFO_H_ | |
7 | |
8 #include "base/file_path.h" | |
9 #include "base/time.h" | |
10 #include "content/common/content_export.h" | |
11 #include "content/public/browser/download_item.h" | |
12 #include "googleurl/src/gurl.h" | |
13 | |
14 namespace content { | |
15 | |
16 // Contains the information that is stored in the download system's persistent | |
17 // store (or refers to it). Managed by the DownloadItem. When used to create a | |
18 // history entry, all fields except for |db_handle| are set by DownloadItem and | |
19 // read by DownloadDatabase. When used to update a history entry, DownloadItem | |
20 // sets all fields, but DownloadDatabase only reads |end_time|, | |
21 // |received_bytes|, |state|, and |opened|, and uses |db_handle| to select the | |
22 // row in the database table to update. When used to load DownloadItems from | |
23 // the history, all fields except |referrer_url| are set by the DownloadDatabase | |
24 // and read by the DownloadItem. | |
25 struct CONTENT_EXPORT DownloadPersistentStoreInfo { | |
26 DownloadPersistentStoreInfo(); | |
27 DownloadPersistentStoreInfo(const FilePath& path, | |
28 const GURL& url, | |
29 const GURL& referrer, | |
30 const base::Time& start, | |
31 const base::Time& end, | |
32 int64 received, | |
33 int64 total, | |
34 DownloadItem::DownloadState download_state, | |
35 int64 handle, | |
36 bool download_opened); | |
37 ~DownloadPersistentStoreInfo(); // For linux-clang. | |
38 | |
39 // The final path where the download is saved. | |
40 FilePath path; | |
41 | |
42 // The URL from which we are downloading. This is the final URL after any | |
43 // redirection by the server for |url_chain|. Is not changed by UpdateEntry(). | |
44 GURL url; | |
45 | |
46 // The URL that referred us. | |
47 GURL referrer_url; | |
48 | |
49 // The time when the download started. Is not changed by UpdateEntry(). | |
50 base::Time start_time; | |
51 | |
52 // The time when the download completed. | |
53 base::Time end_time; | |
54 | |
55 // The number of bytes received (so far). | |
56 int64 received_bytes; | |
57 | |
58 // The total number of bytes in the download. Is not changed by UpdateEntry(). | |
59 int64 total_bytes; | |
60 | |
61 // The current state of the download. | |
62 DownloadItem::DownloadState state; | |
63 | |
64 // The handle of the download in the database. Is not changed by | |
65 // UpdateEntry(). | |
66 int64 db_handle; | |
67 | |
68 // Whether this download has ever been opened from the browser. | |
69 bool opened; | |
70 }; | |
71 | |
72 } // namespace content | |
73 | |
74 #endif // CONTENT_PUBlIC_BROWSER_DOWNLOAD_PERSISTENT_STORE_INFO_H_ | |
OLD | NEW |