| 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 "content/shell/shell_download_manager_delegate.h" | 5 #include "content/shell/shell_download_manager_delegate.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 #include <commdlg.h> | 9 #include <commdlg.h> |
| 10 #endif | 10 #endif |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 DownloadManager* download_manager) { | 35 DownloadManager* download_manager) { |
| 36 download_manager_ = download_manager; | 36 download_manager_ = download_manager; |
| 37 } | 37 } |
| 38 | 38 |
| 39 void ShellDownloadManagerDelegate::Shutdown() { | 39 void ShellDownloadManagerDelegate::Shutdown() { |
| 40 } | 40 } |
| 41 | 41 |
| 42 bool ShellDownloadManagerDelegate::ShouldStartDownload(int32 download_id) { | 42 bool ShellDownloadManagerDelegate::ShouldStartDownload(int32 download_id) { |
| 43 DownloadItem* download = | 43 DownloadItem* download = |
| 44 download_manager_->GetActiveDownloadItem(download_id); | 44 download_manager_->GetActiveDownloadItem(download_id); |
| 45 DownloadStateInfo state = download->state_info(); | 45 DownloadStateInfo state = download->GetStateInfo(); |
| 46 | 46 |
| 47 if (!state.force_file_name.empty()) | 47 if (!state.force_file_name.empty()) |
| 48 return true; | 48 return true; |
| 49 | 49 |
| 50 FilePath generated_name = net::GenerateFileName( | 50 FilePath generated_name = net::GenerateFileName( |
| 51 download->GetURL(), | 51 download->GetURL(), |
| 52 download->content_disposition(), | 52 download->GetContentDisposition(), |
| 53 download->referrer_charset(), | 53 download->GetReferrerCharset(), |
| 54 download->suggested_filename(), | 54 download->GetSuggestedFilename(), |
| 55 download->mime_type(), | 55 download->GetMimeType(), |
| 56 "download"); | 56 "download"); |
| 57 | 57 |
| 58 // Since we have no download UI, show the user a dialog always. | 58 // Since we have no download UI, show the user a dialog always. |
| 59 state.prompt_user_for_save_location = true; | 59 state.prompt_user_for_save_location = true; |
| 60 | 60 |
| 61 BrowserThread::PostTask( | 61 BrowserThread::PostTask( |
| 62 BrowserThread::FILE, | 62 BrowserThread::FILE, |
| 63 FROM_HERE, | 63 FROM_HERE, |
| 64 base::Bind( | 64 base::Bind( |
| 65 &ShellDownloadManagerDelegate::GenerateFilename, | 65 &ShellDownloadManagerDelegate::GenerateFilename, |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 void ShellDownloadManagerDelegate::ChooseSavePath( | 198 void ShellDownloadManagerDelegate::ChooseSavePath( |
| 199 const base::WeakPtr<SavePackage>& save_package, | 199 const base::WeakPtr<SavePackage>& save_package, |
| 200 const FilePath& suggested_path, | 200 const FilePath& suggested_path, |
| 201 bool can_save_as_complete) { | 201 bool can_save_as_complete) { |
| 202 } | 202 } |
| 203 | 203 |
| 204 void ShellDownloadManagerDelegate::DownloadProgressUpdated() { | 204 void ShellDownloadManagerDelegate::DownloadProgressUpdated() { |
| 205 } | 205 } |
| 206 | 206 |
| 207 } // namespace content | 207 } // namespace content |
| OLD | NEW |