Index: chrome/browser/history/download_create_info.cc |
diff --git a/chrome/browser/history/download_create_info.cc b/chrome/browser/history/download_create_info.cc |
index 12b23a8ed5f67b0cd5a24a38f53a1efda2f8a730..4ecaf75b39a9cefe8327f649d6b3b4d650602b26 100644 |
--- a/chrome/browser/history/download_create_info.cc |
+++ b/chrome/browser/history/download_create_info.cc |
@@ -8,6 +8,80 @@ |
#include "base/format_macros.h" |
#include "base/stringprintf.h" |
+#include "chrome/browser/download/download_item.h" |
+ |
+DownloadHistoryInfo::DownloadHistoryInfo() |
+ : download_id(-1), |
+ received_bytes(0), |
+ total_bytes(0), |
+ state(0), |
+ db_handle(0) { |
+} |
+ |
+DownloadHistoryInfo::DownloadHistoryInfo(const DownloadItem& item) |
+ : download_id(item.id()), |
+ path(item.full_path()), |
+ url_chain(item.url_chain()), |
+ referrer_url(item.referrer_url()), |
+ start_time(item.start_time()), |
+ received_bytes(item.received_bytes()), |
+ total_bytes(item.total_bytes()), |
+ state(item.state()), |
+ db_handle(item.db_handle()) { |
+} |
+ |
+DownloadHistoryInfo::DownloadHistoryInfo(const std::vector<GURL>& urls, |
+ const GURL& referrer, |
+ int64 total_bytes) |
+ : download_id(-1), |
+ url_chain(urls), |
+ referrer_url(referrer), |
+ start_time(base::Time::Now()), |
+ received_bytes(0), |
+ total_bytes(total_bytes), |
+ state(0), |
+ db_handle(0) { |
+} |
+ |
+DownloadHistoryInfo::DownloadHistoryInfo(const FilePath& path, |
+ const GURL& url, |
+ const base::Time& start, |
+ int64 received, |
+ int64 total, |
+ int32 download_state) |
+ : download_id(1), |
+ path(path), |
+ url_chain(1, url), |
+ start_time(start), |
+ received_bytes(received), |
+ total_bytes(total), |
+ state(download_state), |
+ db_handle(0) { |
+} |
+ |
+DownloadHistoryInfo::DownloadHistoryInfo(const FilePath& path, |
+ const std::vector<GURL>& url, |
+ const GURL& referrer, |
+ const base::Time& start, |
+ int64 received, |
+ int64 total, |
+ int32 download_state, |
+ int64 handle, |
+ int32 id) |
+ : download_id(id), |
+ path(path), |
+ url_chain(url), |
+ referrer_url(referrer), |
+ start_time(start), |
+ received_bytes(received), |
+ total_bytes(total), |
+ state(download_state), |
+ db_handle(handle) { |
+} |
+ |
+const GURL& DownloadHistoryInfo::url() const { |
+ return url_chain.empty() ? GURL::EmptyGURL() : url_chain.back(); |
+} |
DownloadCreateInfo::DownloadCreateInfo(const FilePath& path, |
const GURL& url, |