| 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 "ui/shell_dialogs/select_file_dialog.h" | 5 #include "ui/shell_dialogs/select_file_dialog.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 : include_all_files(false), | 39 : include_all_files(false), |
| 40 support_drive(false) {} | 40 support_drive(false) {} |
| 41 | 41 |
| 42 SelectFileDialog::FileTypeInfo::~FileTypeInfo() {} | 42 SelectFileDialog::FileTypeInfo::~FileTypeInfo() {} |
| 43 | 43 |
| 44 void SelectFileDialog::Listener::FileSelectedWithExtraInfo( | 44 void SelectFileDialog::Listener::FileSelectedWithExtraInfo( |
| 45 const ui::SelectedFileInfo& file, | 45 const ui::SelectedFileInfo& file, |
| 46 int index, | 46 int index, |
| 47 void* params) { | 47 void* params) { |
| 48 // Most of the dialogs need actual local path, so default to it. | 48 // Most of the dialogs need actual local path, so default to it. |
| 49 FileSelected(file.local_path, index, params); | 49 // If local path is empty, use file_path instead. |
| 50 FileSelected(file.local_path.empty() ? file.file_path : file.local_path, |
| 51 index, |
| 52 params); |
| 50 } | 53 } |
| 51 | 54 |
| 52 void SelectFileDialog::Listener::MultiFilesSelectedWithExtraInfo( | 55 void SelectFileDialog::Listener::MultiFilesSelectedWithExtraInfo( |
| 53 const std::vector<ui::SelectedFileInfo>& files, | 56 const std::vector<ui::SelectedFileInfo>& files, |
| 54 void* params) { | 57 void* params) { |
| 55 std::vector<base::FilePath> file_paths; | 58 std::vector<base::FilePath> file_paths; |
| 56 for (size_t i = 0; i < files.size(); ++i) | 59 for (size_t i = 0; i < files.size(); ++i) |
| 57 file_paths.push_back(files[i].local_path); | 60 file_paths.push_back(files[i].local_path.empty() ? files[i].file_path |
| 61 : files[i].local_path); |
| 58 | 62 |
| 59 MultiFilesSelected(file_paths, params); | 63 MultiFilesSelected(file_paths, params); |
| 60 } | 64 } |
| 61 | 65 |
| 62 // static | 66 // static |
| 63 void SelectFileDialog::SetFactory(ui::SelectFileDialogFactory* factory) { | 67 void SelectFileDialog::SetFactory(ui::SelectFileDialogFactory* factory) { |
| 64 delete dialog_factory_; | 68 delete dialog_factory_; |
| 65 dialog_factory_ = factory; | 69 dialog_factory_ = factory; |
| 66 } | 70 } |
| 67 | 71 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 void SelectFileDialog::CancelFileSelection(void* params) { | 149 void SelectFileDialog::CancelFileSelection(void* params) { |
| 146 if (listener_) | 150 if (listener_) |
| 147 listener_->FileSelectionCanceled(params); | 151 listener_->FileSelectionCanceled(params); |
| 148 } | 152 } |
| 149 | 153 |
| 150 ShellDialogsDelegate* SelectFileDialog::GetShellDialogsDelegate() { | 154 ShellDialogsDelegate* SelectFileDialog::GetShellDialogsDelegate() { |
| 151 return g_shell_dialogs_delegate_; | 155 return g_shell_dialogs_delegate_; |
| 152 } | 156 } |
| 153 | 157 |
| 154 } // namespace ui | 158 } // namespace ui |
| OLD | NEW |