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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 new extensions::DownloadedByExtension( | 308 new extensions::DownloadedByExtension( |
309 item, it->by_ext_id, it->by_ext_name); | 309 item, it->by_ext_id, it->by_ext_name); |
310 item->UpdateObservers(); | 310 item->UpdateObservers(); |
311 } | 311 } |
312 #endif | 312 #endif |
313 DCHECK_EQ(DownloadHistoryData::PERSISTED, | 313 DCHECK_EQ(DownloadHistoryData::PERSISTED, |
314 DownloadHistoryData::Get(item)->state()); | 314 DownloadHistoryData::Get(item)->state()); |
315 ++history_size_; | 315 ++history_size_; |
316 } | 316 } |
317 notifier_.GetManager()->CheckForHistoryFilesRemoval(); | 317 notifier_.GetManager()->CheckForHistoryFilesRemoval(); |
| 318 notifier_.GetManager()->PostInitialization(); |
318 | 319 |
319 initial_history_query_complete_ = true; | 320 initial_history_query_complete_ = true; |
320 for (Observer& observer : observers_) | 321 for (Observer& observer : observers_) |
321 observer.OnHistoryQueryComplete(); | 322 observer.OnHistoryQueryComplete(); |
322 } | 323 } |
323 | 324 |
324 void DownloadHistory::MaybeAddToHistory(content::DownloadItem* item) { | 325 void DownloadHistory::MaybeAddToHistory(content::DownloadItem* item) { |
325 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 326 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
326 | 327 |
327 uint32_t download_id = item->GetId(); | 328 uint32_t download_id = item->GetId(); |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 } | 498 } |
498 | 499 |
499 void DownloadHistory::RemoveDownloadsBatch() { | 500 void DownloadHistory::RemoveDownloadsBatch() { |
500 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 501 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
501 IdSet remove_ids; | 502 IdSet remove_ids; |
502 removing_ids_.swap(remove_ids); | 503 removing_ids_.swap(remove_ids); |
503 history_->RemoveDownloads(remove_ids); | 504 history_->RemoveDownloads(remove_ids); |
504 for (Observer& observer : observers_) | 505 for (Observer& observer : observers_) |
505 observer.OnDownloadsRemoved(remove_ids); | 506 observer.OnDownloadsRemoved(remove_ids); |
506 } | 507 } |
OLD | NEW |