OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/file_select_helper.h" | 5 #include "chrome/browser/file_select_helper.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 // Prevent warning. | 588 // Prevent warning. |
589 dialog_type_ = ui::SelectFileDialog::SELECT_OPEN_FILE; | 589 dialog_type_ = ui::SelectFileDialog::SELECT_OPEN_FILE; |
590 NOTREACHED(); | 590 NOTREACHED(); |
591 } | 591 } |
592 | 592 |
593 gfx::NativeWindow owning_window = | 593 gfx::NativeWindow owning_window = |
594 platform_util::GetTopLevel(web_contents_->GetNativeView()); | 594 platform_util::GetTopLevel(web_contents_->GetNativeView()); |
595 | 595 |
596 #if defined(OS_ANDROID) | 596 #if defined(OS_ANDROID) |
597 // Android needs the original MIME types and an additional capture value. | 597 // Android needs the original MIME types and an additional capture value. |
598 std::pair<std::vector<base::string16>, bool> accept_types = | 598 std::vector<base::string16> accept_types(params->accept_types); |
599 std::make_pair(params->accept_types, params->capture); | 599 accept_types.push_back(params->capture); |
600 #endif | 600 #endif |
601 | 601 |
602 select_file_dialog_->SelectFile( | 602 select_file_dialog_->SelectFile( |
603 dialog_type_, params->title, default_file_path, select_file_types_.get(), | 603 dialog_type_, params->title, default_file_path, select_file_types_.get(), |
604 select_file_types_.get() && !select_file_types_->extensions.empty() | 604 select_file_types_.get() && !select_file_types_->extensions.empty() |
605 ? 1 | 605 ? 1 |
606 : 0, // 1-based index of default extension to show. | 606 : 0, // 1-based index of default extension to show. |
607 base::FilePath::StringType(), | 607 base::FilePath::StringType(), |
608 owning_window, | 608 owning_window, |
609 #if defined(OS_ANDROID) | 609 #if defined(OS_ANDROID) |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
692 | 692 |
693 // static | 693 // static |
694 base::FilePath FileSelectHelper::GetSanitizedFileName( | 694 base::FilePath FileSelectHelper::GetSanitizedFileName( |
695 const base::FilePath& suggested_filename) { | 695 const base::FilePath& suggested_filename) { |
696 if (suggested_filename.empty()) | 696 if (suggested_filename.empty()) |
697 return base::FilePath(); | 697 return base::FilePath(); |
698 return net::GenerateFileName( | 698 return net::GenerateFileName( |
699 GURL(), std::string(), std::string(), suggested_filename.AsUTF8Unsafe(), | 699 GURL(), std::string(), std::string(), suggested_filename.AsUTF8Unsafe(), |
700 std::string(), l10n_util::GetStringUTF8(IDS_DEFAULT_DOWNLOAD_FILENAME)); | 700 std::string(), l10n_util::GetStringUTF8(IDS_DEFAULT_DOWNLOAD_FILENAME)); |
701 } | 701 } |
OLD | NEW |