| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/download_manager.h" | 5 #include "chrome/browser/download/download_manager.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 contents ? GetAncestor(contents->GetNativeView(), GA_ROOT) : NULL; | 640 contents ? GetAncestor(contents->GetNativeView(), GA_ROOT) : NULL; |
| 641 #elif defined(OS_LINUX) | 641 #elif defined(OS_LINUX) |
| 642 std::wstring filter; | 642 std::wstring filter; |
| 643 gfx::NativeWindow owning_window = contents ? | 643 gfx::NativeWindow owning_window = contents ? |
| 644 GTK_WINDOW(gtk_widget_get_toplevel(contents->GetNativeView())) : | 644 GTK_WINDOW(gtk_widget_get_toplevel(contents->GetNativeView())) : |
| 645 NULL; | 645 NULL; |
| 646 #endif | 646 #endif |
| 647 select_file_dialog_->SelectFile(SelectFileDialog::SELECT_SAVEAS_FILE, | 647 select_file_dialog_->SelectFile(SelectFileDialog::SELECT_SAVEAS_FILE, |
| 648 std::wstring(), | 648 std::wstring(), |
| 649 info->suggested_path.ToWStringHack(), | 649 info->suggested_path.ToWStringHack(), |
| 650 filter, std::wstring(), | 650 filter, 0, std::wstring(), |
| 651 owning_window, info); | 651 owning_window, info); |
| 652 } else { | 652 } else { |
| 653 // No prompting for download, just continue with the suggested name. | 653 // No prompting for download, just continue with the suggested name. |
| 654 ContinueStartDownload(info, info->suggested_path); | 654 ContinueStartDownload(info, info->suggested_path); |
| 655 } | 655 } |
| 656 #elif defined(OS_MACOSX) | 656 #elif defined(OS_MACOSX) |
| 657 // TODO(port): port this file -- need dialogs. | 657 // TODO(port): port this file -- need dialogs. |
| 658 NOTIMPLEMENTED(); | 658 NOTIMPLEMENTED(); |
| 659 #endif | 659 #endif |
| 660 } | 660 } |
| (...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1290 extensions_w = extensions; | 1290 extensions_w = extensions; |
| 1291 #elif defined(OS_POSIX) | 1291 #elif defined(OS_POSIX) |
| 1292 extensions_w = base::SysNativeMBToWide(extensions); | 1292 extensions_w = base::SysNativeMBToWide(extensions); |
| 1293 #endif | 1293 #endif |
| 1294 | 1294 |
| 1295 prefs->SetString(prefs::kDownloadExtensionsToOpen, extensions_w); | 1295 prefs->SetString(prefs::kDownloadExtensionsToOpen, extensions_w); |
| 1296 } | 1296 } |
| 1297 } | 1297 } |
| 1298 | 1298 |
| 1299 void DownloadManager::FileSelected(const std::wstring& path_string, | 1299 void DownloadManager::FileSelected(const std::wstring& path_string, |
| 1300 void* params) { | 1300 int index, void* params) { |
| 1301 FilePath path = FilePath::FromWStringHack(path_string); | 1301 FilePath path = FilePath::FromWStringHack(path_string); |
| 1302 DownloadCreateInfo* info = reinterpret_cast<DownloadCreateInfo*>(params); | 1302 DownloadCreateInfo* info = reinterpret_cast<DownloadCreateInfo*>(params); |
| 1303 if (info->save_as) | 1303 if (info->save_as) |
| 1304 last_download_path_ = path.DirName(); | 1304 last_download_path_ = path.DirName(); |
| 1305 ContinueStartDownload(info, path); | 1305 ContinueStartDownload(info, path); |
| 1306 } | 1306 } |
| 1307 | 1307 |
| 1308 void DownloadManager::FileSelectionCanceled(void* params) { | 1308 void DownloadManager::FileSelectionCanceled(void* params) { |
| 1309 // The user didn't pick a place to save the file, so need to cancel the | 1309 // The user didn't pick a place to save the file, so need to cancel the |
| 1310 // download that's already in progress to the temporary location. | 1310 // download that's already in progress to the temporary location. |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1446 searched_downloads.push_back(dit->second); | 1446 searched_downloads.push_back(dit->second); |
| 1447 } | 1447 } |
| 1448 | 1448 |
| 1449 requestor->SetDownloads(searched_downloads); | 1449 requestor->SetDownloads(searched_downloads); |
| 1450 } | 1450 } |
| 1451 | 1451 |
| 1452 // Clears the last download path, used to initialize "save as" dialogs. | 1452 // Clears the last download path, used to initialize "save as" dialogs. |
| 1453 void DownloadManager::ClearLastDownloadPath() { | 1453 void DownloadManager::ClearLastDownloadPath() { |
| 1454 last_download_path_ = FilePath(); | 1454 last_download_path_ = FilePath(); |
| 1455 } | 1455 } |
| OLD | NEW |