| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 DownloadStateInfo state) { | 93 DownloadStateInfo state) { |
| 94 DownloadItem* download = | 94 DownloadItem* download = |
| 95 download_manager_->GetActiveDownloadItem(download_id); | 95 download_manager_->GetActiveDownloadItem(download_id); |
| 96 if (!download) | 96 if (!download) |
| 97 return; | 97 return; |
| 98 download->SetFileCheckResults(state); | 98 download->SetFileCheckResults(state); |
| 99 download_manager_->RestartDownload(download_id); | 99 download_manager_->RestartDownload(download_id); |
| 100 } | 100 } |
| 101 | 101 |
| 102 void ShellDownloadManagerDelegate::ChooseDownloadPath( | 102 void ShellDownloadManagerDelegate::ChooseDownloadPath( |
| 103 TabContents* tab_contents, | 103 WebContents* web_contents, |
| 104 const FilePath& suggested_path, | 104 const FilePath& suggested_path, |
| 105 void* data) { | 105 void* data) { |
| 106 FilePath result; | 106 FilePath result; |
| 107 #if defined(OS_WIN) | 107 #if defined(OS_WIN) |
| 108 std::wstring file_part = FilePath(suggested_path).BaseName().value(); | 108 std::wstring file_part = FilePath(suggested_path).BaseName().value(); |
| 109 wchar_t file_name[MAX_PATH]; | 109 wchar_t file_name[MAX_PATH]; |
| 110 base::wcslcpy(file_name, file_part.c_str(), arraysize(file_name)); | 110 base::wcslcpy(file_name, file_part.c_str(), arraysize(file_name)); |
| 111 OPENFILENAME save_as; | 111 OPENFILENAME save_as; |
| 112 ZeroMemory(&save_as, sizeof(save_as)); | 112 ZeroMemory(&save_as, sizeof(save_as)); |
| 113 save_as.lStructSize = sizeof(OPENFILENAME); | 113 save_as.lStructSize = sizeof(OPENFILENAME); |
| 114 save_as.hwndOwner = tab_contents->GetNativeView(); | 114 save_as.hwndOwner = web_contents->GetNativeView(); |
| 115 save_as.lpstrFile = file_name; | 115 save_as.lpstrFile = file_name; |
| 116 save_as.nMaxFile = arraysize(file_name); | 116 save_as.nMaxFile = arraysize(file_name); |
| 117 | 117 |
| 118 std::wstring directory; | 118 std::wstring directory; |
| 119 if (!suggested_path.empty()) | 119 if (!suggested_path.empty()) |
| 120 directory = suggested_path.DirName().value(); | 120 directory = suggested_path.DirName().value(); |
| 121 | 121 |
| 122 save_as.lpstrInitialDir = directory.c_str(); | 122 save_as.lpstrInitialDir = directory.c_str(); |
| 123 save_as.Flags = OFN_OVERWRITEPROMPT | OFN_EXPLORER | OFN_ENABLESIZING | | 123 save_as.Flags = OFN_OVERWRITEPROMPT | OFN_EXPLORER | OFN_ENABLESIZING | |
| 124 OFN_NOCHANGEDIR | OFN_PATHMUSTEXIST; | 124 OFN_NOCHANGEDIR | OFN_PATHMUSTEXIST; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 136 } | 136 } |
| 137 } | 137 } |
| 138 | 138 |
| 139 bool ShellDownloadManagerDelegate::OverrideIntermediatePath( | 139 bool ShellDownloadManagerDelegate::OverrideIntermediatePath( |
| 140 DownloadItem* item, | 140 DownloadItem* item, |
| 141 FilePath* intermediate_path) { | 141 FilePath* intermediate_path) { |
| 142 return false; | 142 return false; |
| 143 } | 143 } |
| 144 | 144 |
| 145 WebContents* ShellDownloadManagerDelegate:: | 145 WebContents* ShellDownloadManagerDelegate:: |
| 146 GetAlternativeTabContentsToNotifyForDownload() { | 146 GetAlternativeWebContentsToNotifyForDownload() { |
| 147 return NULL; | 147 return NULL; |
| 148 } | 148 } |
| 149 | 149 |
| 150 bool ShellDownloadManagerDelegate::ShouldOpenFileBasedOnExtension( | 150 bool ShellDownloadManagerDelegate::ShouldOpenFileBasedOnExtension( |
| 151 const FilePath& path) { | 151 const FilePath& path) { |
| 152 return false; | 152 return false; |
| 153 } | 153 } |
| 154 | 154 |
| 155 bool ShellDownloadManagerDelegate::ShouldCompleteDownload(DownloadItem* item) { | 155 bool ShellDownloadManagerDelegate::ShouldCompleteDownload(DownloadItem* item) { |
| 156 return true; | 156 return true; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 183 void ShellDownloadManagerDelegate::RemoveItemFromPersistentStore( | 183 void ShellDownloadManagerDelegate::RemoveItemFromPersistentStore( |
| 184 DownloadItem* item) { | 184 DownloadItem* item) { |
| 185 } | 185 } |
| 186 | 186 |
| 187 void ShellDownloadManagerDelegate::RemoveItemsFromPersistentStoreBetween( | 187 void ShellDownloadManagerDelegate::RemoveItemsFromPersistentStoreBetween( |
| 188 base::Time remove_begin, | 188 base::Time remove_begin, |
| 189 base::Time remove_end) { | 189 base::Time remove_end) { |
| 190 } | 190 } |
| 191 | 191 |
| 192 void ShellDownloadManagerDelegate::GetSaveDir( | 192 void ShellDownloadManagerDelegate::GetSaveDir( |
| 193 TabContents* tab_contents, | 193 WebContents* web_contents, |
| 194 FilePath* website_save_dir, | 194 FilePath* website_save_dir, |
| 195 FilePath* download_save_dir) { | 195 FilePath* download_save_dir) { |
| 196 } | 196 } |
| 197 | 197 |
| 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 |