Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5311)

Unified Diff: chrome/browser/history/download_create_info.cc

Issue 6969009: Reduced the lifetime of DownloadCreateInfo. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed structure accessors from DownloadItem, per request. Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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,

Powered by Google App Engine
This is Rietveld 408576698