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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 item->GetTabReferrerUrl(), | 133 item->GetTabReferrerUrl(), |
134 std::string(), // HTTP method (not available yet) | 134 std::string(), // HTTP method (not available yet) |
135 item->GetMimeType(), item->GetOriginalMimeType(), item->GetStartTime(), | 135 item->GetMimeType(), item->GetOriginalMimeType(), item->GetStartTime(), |
136 item->GetEndTime(), item->GetETag(), item->GetLastModifiedTime(), | 136 item->GetEndTime(), item->GetETag(), item->GetLastModifiedTime(), |
137 item->GetReceivedBytes(), item->GetTotalBytes(), | 137 item->GetReceivedBytes(), item->GetTotalBytes(), |
138 history::ToHistoryDownloadState(item->GetState()), | 138 history::ToHistoryDownloadState(item->GetState()), |
139 history::ToHistoryDownloadDangerType(item->GetDangerType()), | 139 history::ToHistoryDownloadDangerType(item->GetDangerType()), |
140 history::ToHistoryDownloadInterruptReason(item->GetLastReason()), | 140 history::ToHistoryDownloadInterruptReason(item->GetLastReason()), |
141 std::string(), // Hash value (not available yet) | 141 std::string(), // Hash value (not available yet) |
142 history::ToHistoryDownloadId(item->GetId()), item->GetGuid(), | 142 history::ToHistoryDownloadId(item->GetId()), item->GetGuid(), |
143 item->GetOpened(), by_ext_id, by_ext_name); | 143 item->GetOpened(), by_ext_id, by_ext_name, |
| 144 // TODO(qinmin): get the slice information. |
| 145 std::vector<history::DownloadSliceInfo>()); |
144 } | 146 } |
145 | 147 |
146 enum class ShouldUpdateHistoryResult { | 148 enum class ShouldUpdateHistoryResult { |
147 NO_UPDATE, | 149 NO_UPDATE, |
148 UPDATE, | 150 UPDATE, |
149 UPDATE_IMMEDIATELY, | 151 UPDATE_IMMEDIATELY, |
150 }; | 152 }; |
151 | 153 |
152 ShouldUpdateHistoryResult ShouldUpdateHistory( | 154 ShouldUpdateHistoryResult ShouldUpdateHistory( |
153 const history::DownloadRow* previous, | 155 const history::DownloadRow* previous, |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 } | 491 } |
490 | 492 |
491 void DownloadHistory::RemoveDownloadsBatch() { | 493 void DownloadHistory::RemoveDownloadsBatch() { |
492 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 494 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
493 IdSet remove_ids; | 495 IdSet remove_ids; |
494 removing_ids_.swap(remove_ids); | 496 removing_ids_.swap(remove_ids); |
495 history_->RemoveDownloads(remove_ids); | 497 history_->RemoveDownloads(remove_ids); |
496 for (Observer& observer : observers_) | 498 for (Observer& observer : observers_) |
497 observer.OnDownloadsRemoved(remove_ids); | 499 observer.OnDownloadsRemoved(remove_ids); |
498 } | 500 } |
OLD | NEW |