| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/download/chrome_download_manager_delegate.h" | 5 #include "chrome/browser/download/chrome_download_manager_delegate.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/rand_util.h" | 10 #include "base/rand_util.h" |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 download_history_->UpdateEntry(item); | 191 download_history_->UpdateEntry(item); |
| 192 } | 192 } |
| 193 | 193 |
| 194 void ChromeDownloadManagerDelegate::UpdatePathForItemInPersistentStore( | 194 void ChromeDownloadManagerDelegate::UpdatePathForItemInPersistentStore( |
| 195 DownloadItem* item, | 195 DownloadItem* item, |
| 196 const FilePath& new_path) { | 196 const FilePath& new_path) { |
| 197 download_history_->UpdateDownloadPath(item, new_path); | 197 download_history_->UpdateDownloadPath(item, new_path); |
| 198 } | 198 } |
| 199 | 199 |
| 200 void ChromeDownloadManagerDelegate::RemoveItemFromPersistentStore( | 200 void ChromeDownloadManagerDelegate::RemoveItemFromPersistentStore( |
| 201 DownloadItem* item) { | 201 int64 db_handle) { |
| 202 download_history_->RemoveEntry(item); | 202 download_history_->RemoveEntry(db_handle); |
| 203 } | 203 } |
| 204 | 204 |
| 205 void ChromeDownloadManagerDelegate::RemoveItemsFromPersistentStoreBetween( | 205 void ChromeDownloadManagerDelegate::RemoveItemsFromPersistentStoreBetween( |
| 206 const base::Time remove_begin, | 206 const base::Time remove_begin, |
| 207 const base::Time remove_end) { | 207 const base::Time remove_end) { |
| 208 download_history_->RemoveEntriesBetween(remove_begin, remove_end); | 208 download_history_->RemoveEntriesBetween(remove_begin, remove_end); |
| 209 } | 209 } |
| 210 | 210 |
| 211 void ChromeDownloadManagerDelegate::GetSaveDir(TabContents* tab_contents, | 211 void ChromeDownloadManagerDelegate::GetSaveDir(TabContents* tab_contents, |
| 212 FilePath* website_save_dir, | 212 FilePath* website_save_dir, |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 int32 download_id, int64 db_handle) { | 504 int32 download_id, int64 db_handle) { |
| 505 // It's not immediately obvious, but HistoryBackend::CreateDownload() can | 505 // It's not immediately obvious, but HistoryBackend::CreateDownload() can |
| 506 // call this function with an invalid |db_handle|. For instance, this can | 506 // call this function with an invalid |db_handle|. For instance, this can |
| 507 // happen when the history database is offline. We cannot have multiple | 507 // happen when the history database is offline. We cannot have multiple |
| 508 // DownloadItems with the same invalid db_handle, so we need to assign a | 508 // DownloadItems with the same invalid db_handle, so we need to assign a |
| 509 // unique |db_handle| here. | 509 // unique |db_handle| here. |
| 510 if (db_handle == DownloadItem::kUninitializedHandle) | 510 if (db_handle == DownloadItem::kUninitializedHandle) |
| 511 db_handle = download_history_->GetNextFakeDbHandle(); | 511 db_handle = download_history_->GetNextFakeDbHandle(); |
| 512 download_manager_->OnItemAddedToPersistentStore(download_id, db_handle); | 512 download_manager_->OnItemAddedToPersistentStore(download_id, db_handle); |
| 513 } | 513 } |
| OLD | NEW |