OLD | NEW |
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 13 matching lines...) Expand all Loading... |
24 // DownloadHistory to prevent use-after-free bugs. | 24 // DownloadHistory to prevent use-after-free bugs. |
25 // ChromeDownloadManagerDelegate owns DownloadHistory, and deletes it in | 25 // ChromeDownloadManagerDelegate owns DownloadHistory, and deletes it in |
26 // Shutdown(), which is called by DownloadManagerImpl::Shutdown() after all | 26 // Shutdown(), which is called by DownloadManagerImpl::Shutdown() after all |
27 // DownloadItems are destroyed. | 27 // DownloadItems are destroyed. |
28 | 28 |
29 #include "chrome/browser/download/download_history.h" | 29 #include "chrome/browser/download/download_history.h" |
30 | 30 |
31 #include <utility> | 31 #include <utility> |
32 | 32 |
33 #include "base/macros.h" | 33 #include "base/macros.h" |
34 #include "base/metrics/histogram.h" | 34 #include "base/metrics/histogram_macros.h" |
35 #include "chrome/browser/download/download_crx_util.h" | 35 #include "chrome/browser/download/download_crx_util.h" |
36 #include "components/history/content/browser/download_constants_utils.h" | 36 #include "components/history/content/browser/download_constants_utils.h" |
37 #include "components/history/core/browser/download_database.h" | 37 #include "components/history/core/browser/download_database.h" |
38 #include "components/history/core/browser/download_row.h" | 38 #include "components/history/core/browser/download_row.h" |
39 #include "components/history/core/browser/history_service.h" | 39 #include "components/history/core/browser/history_service.h" |
40 #include "content/public/browser/browser_thread.h" | 40 #include "content/public/browser/browser_thread.h" |
41 #include "content/public/browser/download_item.h" | 41 #include "content/public/browser/download_item.h" |
42 #include "content/public/browser/download_manager.h" | 42 #include "content/public/browser/download_manager.h" |
43 | 43 |
44 #if defined(ENABLE_EXTENSIONS) | 44 #if defined(ENABLE_EXTENSIONS) |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 removing_ids_.insert(download_id); | 460 removing_ids_.insert(download_id); |
461 } | 461 } |
462 | 462 |
463 void DownloadHistory::RemoveDownloadsBatch() { | 463 void DownloadHistory::RemoveDownloadsBatch() { |
464 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 464 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
465 IdSet remove_ids; | 465 IdSet remove_ids; |
466 removing_ids_.swap(remove_ids); | 466 removing_ids_.swap(remove_ids); |
467 history_->RemoveDownloads(remove_ids); | 467 history_->RemoveDownloads(remove_ids); |
468 FOR_EACH_OBSERVER(Observer, observers_, OnDownloadsRemoved(remove_ids)); | 468 FOR_EACH_OBSERVER(Observer, observers_, OnDownloadsRemoved(remove_ids)); |
469 } | 469 } |
OLD | NEW |