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

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

Issue 93129: Initial download shelf on OS X.... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: fix download_uitest Created 11 years, 6 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
« no previous file with comments | « chrome/browser/cocoa/download_shelf_view.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 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 NewRunnableMethod(this, 629 NewRunnableMethod(this,
630 &DownloadManager::OnPathExistenceAvailable, 630 &DownloadManager::OnPathExistenceAvailable,
631 info)); 631 info));
632 } 632 }
633 633
634 void DownloadManager::OnPathExistenceAvailable(DownloadCreateInfo* info) { 634 void DownloadManager::OnPathExistenceAvailable(DownloadCreateInfo* info) {
635 DCHECK(MessageLoop::current() == ui_loop_); 635 DCHECK(MessageLoop::current() == ui_loop_);
636 DCHECK(info); 636 DCHECK(info);
637 637
638 if (info->save_as) { 638 if (info->save_as) {
639 #if defined(OS_WIN) || defined(OS_LINUX)
639 // We must ask the user for the place to put the download. 640 // We must ask the user for the place to put the download.
640 if (!select_file_dialog_.get()) 641 if (!select_file_dialog_.get())
641 select_file_dialog_ = SelectFileDialog::Create(this); 642 select_file_dialog_ = SelectFileDialog::Create(this);
642 643
643 TabContents* contents = tab_util::GetTabContentsByID( 644 TabContents* contents = tab_util::GetTabContentsByID(
644 info->render_process_id, info->render_view_id); 645 info->render_process_id, info->render_view_id);
645 SelectFileDialog::FileTypeInfo file_type_info; 646 SelectFileDialog::FileTypeInfo file_type_info;
646 file_type_info.extensions.resize(1); 647 file_type_info.extensions.resize(1);
647 file_type_info.extensions[0].push_back(info->suggested_path.Extension()); 648 file_type_info.extensions[0].push_back(info->suggested_path.Extension());
648 if (!file_type_info.extensions[0][0].empty()) 649 if (!file_type_info.extensions[0][0].empty())
649 file_type_info.extensions[0][0].erase(0, 1); // drop the . 650 file_type_info.extensions[0][0].erase(0, 1); // drop the .
650 file_type_info.include_all_files = true; 651 file_type_info.include_all_files = true;
651 gfx::NativeWindow owning_window = 652 gfx::NativeWindow owning_window =
652 contents ? platform_util::GetTopLevel(contents->GetNativeView()) : NULL; 653 contents ? platform_util::GetTopLevel(contents->GetNativeView()) : NULL;
653 select_file_dialog_->SelectFile(SelectFileDialog::SELECT_SAVEAS_FILE, 654 select_file_dialog_->SelectFile(SelectFileDialog::SELECT_SAVEAS_FILE,
654 string16(), 655 string16(),
655 info->suggested_path, 656 info->suggested_path,
656 &file_type_info, 0, FILE_PATH_LITERAL(""), 657 &file_type_info, 0, FILE_PATH_LITERAL(""),
657 owning_window, info); 658 owning_window, info);
659 #elif defined(OS_MACOSX)
660 // TODO(port): port this file -- need dialogs.
661 NOTIMPLEMENTED();
662 #endif
658 } else { 663 } else {
659 // No prompting for download, just continue with the suggested name. 664 // No prompting for download, just continue with the suggested name.
660 ContinueStartDownload(info, info->suggested_path); 665 ContinueStartDownload(info, info->suggested_path);
661 } 666 }
662 } 667 }
663 668
664 void DownloadManager::ContinueStartDownload(DownloadCreateInfo* info, 669 void DownloadManager::ContinueStartDownload(DownloadCreateInfo* info,
665 const FilePath& target_path) { 670 const FilePath& target_path) {
666 scoped_ptr<DownloadCreateInfo> infop(info); 671 scoped_ptr<DownloadCreateInfo> infop(info);
667 info->path = target_path; 672 info->path = target_path;
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after
1500 } 1505 }
1501 1506
1502 if (contents) 1507 if (contents)
1503 contents->OnStartDownload(download); 1508 contents->OnStartDownload(download);
1504 } 1509 }
1505 1510
1506 // Clears the last download path, used to initialize "save as" dialogs. 1511 // Clears the last download path, used to initialize "save as" dialogs.
1507 void DownloadManager::ClearLastDownloadPath() { 1512 void DownloadManager::ClearLastDownloadPath() {
1508 last_download_path_ = FilePath(); 1513 last_download_path_ = FilePath();
1509 } 1514 }
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/download_shelf_view.mm ('k') | chrome/browser/download/save_package.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698