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