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 <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 } | 312 } |
313 | 313 |
314 void ChromeDownloadManagerDelegate::ChooseSavePath( | 314 void ChromeDownloadManagerDelegate::ChooseSavePath( |
315 WebContents* web_contents, | 315 WebContents* web_contents, |
316 const FilePath& suggested_path, | 316 const FilePath& suggested_path, |
317 const FilePath::StringType& default_extension, | 317 const FilePath::StringType& default_extension, |
318 bool can_save_as_complete, | 318 bool can_save_as_complete, |
319 content::SaveFilePathPickedCallback callback) { | 319 content::SaveFilePathPickedCallback callback) { |
320 // Deletes itself. | 320 // Deletes itself. |
321 #if defined(OS_CHROMEOS) | 321 #if defined(OS_CHROMEOS) |
322 // Note that we're ignoring the callback here. TODO(achuith): Fix this. | 322 // Note that we're ignoring the callback here. |
| 323 // SavePackageFilePickerChromeOS completes the save operation itself. |
| 324 // TODO(achuith): Fix this. |
323 new SavePackageFilePickerChromeOS(web_contents, suggested_path); | 325 new SavePackageFilePickerChromeOS(web_contents, suggested_path); |
324 #else | 326 #else |
325 new SavePackageFilePicker(web_contents, suggested_path, default_extension, | 327 new SavePackageFilePicker(web_contents, suggested_path, default_extension, |
326 can_save_as_complete, download_prefs_.get(), callback); | 328 can_save_as_complete, download_prefs_.get(), callback); |
327 #endif | 329 #endif |
328 } | 330 } |
329 | 331 |
330 #if defined(ENABLE_SAFE_BROWSING) | 332 #if defined(ENABLE_SAFE_BROWSING) |
331 DownloadProtectionService* | 333 DownloadProtectionService* |
332 ChromeDownloadManagerDelegate::GetDownloadProtectionService() { | 334 ChromeDownloadManagerDelegate::GetDownloadProtectionService() { |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 int32 download_id, int64 db_handle) { | 641 int32 download_id, int64 db_handle) { |
640 // It's not immediately obvious, but HistoryBackend::CreateDownload() can | 642 // It's not immediately obvious, but HistoryBackend::CreateDownload() can |
641 // call this function with an invalid |db_handle|. For instance, this can | 643 // call this function with an invalid |db_handle|. For instance, this can |
642 // happen when the history database is offline. We cannot have multiple | 644 // happen when the history database is offline. We cannot have multiple |
643 // DownloadItems with the same invalid db_handle, so we need to assign a | 645 // DownloadItems with the same invalid db_handle, so we need to assign a |
644 // unique |db_handle| here. | 646 // unique |db_handle| here. |
645 if (db_handle == DownloadItem::kUninitializedHandle) | 647 if (db_handle == DownloadItem::kUninitializedHandle) |
646 db_handle = download_history_->GetNextFakeDbHandle(); | 648 db_handle = download_history_->GetNextFakeDbHandle(); |
647 download_manager_->OnItemAddedToPersistentStore(download_id, db_handle); | 649 download_manager_->OnItemAddedToPersistentStore(download_id, db_handle); |
648 } | 650 } |
OLD | NEW |