| 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 #include "chrome/browser/history/history_backend.h" | 5 #include "chrome/browser/history/history_backend.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <list> | 9 #include <list> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 1294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1305 if (db_.get()) | 1305 if (db_.get()) |
| 1306 *id = db_->next_download_id(); | 1306 *id = db_->next_download_id(); |
| 1307 } | 1307 } |
| 1308 | 1308 |
| 1309 // Get all the download entries from the database. | 1309 // Get all the download entries from the database. |
| 1310 void HistoryBackend::QueryDownloads(std::vector<DownloadRow>* rows) { | 1310 void HistoryBackend::QueryDownloads(std::vector<DownloadRow>* rows) { |
| 1311 if (db_.get()) | 1311 if (db_.get()) |
| 1312 db_->QueryDownloads(rows); | 1312 db_->QueryDownloads(rows); |
| 1313 } | 1313 } |
| 1314 | 1314 |
| 1315 // Clean up entries that has been corrupted (because of the crash, for example). | |
| 1316 void HistoryBackend::CleanUpInProgressEntries() { | |
| 1317 // If some "in progress" entries were not updated when Chrome exited, they | |
| 1318 // need to be cleaned up. | |
| 1319 if (!db_.get()) | |
| 1320 return; | |
| 1321 db_->CleanUpInProgressEntries(); | |
| 1322 ScheduleCommit(); | |
| 1323 } | |
| 1324 | |
| 1325 // Update a particular download entry. | 1315 // Update a particular download entry. |
| 1326 void HistoryBackend::UpdateDownload(const history::DownloadRow& data) { | 1316 void HistoryBackend::UpdateDownload(const history::DownloadRow& data) { |
| 1327 if (!db_.get()) | 1317 if (!db_.get()) |
| 1328 return; | 1318 return; |
| 1329 db_->UpdateDownload(data); | 1319 db_->UpdateDownload(data); |
| 1330 ScheduleCommit(); | 1320 ScheduleCommit(); |
| 1331 } | 1321 } |
| 1332 | 1322 |
| 1333 void HistoryBackend::CreateDownload(const history::DownloadRow& history_info, | 1323 void HistoryBackend::CreateDownload(const history::DownloadRow& history_info, |
| 1334 int64* db_handle) { | 1324 int64* db_handle) { |
| (...skipping 1736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3071 info.url_id = visit.url_id; | 3061 info.url_id = visit.url_id; |
| 3072 info.time = visit.visit_time; | 3062 info.time = visit.visit_time; |
| 3073 info.transition = visit.transition; | 3063 info.transition = visit.transition; |
| 3074 // If we don't have a delegate yet during setup or shutdown, we will drop | 3064 // If we don't have a delegate yet during setup or shutdown, we will drop |
| 3075 // these notifications. | 3065 // these notifications. |
| 3076 if (delegate_.get()) | 3066 if (delegate_.get()) |
| 3077 delegate_->NotifyVisitDBObserversOnAddVisit(info); | 3067 delegate_->NotifyVisitDBObserversOnAddVisit(info); |
| 3078 } | 3068 } |
| 3079 | 3069 |
| 3080 } // namespace history | 3070 } // namespace history |
| OLD | NEW |