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

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

Issue 6969009: Reduced the lifetime of DownloadCreateInfo. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged with trunk 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_history_info.cc
diff --git a/chrome/browser/history/download_history_info.cc b/chrome/browser/history/download_history_info.cc
new file mode 100644
index 0000000000000000000000000000000000000000..3dde9219802515845f6b739c4affc76a043df9df
--- /dev/null
+++ b/chrome/browser/history/download_history_info.cc
@@ -0,0 +1,80 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/history/download_history_info.h"
+
+#include "chrome/browser/download/download_item.h"
Paweł Hajdan Jr. 2011/05/19 16:18:25 If possible I'd like to avoid a dependency on down
Randy Smith (Not in Mondays) 2011/05/19 17:05:27 That makes sense to me. My guess is that the depe
Paweł Hajdan Jr. 2011/05/19 19:11:24 I'd prefer an accessor that returns a copy of Down
ahendrickson 2011/05/19 20:16:49 Done.
+
+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();
+}

Powered by Google App Engine
This is Rietveld 408576698