Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 634 if (info->save_as) { | 634 if (info->save_as) { |
| 635 // We must ask the user for the place to put the download. | 635 // We must ask the user for the place to put the download. |
| 636 if (!select_file_dialog_.get()) | 636 if (!select_file_dialog_.get()) |
| 637 select_file_dialog_ = SelectFileDialog::Create(this); | 637 select_file_dialog_ = SelectFileDialog::Create(this); |
| 638 | 638 |
| 639 WebContents* contents = tab_util::GetWebContentsByID( | 639 WebContents* contents = tab_util::GetWebContentsByID( |
| 640 info->render_process_id, info->render_view_id); | 640 info->render_process_id, info->render_view_id); |
| 641 SelectFileDialog::FileTypeInfo file_type_info; | 641 SelectFileDialog::FileTypeInfo file_type_info; |
| 642 file_type_info.extensions.resize(1); | 642 file_type_info.extensions.resize(1); |
| 643 file_type_info.extensions[0].push_back(info->suggested_path.Extension()); | 643 file_type_info.extensions[0].push_back(info->suggested_path.Extension()); |
| 644 if (!file_type_info.extensions[0][0].empty()) | |
| 645 file_type_info.extensions[0][0].erase(0, 1); // drop the . | |
|
scherkus (not reviewing)
2009/04/17 19:45:07
wait.. would it make sense to DCHECK this?
".txt"
| |
| 644 file_type_info.include_all_files = true; | 646 file_type_info.include_all_files = true; |
| 645 gfx::NativeWindow owning_window = | 647 gfx::NativeWindow owning_window = |
| 646 contents ? platform_util::GetTopLevel(contents->GetNativeView()) : NULL; | 648 contents ? platform_util::GetTopLevel(contents->GetNativeView()) : NULL; |
| 647 select_file_dialog_->SelectFile(SelectFileDialog::SELECT_SAVEAS_FILE, | 649 select_file_dialog_->SelectFile(SelectFileDialog::SELECT_SAVEAS_FILE, |
| 648 string16(), | 650 string16(), |
| 649 info->suggested_path, | 651 info->suggested_path, |
| 650 &file_type_info, 0, FILE_PATH_LITERAL(""), | 652 &file_type_info, 0, FILE_PATH_LITERAL(""), |
| 651 owning_window, info); | 653 owning_window, info); |
| 652 } else { | 654 } else { |
| 653 // No prompting for download, just continue with the suggested name. | 655 // No prompting for download, just continue with the suggested name. |
| (...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1490 searched_downloads.push_back(dit->second); | 1492 searched_downloads.push_back(dit->second); |
| 1491 } | 1493 } |
| 1492 | 1494 |
| 1493 requestor->SetDownloads(searched_downloads); | 1495 requestor->SetDownloads(searched_downloads); |
| 1494 } | 1496 } |
| 1495 | 1497 |
| 1496 // Clears the last download path, used to initialize "save as" dialogs. | 1498 // Clears the last download path, used to initialize "save as" dialogs. |
| 1497 void DownloadManager::ClearLastDownloadPath() { | 1499 void DownloadManager::ClearLastDownloadPath() { |
| 1498 last_download_path_ = FilePath(); | 1500 last_download_path_ = FilePath(); |
| 1499 } | 1501 } |
| OLD | NEW |