| 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 job information. |
| 145 std::vector<history::DownloadJobInfo>()); |
| 144 } | 146 } |
| 145 | 147 |
| 146 enum class ShouldUpdateHistoryResult { | 148 enum class ShouldUpdateHistoryResult { |
| 147 NO, | 149 NO, |
| 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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 } | 490 } |
| 489 | 491 |
| 490 void DownloadHistory::RemoveDownloadsBatch() { | 492 void DownloadHistory::RemoveDownloadsBatch() { |
| 491 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 493 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 492 IdSet remove_ids; | 494 IdSet remove_ids; |
| 493 removing_ids_.swap(remove_ids); | 495 removing_ids_.swap(remove_ids); |
| 494 history_->RemoveDownloads(remove_ids); | 496 history_->RemoveDownloads(remove_ids); |
| 495 for (Observer& observer : observers_) | 497 for (Observer& observer : observers_) |
| 496 observer.OnDownloadsRemoved(remove_ids); | 498 observer.OnDownloadsRemoved(remove_ids); |
| 497 } | 499 } |
| OLD | NEW |