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

Unified Diff: chrome/browser/download/download_history.cc

Issue 1781983002: [Downloads] Introduce GUIDs for downloads. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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/download/download_history.cc
diff --git a/chrome/browser/download/download_history.cc b/chrome/browser/download/download_history.cc
index b901ce4e40c5c691dbeba374bef1e397ba1891ee..5d5cd5f160864c6a4f0bb3285b21074bc295fb25 100644
--- a/chrome/browser/download/download_history.cc
+++ b/chrome/browser/download/download_history.cc
@@ -127,31 +127,24 @@ history::DownloadRow GetDownloadRow(
#endif
return history::DownloadRow(
- item->GetFullPath(),
- item->GetTargetFilePath(),
- item->GetUrlChain(),
+ item->GetFullPath(), item->GetTargetFilePath(), item->GetUrlChain(),
item->GetReferrerUrl(),
- item->GetMimeType(),
- item->GetOriginalMimeType(),
- item->GetStartTime(),
- item->GetEndTime(),
- item->GetETag(),
- item->GetLastModifiedTime(),
- item->GetReceivedBytes(),
- item->GetTotalBytes(),
+ std::string(), // HTTP method (not available yet)
+ item->GetMimeType(), item->GetOriginalMimeType(), item->GetStartTime(),
+ item->GetEndTime(), item->GetETag(), item->GetLastModifiedTime(),
+ item->GetReceivedBytes(), item->GetTotalBytes(),
history::ToHistoryDownloadState(item->GetState()),
history::ToHistoryDownloadDangerType(item->GetDangerType()),
history::ToHistoryDownloadInterruptReason(item->GetLastReason()),
- history::ToHistoryDownloadId(item->GetId()),
- item->GetOpened(),
- by_ext_id,
- by_ext_name);
+ std::string(), // Hash value (not available yet)
+ history::ToHistoryDownloadId(item->GetId()), item->GetGuid(),
+ item->GetOpened(), by_ext_id, by_ext_name);
}
bool ShouldUpdateHistory(const history::DownloadRow* previous,
const history::DownloadRow& current) {
- // Ignore url, referrer, mime_type, original_mime_type, start_time,
- // id, db_handle, which don't change.
+ // Ignore url_chain, referrer, http_method, mime_type, original_mime_type,
+ // start_time, id, guid, which don't change.
return ((previous == NULL) ||
(previous->current_path != current.current_path) ||
(previous->target_path != current.target_path) ||
@@ -163,6 +156,7 @@ bool ShouldUpdateHistory(const history::DownloadRow* previous,
(previous->state != current.state) ||
(previous->danger_type != current.danger_type) ||
(previous->interrupt_reason != current.interrupt_reason) ||
+ (previous->hash != current.hash) ||
(previous->opened != current.opened) ||
(previous->by_ext_id != current.by_ext_id) ||
(previous->by_ext_name != current.by_ext_name));
@@ -264,20 +258,10 @@ void DownloadHistory::QueryCallback(scoped_ptr<InfoVector> infos) {
it != infos->end(); ++it) {
loading_id_ = history::ToContentDownloadId(it->id);
content::DownloadItem* item = notifier_.GetManager()->CreateDownloadItem(
- loading_id_,
- it->current_path,
- it->target_path,
- it->url_chain,
- it->referrer_url,
- it->mime_type,
- it->original_mime_type,
- it->start_time,
- it->end_time,
- it->etag,
- it->last_modified,
- it->received_bytes,
- it->total_bytes,
- history::ToContentDownloadState(it->state),
+ it->guid, loading_id_, it->current_path, it->target_path, it->url_chain,
+ it->referrer_url, it->mime_type, it->original_mime_type, it->start_time,
+ it->end_time, it->etag, it->last_modified, it->received_bytes,
+ it->total_bytes, history::ToContentDownloadState(it->state),
history::ToContentDownloadDangerType(it->danger_type),
history::ToContentDownloadInterruptReason(it->interrupt_reason),
it->opened);

Powered by Google App Engine
This is Rietveld 408576698