| Index: chrome/browser/file_select_helper.cc
|
| diff --git a/chrome/browser/file_select_helper.cc b/chrome/browser/file_select_helper.cc
|
| index 6c44527a61e2c2519f888a5d77c6f8c3bbe30556..86b40bcc40661e7461c09605c4389c5816705caf 100644
|
| --- a/chrome/browser/file_select_helper.cc
|
| +++ b/chrome/browser/file_select_helper.cc
|
| @@ -9,7 +9,6 @@
|
| #include "base/bind.h"
|
| #include "base/file_util.h"
|
| #include "base/files/file_enumerator.h"
|
| -#include "base/platform_file.h"
|
| #include "base/strings/string_split.h"
|
| #include "base/strings/string_util.h"
|
| #include "base/strings/utf_string_conversions.h"
|
| @@ -46,27 +45,8 @@ const int kFileSelectEnumerationId = -1;
|
|
|
| void NotifyRenderViewHost(RenderViewHost* render_view_host,
|
| const std::vector<ui::SelectedFileInfo>& files,
|
| - ui::SelectFileDialog::Type dialog_type) {
|
| - const int kReadFilePermissions =
|
| - base::PLATFORM_FILE_OPEN |
|
| - base::PLATFORM_FILE_READ |
|
| - base::PLATFORM_FILE_EXCLUSIVE_READ |
|
| - base::PLATFORM_FILE_ASYNC;
|
| -
|
| - const int kWriteFilePermissions =
|
| - base::PLATFORM_FILE_CREATE |
|
| - base::PLATFORM_FILE_CREATE_ALWAYS |
|
| - base::PLATFORM_FILE_OPEN |
|
| - base::PLATFORM_FILE_OPEN_ALWAYS |
|
| - base::PLATFORM_FILE_OPEN_TRUNCATED |
|
| - base::PLATFORM_FILE_WRITE |
|
| - base::PLATFORM_FILE_WRITE_ATTRIBUTES |
|
| - base::PLATFORM_FILE_ASYNC;
|
| -
|
| - int permissions = kReadFilePermissions;
|
| - if (dialog_type == ui::SelectFileDialog::SELECT_SAVEAS_FILE)
|
| - permissions = kWriteFilePermissions;
|
| - render_view_host->FilesSelectedInChooser(files, permissions);
|
| + FileChooserParams::Mode dialog_mode) {
|
| + render_view_host->FilesSelectedInChooser(files, dialog_mode);
|
| }
|
|
|
| // Converts a list of FilePaths to a list of ui::SelectedFileInfo.
|
| @@ -97,7 +77,8 @@ FileSelectHelper::FileSelectHelper(Profile* profile)
|
| web_contents_(NULL),
|
| select_file_dialog_(),
|
| select_file_types_(),
|
| - dialog_type_(ui::SelectFileDialog::SELECT_OPEN_FILE) {
|
| + dialog_type_(ui::SelectFileDialog::SELECT_OPEN_FILE),
|
| + dialog_mode_(FileChooserParams::Open) {
|
| }
|
|
|
| FileSelectHelper::~FileSelectHelper() {
|
| @@ -148,7 +129,7 @@ void FileSelectHelper::FileSelectedWithExtraInfo(
|
|
|
| std::vector<ui::SelectedFileInfo> files;
|
| files.push_back(file);
|
| - NotifyRenderViewHost(render_view_host_, files, dialog_type_);
|
| + NotifyRenderViewHost(render_view_host_, files, dialog_mode_);
|
|
|
| // No members should be accessed from here on.
|
| RunFileChooserEnd();
|
| @@ -171,7 +152,7 @@ void FileSelectHelper::MultiFilesSelectedWithExtraInfo(
|
| if (!render_view_host_)
|
| return;
|
|
|
| - NotifyRenderViewHost(render_view_host_, files, dialog_type_);
|
| + NotifyRenderViewHost(render_view_host_, files, dialog_mode_);
|
|
|
| // No members should be accessed from here on.
|
| RunFileChooserEnd();
|
| @@ -185,7 +166,7 @@ void FileSelectHelper::FileSelectionCanceled(void* params) {
|
| // empty vector.
|
| NotifyRenderViewHost(
|
| render_view_host_, std::vector<ui::SelectedFileInfo>(),
|
| - dialog_type_);
|
| + dialog_mode_);
|
|
|
| // No members should be accessed from here on.
|
| RunFileChooserEnd();
|
| @@ -241,7 +222,7 @@ void FileSelectHelper::OnListDone(int id, int error) {
|
| FilePathListToSelectedFileInfoList(entry->results_);
|
|
|
| if (id == kFileSelectEnumerationId)
|
| - NotifyRenderViewHost(entry->rvh_, selected_files, dialog_type_);
|
| + NotifyRenderViewHost(entry->rvh_, selected_files, dialog_mode_);
|
| else
|
| entry->rvh_->DirectoryEnumerationFinished(id, entry->results_);
|
|
|
| @@ -387,6 +368,7 @@ void FileSelectHelper::RunFileChooserOnUIThread(
|
| select_file_dialog_ = ui::SelectFileDialog::Create(
|
| this, new ChromeSelectFilePolicy(web_contents_));
|
|
|
| + dialog_mode_ = params.mode;
|
| switch (params.mode) {
|
| case FileChooserParams::Open:
|
| dialog_type_ = ui::SelectFileDialog::SELECT_OPEN_FILE;
|
|
|