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