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

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

Issue 164547: Mac: make save/open dialogs operate as tab-modal sheets.... Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Painfully (but hopefully correctly) merged ToT. Created 11 years, 2 months 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 | Annotate | Revision Log
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 661 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 select_file_dialog_ = SelectFileDialog::Create(this); 672 select_file_dialog_ = SelectFileDialog::Create(this);
673 673
674 TabContents* contents = tab_util::GetTabContentsByID(info->child_id, 674 TabContents* contents = tab_util::GetTabContentsByID(info->child_id,
675 info->render_view_id); 675 info->render_view_id);
676 SelectFileDialog::FileTypeInfo file_type_info; 676 SelectFileDialog::FileTypeInfo file_type_info;
677 file_type_info.extensions.resize(1); 677 file_type_info.extensions.resize(1);
678 file_type_info.extensions[0].push_back(info->suggested_path.Extension()); 678 file_type_info.extensions[0].push_back(info->suggested_path.Extension());
679 if (!file_type_info.extensions[0][0].empty()) 679 if (!file_type_info.extensions[0][0].empty())
680 file_type_info.extensions[0][0].erase(0, 1); // drop the . 680 file_type_info.extensions[0][0].erase(0, 1); // drop the .
681 file_type_info.include_all_files = true; 681 file_type_info.include_all_files = true;
682 #if defined(OS_MACOSX)
683 // If |contents| is NULL, file selection should theoretically run modeless.
684 // FIXME(viettrungluu@gmail.com): But we don't actually currently support
685 // modeless file selection dialogs on Mac. Does this ever happen? Should it?
686 // Better dcheck it.
687 DCHECK(contents);
688 select_file_dialog_->SelectFileInTab(SelectFileDialog::SELECT_SAVEAS_FILE,
689 string16(),
690 info->suggested_path,
691 &file_type_info,
692 0,
693 FILE_PATH_LITERAL(""),
694 contents,
695 info);
696 #else
682 gfx::NativeWindow owning_window = 697 gfx::NativeWindow owning_window =
683 contents ? platform_util::GetTopLevel(contents->GetNativeView()) : NULL; 698 contents ? platform_util::GetTopLevel(contents->GetNativeView()) : NULL
699
684 select_file_dialog_->SelectFile(SelectFileDialog::SELECT_SAVEAS_FILE, 700 select_file_dialog_->SelectFile(SelectFileDialog::SELECT_SAVEAS_FILE,
685 string16(), 701 string16(),
686 info->suggested_path, 702 info->suggested_path,
687 &file_type_info, 0, FILE_PATH_LITERAL(""), 703 &file_type_info, 0, FILE_PATH_LITERAL(""),
688 owning_window, info); 704 owning_window, info);
705 #endif
689 } else { 706 } else {
690 // No prompting for download, just continue with the suggested name. 707 // No prompting for download, just continue with the suggested name.
691 ContinueStartDownload(info, info->suggested_path); 708 ContinueStartDownload(info, info->suggested_path);
692 } 709 }
693 } 710 }
694 711
695 void DownloadManager::ContinueStartDownload(DownloadCreateInfo* info, 712 void DownloadManager::ContinueStartDownload(DownloadCreateInfo* info,
696 const FilePath& target_path) { 713 const FilePath& target_path) {
697 scoped_ptr<DownloadCreateInfo> infop(info); 714 scoped_ptr<DownloadCreateInfo> infop(info);
698 info->path = target_path; 715 info->path = target_path;
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after
1551 1568
1552 if (contents) 1569 if (contents)
1553 contents->OnStartDownload(download); 1570 contents->OnStartDownload(download);
1554 } 1571 }
1555 1572
1556 // Clears the last download path, used to initialize "save as" dialogs. 1573 // Clears the last download path, used to initialize "save as" dialogs.
1557 void DownloadManager::ClearLastDownloadPath() { 1574 void DownloadManager::ClearLastDownloadPath() {
1558 last_download_path_ = FilePath(); 1575 last_download_path_ = FilePath();
1559 } 1576 }
1560 1577
OLDNEW
« no previous file with comments | « chrome/browser/debugger/devtools_window.h ('k') | chrome/browser/download/download_request_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698