| 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 CheckDownloadUrlDone(download_id, DownloadProtectionService::SAFE); | 147 CheckDownloadUrlDone(download_id, DownloadProtectionService::SAFE); |
| 148 return false; | 148 return false; |
| 149 } | 149 } |
| 150 | 150 |
| 151 void ChromeDownloadManagerDelegate::ChooseDownloadPath( | 151 void ChromeDownloadManagerDelegate::ChooseDownloadPath( |
| 152 WebContents* web_contents, | 152 WebContents* web_contents, |
| 153 const FilePath& suggested_path, | 153 const FilePath& suggested_path, |
| 154 int32 download_id) { | 154 int32 download_id) { |
| 155 // Deletes itself. | 155 // Deletes itself. |
| 156 #if defined(OS_CHROMEOS) | 156 #if defined(OS_CHROMEOS) |
| 157 new DownloadFilePickerChromeOS( | 157 new DownloadFilePickerChromeOS |
| 158 #else | 158 #else |
| 159 new DownloadFilePicker( | 159 new DownloadFilePicker |
| 160 #endif | 160 #endif |
| 161 download_manager_, web_contents, suggested_path, download_id); | 161 (download_manager_, web_contents, suggested_path, download_id); |
| 162 } | 162 } |
| 163 | 163 |
| 164 FilePath ChromeDownloadManagerDelegate::GetIntermediatePath( | 164 FilePath ChromeDownloadManagerDelegate::GetIntermediatePath( |
| 165 const FilePath& suggested_path) { | 165 const FilePath& suggested_path) { |
| 166 return download_util::GetCrDownloadPath(suggested_path); | 166 return download_util::GetCrDownloadPath(suggested_path); |
| 167 } | 167 } |
| 168 | 168 |
| 169 WebContents* ChromeDownloadManagerDelegate:: | 169 WebContents* ChromeDownloadManagerDelegate:: |
| 170 GetAlternativeWebContentsToNotifyForDownload() { | 170 GetAlternativeWebContentsToNotifyForDownload() { |
| 171 #if defined(OS_ANDROID) | 171 #if defined(OS_ANDROID) |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 } | 368 } |
| 369 | 369 |
| 370 void ChromeDownloadManagerDelegate::ChooseSavePath( | 370 void ChromeDownloadManagerDelegate::ChooseSavePath( |
| 371 WebContents* web_contents, | 371 WebContents* web_contents, |
| 372 const FilePath& suggested_path, | 372 const FilePath& suggested_path, |
| 373 const FilePath::StringType& default_extension, | 373 const FilePath::StringType& default_extension, |
| 374 bool can_save_as_complete, | 374 bool can_save_as_complete, |
| 375 content::SaveFilePathPickedCallback callback) { | 375 content::SaveFilePathPickedCallback callback) { |
| 376 // Deletes itself. | 376 // Deletes itself. |
| 377 #if defined(OS_CHROMEOS) | 377 #if defined(OS_CHROMEOS) |
| 378 // Note that we're ignoring the callback here. | 378 new SavePackageFilePickerChromeOS(web_contents, suggested_path, callback); |
| 379 // SavePackageFilePickerChromeOS completes the save operation itself. | |
| 380 // TODO(achuith): Fix this. | |
| 381 new SavePackageFilePickerChromeOS(web_contents, suggested_path); | |
| 382 #else | 379 #else |
| 383 new SavePackageFilePicker(web_contents, suggested_path, default_extension, | 380 new SavePackageFilePicker(web_contents, suggested_path, default_extension, |
| 384 can_save_as_complete, download_prefs_.get(), callback); | 381 can_save_as_complete, download_prefs_.get(), callback); |
| 385 #endif | 382 #endif |
| 386 } | 383 } |
| 387 | 384 |
| 388 #if defined(ENABLE_SAFE_BROWSING) | 385 #if defined(ENABLE_SAFE_BROWSING) |
| 389 DownloadProtectionService* | 386 DownloadProtectionService* |
| 390 ChromeDownloadManagerDelegate::GetDownloadProtectionService() { | 387 ChromeDownloadManagerDelegate::GetDownloadProtectionService() { |
| 391 SafeBrowsingService* sb_service = g_browser_process->safe_browsing_service(); | 388 SafeBrowsingService* sb_service = g_browser_process->safe_browsing_service(); |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 697 int32 download_id, int64 db_handle) { | 694 int32 download_id, int64 db_handle) { |
| 698 // It's not immediately obvious, but HistoryBackend::CreateDownload() can | 695 // It's not immediately obvious, but HistoryBackend::CreateDownload() can |
| 699 // call this function with an invalid |db_handle|. For instance, this can | 696 // call this function with an invalid |db_handle|. For instance, this can |
| 700 // happen when the history database is offline. We cannot have multiple | 697 // happen when the history database is offline. We cannot have multiple |
| 701 // DownloadItems with the same invalid db_handle, so we need to assign a | 698 // DownloadItems with the same invalid db_handle, so we need to assign a |
| 702 // unique |db_handle| here. | 699 // unique |db_handle| here. |
| 703 if (db_handle == DownloadItem::kUninitializedHandle) | 700 if (db_handle == DownloadItem::kUninitializedHandle) |
| 704 db_handle = download_history_->GetNextFakeDbHandle(); | 701 db_handle = download_history_->GetNextFakeDbHandle(); |
| 705 download_manager_->OnItemAddedToPersistentStore(download_id, db_handle); | 702 download_manager_->OnItemAddedToPersistentStore(download_id, db_handle); |
| 706 } | 703 } |
| OLD | NEW |