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

Side by Side Diff: chrome/browser/download/download_history.cc

Issue 1751603002: [Downloads] Rework how hashes are calculated for download files. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase on top of https://codereview.chromium.org/1781983002 since that's going in first. 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 unified diff | Download patch
OLDNEW
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 // DownloadHistory manages persisting DownloadItems to the history service by 5 // DownloadHistory manages persisting DownloadItems to the history service by
6 // observing a single DownloadManager and all its DownloadItems using an 6 // observing a single DownloadManager and all its DownloadItems using an
7 // AllDownloadItemNotifier. 7 // AllDownloadItemNotifier.
8 // 8 //
9 // DownloadHistory decides whether and when to add items to, remove items from, 9 // DownloadHistory decides whether and when to add items to, remove items from,
10 // and update items in the database. DownloadHistory uses DownloadHistoryData to 10 // and update items in the database. DownloadHistory uses DownloadHistoryData to
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 it->url_chain, 275 it->url_chain,
276 it->referrer_url, 276 it->referrer_url,
277 it->mime_type, 277 it->mime_type,
278 it->original_mime_type, 278 it->original_mime_type,
279 it->start_time, 279 it->start_time,
280 it->end_time, 280 it->end_time,
281 it->etag, 281 it->etag,
282 it->last_modified, 282 it->last_modified,
283 it->received_bytes, 283 it->received_bytes,
284 it->total_bytes, 284 it->total_bytes,
285 std::string(), // TODO(asanka): Need to persist and restore hash of
286 // partial file for an interrupted download. No need to
287 // store hash for a completed file.
285 history::ToContentDownloadState(it->state), 288 history::ToContentDownloadState(it->state),
286 history::ToContentDownloadDangerType(it->danger_type), 289 history::ToContentDownloadDangerType(it->danger_type),
287 history::ToContentDownloadInterruptReason(it->interrupt_reason), 290 history::ToContentDownloadInterruptReason(it->interrupt_reason),
288 it->opened); 291 it->opened);
289 #if defined(ENABLE_EXTENSIONS) 292 #if defined(ENABLE_EXTENSIONS)
290 if (!it->by_ext_id.empty() && !it->by_ext_name.empty()) { 293 if (!it->by_ext_id.empty() && !it->by_ext_name.empty()) {
291 new extensions::DownloadedByExtension( 294 new extensions::DownloadedByExtension(
292 item, it->by_ext_id, it->by_ext_name); 295 item, it->by_ext_id, it->by_ext_name);
293 item->UpdateObservers(); 296 item->UpdateObservers();
294 } 297 }
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 removing_ids_.insert(download_id); 468 removing_ids_.insert(download_id);
466 } 469 }
467 470
468 void DownloadHistory::RemoveDownloadsBatch() { 471 void DownloadHistory::RemoveDownloadsBatch() {
469 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 472 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
470 IdSet remove_ids; 473 IdSet remove_ids;
471 removing_ids_.swap(remove_ids); 474 removing_ids_.swap(remove_ids);
472 history_->RemoveDownloads(remove_ids); 475 history_->RemoveDownloads(remove_ids);
473 FOR_EACH_OBSERVER(Observer, observers_, OnDownloadsRemoved(remove_ids)); 476 FOR_EACH_OBSERVER(Observer, observers_, OnDownloadsRemoved(remove_ids));
474 } 477 }
OLDNEW
« no previous file with comments | « chrome/browser/download/download_browsertest.cc ('k') | chrome/browser/download/download_history_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698