Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(184)

Side by Side Diff: chrome/browser/download/download_manager.cc

Issue 459008: Mac: the return of the tab-modal-sheets patch. (Closed)
Patch Set: Merged ToT. Must ... commit ... soon. Created 11 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/cocoa/tab_strip_controller.mm ('k') | chrome/browser/download/save_package.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 select_file_dialog_ = SelectFileDialog::Create(this); 653 select_file_dialog_ = SelectFileDialog::Create(this);
654 654
655 TabContents* contents = tab_util::GetTabContentsByID(info->child_id, 655 TabContents* contents = tab_util::GetTabContentsByID(info->child_id,
656 info->render_view_id); 656 info->render_view_id);
657 SelectFileDialog::FileTypeInfo file_type_info; 657 SelectFileDialog::FileTypeInfo file_type_info;
658 file_type_info.extensions.resize(1); 658 file_type_info.extensions.resize(1);
659 file_type_info.extensions[0].push_back(info->suggested_path.Extension()); 659 file_type_info.extensions[0].push_back(info->suggested_path.Extension());
660 if (!file_type_info.extensions[0][0].empty()) 660 if (!file_type_info.extensions[0][0].empty())
661 file_type_info.extensions[0][0].erase(0, 1); // drop the . 661 file_type_info.extensions[0][0].erase(0, 1); // drop the .
662 file_type_info.include_all_files = true; 662 file_type_info.include_all_files = true;
663 #if defined(OS_MACOSX)
664 // If |contents| is NULL, file selection should theoretically run modeless.
665 // FIXME(viettrungluu): But we don't actually currently support modeless
666 // file selection dialogs on Mac. Does this ever happen? Should it? Better
667 // dcheck it.
668 DCHECK(contents);
669 select_file_dialog_->SelectFileInTab(SelectFileDialog::SELECT_SAVEAS_FILE,
670 string16(),
671 info->suggested_path,
672 &file_type_info,
673 0,
674 FILE_PATH_LITERAL(""),
675 contents,
676 info);
677 #else
663 gfx::NativeWindow owning_window = 678 gfx::NativeWindow owning_window =
664 contents ? platform_util::GetTopLevel(contents->GetNativeView()) : NULL; 679 contents ? platform_util::GetTopLevel(contents->GetNativeView()) : NULL;
665 select_file_dialog_->SelectFile(SelectFileDialog::SELECT_SAVEAS_FILE, 680 select_file_dialog_->SelectFile(SelectFileDialog::SELECT_SAVEAS_FILE,
666 string16(), 681 string16(),
667 info->suggested_path, 682 info->suggested_path,
668 &file_type_info, 0, FILE_PATH_LITERAL(""), 683 &file_type_info, 0, FILE_PATH_LITERAL(""),
669 owning_window, info); 684 owning_window, info);
685 #endif
670 } else { 686 } else {
671 // No prompting for download, just continue with the suggested name. 687 // No prompting for download, just continue with the suggested name.
672 ContinueStartDownload(info, info->suggested_path); 688 ContinueStartDownload(info, info->suggested_path);
673 } 689 }
674 } 690 }
675 691
676 void DownloadManager::ContinueStartDownload(DownloadCreateInfo* info, 692 void DownloadManager::ContinueStartDownload(DownloadCreateInfo* info,
677 const FilePath& target_path) { 693 const FilePath& target_path) {
678 scoped_ptr<DownloadCreateInfo> infop(info); 694 scoped_ptr<DownloadCreateInfo> infop(info);
679 info->path = target_path; 695 info->path = target_path;
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after
1575 1591
1576 if (contents) 1592 if (contents)
1577 contents->OnStartDownload(download); 1593 contents->OnStartDownload(download);
1578 } 1594 }
1579 1595
1580 // Clears the last download path, used to initialize "save as" dialogs. 1596 // Clears the last download path, used to initialize "save as" dialogs.
1581 void DownloadManager::ClearLastDownloadPath() { 1597 void DownloadManager::ClearLastDownloadPath() {
1582 last_download_path_ = FilePath(); 1598 last_download_path_ = FilePath();
1583 } 1599 }
1584 1600
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/tab_strip_controller.mm ('k') | chrome/browser/download/save_package.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698