| 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 COMPONENTS_HISTORY_CORE_BROWSER_DOWNLOAD_ROW_H_ | 5 #ifndef COMPONENTS_HISTORY_CORE_BROWSER_DOWNLOAD_ROW_H_ |
| 6 #define COMPONENTS_HISTORY_CORE_BROWSER_DOWNLOAD_ROW_H_ | 6 #define COMPONENTS_HISTORY_CORE_BROWSER_DOWNLOAD_ROW_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 15 #include "components/history/core/browser/download_types.h" | 15 #include "components/history/core/browser/download_types.h" |
| 16 #include "url/gurl.h" | 16 #include "url/gurl.h" |
| 17 | 17 |
| 18 namespace history { | 18 namespace history { |
| 19 | 19 |
| 20 // Contains the information that is stored in the download system's persistent | 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 | 21 // store (or refers to it). DownloadHistory uses this to communicate with the |
| 22 // DownloadDatabase through the HistoryService. | 22 // DownloadDatabase through the HistoryService. |
| 23 struct DownloadRow { | 23 struct DownloadRow { |
| 24 DownloadRow(); | 24 DownloadRow(); |
| 25 DownloadRow(const base::FilePath& current_path, | 25 DownloadRow(const base::FilePath& current_path, |
| 26 const base::FilePath& target_path, | 26 const base::FilePath& target_path, |
| 27 const std::vector<GURL>& url_chain, | 27 const std::vector<GURL>& url_chain, |
| 28 const GURL& referrer, | 28 const GURL& referrer, |
| 29 const std::string& http_method, |
| 29 const std::string& mime_type, | 30 const std::string& mime_type, |
| 30 const std::string& original_mime_type, | 31 const std::string& original_mime_type, |
| 31 const base::Time& start, | 32 const base::Time& start, |
| 32 const base::Time& end, | 33 const base::Time& end, |
| 33 const std::string& etag, | 34 const std::string& etag, |
| 34 const std::string& last_modified, | 35 const std::string& last_modified, |
| 35 int64_t received, | 36 int64_t received, |
| 36 int64_t total, | 37 int64_t total, |
| 37 DownloadState download_state, | 38 DownloadState download_state, |
| 38 DownloadDangerType danger_type, | 39 DownloadDangerType danger_type, |
| 39 DownloadInterruptReason interrupt_reason, | 40 DownloadInterruptReason interrupt_reason, |
| 41 const std::string& hash, |
| 40 DownloadId id, | 42 DownloadId id, |
| 43 const std::string& guid, |
| 41 bool download_opened, | 44 bool download_opened, |
| 42 const std::string& ext_id, | 45 const std::string& ext_id, |
| 43 const std::string& ext_name); | 46 const std::string& ext_name); |
| 44 DownloadRow(const DownloadRow& other); | 47 DownloadRow(const DownloadRow& other); |
| 45 ~DownloadRow(); | 48 ~DownloadRow(); |
| 46 | 49 |
| 50 bool operator==(const DownloadRow&) const; |
| 51 |
| 47 // The current path to the download (potentially different from final if | 52 // The current path to the download (potentially different from final if |
| 48 // download is in progress or interrupted). | 53 // download is in progress or interrupted). |
| 49 base::FilePath current_path; | 54 base::FilePath current_path; |
| 50 | 55 |
| 51 // The target path where the download will go when it's complete. | 56 // The target path where the download will go when it's complete. |
| 52 base::FilePath target_path; | 57 base::FilePath target_path; |
| 53 | 58 |
| 54 // The URL redirect chain through which we are downloading. The front | 59 // 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 | 60 // 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 | 61 // url from which we ended up getting data. This is not changed by |
| 57 // UpdateDownload(). | 62 // UpdateDownload(). |
| 58 std::vector<GURL> url_chain; | 63 std::vector<GURL> url_chain; |
| 59 | 64 |
| 60 // The URL that referred us. Is not changed by UpdateDownload(). | 65 // The URL that referred us. Is not changed by UpdateDownload(). |
| 61 GURL referrer_url; | 66 GURL referrer_url; |
| 62 | 67 |
| 68 // HTTP method used for the request. GET is assumed if the method was not |
| 69 // stored for a download in the history database. |
| 70 std::string http_method; |
| 71 |
| 63 // The MIME type of the download, might be based on heuristics. | 72 // The MIME type of the download, might be based on heuristics. |
| 64 std::string mime_type; | 73 std::string mime_type; |
| 65 | 74 |
| 66 // The original MIME type of the download. | 75 // The original MIME type of the download. |
| 67 std::string original_mime_type; | 76 std::string original_mime_type; |
| 68 | 77 |
| 69 // The time when the download started. Is not changed by UpdateDownload(). | 78 // The time when the download started. Is not changed by UpdateDownload(). |
| 70 base::Time start_time; | 79 base::Time start_time; |
| 71 | 80 |
| 72 // The time when the download completed. | 81 // The time when the download completed. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 87 | 96 |
| 88 // The current state of the download. | 97 // The current state of the download. |
| 89 DownloadState state; | 98 DownloadState state; |
| 90 | 99 |
| 91 // Whether and how the download is dangerous. | 100 // Whether and how the download is dangerous. |
| 92 DownloadDangerType danger_type; | 101 DownloadDangerType danger_type; |
| 93 | 102 |
| 94 // The reason the download was interrupted, if state == kStateInterrupted. | 103 // The reason the download was interrupted, if state == kStateInterrupted. |
| 95 DownloadInterruptReason interrupt_reason; | 104 DownloadInterruptReason interrupt_reason; |
| 96 | 105 |
| 106 // The raw SHA-256 hash of the complete or partial download contents. Not hex |
| 107 // encoded. |
| 108 std::string hash; |
| 109 |
| 97 // The id of the download in the database. Is not changed by UpdateDownload(). | 110 // The id of the download in the database. Is not changed by UpdateDownload(). |
| 111 // Note: This field should be considered deprecated in favor of |guid| below. |
| 112 // See http://crbug.com/593020. |
| 98 DownloadId id; | 113 DownloadId id; |
| 99 | 114 |
| 115 // The GUID of the download in the database. Not changed by UpdateDownload(). |
| 116 std::string guid; |
| 117 |
| 100 // Whether this download has ever been opened from the browser. | 118 // Whether this download has ever been opened from the browser. |
| 101 bool opened; | 119 bool opened; |
| 102 | 120 |
| 103 // The id and name of the extension that created this download. | 121 // The id and name of the extension that created this download. |
| 104 std::string by_ext_id; | 122 std::string by_ext_id; |
| 105 std::string by_ext_name; | 123 std::string by_ext_name; |
| 106 }; | 124 }; |
| 107 | 125 |
| 108 } // namespace history | 126 } // namespace history |
| 109 | 127 |
| 110 #endif // COMPONENTS_HISTORY_CORE_BROWSER_DOWNLOAD_ROW_H_ | 128 #endif // COMPONENTS_HISTORY_CORE_BROWSER_DOWNLOAD_ROW_H_ |
| OLD | NEW |