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/download/chrome_download_manager_delegate.h" | 5 #include "chrome/browser/download/chrome_download_manager_delegate.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 return false; | 129 return false; |
130 } | 130 } |
131 #endif | 131 #endif |
132 CheckDownloadUrlDone(download_id, DownloadProtectionService::SAFE); | 132 CheckDownloadUrlDone(download_id, DownloadProtectionService::SAFE); |
133 return false; | 133 return false; |
134 } | 134 } |
135 | 135 |
136 void ChromeDownloadManagerDelegate::ChooseDownloadPath( | 136 void ChromeDownloadManagerDelegate::ChooseDownloadPath( |
137 WebContents* web_contents, | 137 WebContents* web_contents, |
138 const FilePath& suggested_path, | 138 const FilePath& suggested_path, |
139 void* data) { | 139 int32 download_id) { |
140 // Deletes itself. | 140 // Deletes itself. |
141 new DownloadFilePicker( | 141 new DownloadFilePicker( |
142 download_manager_, web_contents, suggested_path, data); | 142 download_manager_, web_contents, suggested_path, download_id); |
143 } | 143 } |
144 | 144 |
145 FilePath ChromeDownloadManagerDelegate::GetIntermediatePath( | 145 FilePath ChromeDownloadManagerDelegate::GetIntermediatePath( |
146 const FilePath& suggested_path) { | 146 const FilePath& suggested_path) { |
147 return download_util::GetCrDownloadPath(suggested_path); | 147 return download_util::GetCrDownloadPath(suggested_path); |
148 } | 148 } |
149 | 149 |
150 WebContents* ChromeDownloadManagerDelegate:: | 150 WebContents* ChromeDownloadManagerDelegate:: |
151 GetAlternativeWebContentsToNotifyForDownload() { | 151 GetAlternativeWebContentsToNotifyForDownload() { |
152 // Start the download in the last active browser. This is not ideal but better | 152 // Start the download in the last active browser. This is not ideal but better |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 int32 download_id, int64 db_handle) { | 591 int32 download_id, int64 db_handle) { |
592 // It's not immediately obvious, but HistoryBackend::CreateDownload() can | 592 // It's not immediately obvious, but HistoryBackend::CreateDownload() can |
593 // call this function with an invalid |db_handle|. For instance, this can | 593 // call this function with an invalid |db_handle|. For instance, this can |
594 // happen when the history database is offline. We cannot have multiple | 594 // happen when the history database is offline. We cannot have multiple |
595 // DownloadItems with the same invalid db_handle, so we need to assign a | 595 // DownloadItems with the same invalid db_handle, so we need to assign a |
596 // unique |db_handle| here. | 596 // unique |db_handle| here. |
597 if (db_handle == DownloadItem::kUninitializedHandle) | 597 if (db_handle == DownloadItem::kUninitializedHandle) |
598 db_handle = download_history_->GetNextFakeDbHandle(); | 598 db_handle = download_history_->GetNextFakeDbHandle(); |
599 download_manager_->OnItemAddedToPersistentStore(download_id, db_handle); | 599 download_manager_->OnItemAddedToPersistentStore(download_id, db_handle); |
600 } | 600 } |
OLD | NEW |