| 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/base/dialogs/select_file_dialog.h" | 5 #include "ui/base/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.h" | 9 #include "base/message_loop.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| 11 #include "ui/base/dialogs/selected_file_info.h" | 11 #include "ui/base/dialogs/selected_file_info.h" |
| 12 #include "ui/base/dialogs/select_file_dialog_factory.h" | 12 #include "ui/base/dialogs/select_file_dialog_factory.h" |
| 13 #include "ui/base/dialogs/select_file_policy.h" | 13 #include "ui/base/dialogs/select_file_policy.h" |
| 14 #include "ui/base/l10n/l10n_util.h" | 14 #include "ui/base/l10n/l10n_util.h" |
| 15 #include "ui/base/linux_ui.h" | 15 #include "ui/base/linux_ui.h" |
| 16 | 16 |
| 17 #if defined(OS_WIN) | 17 #if defined(OS_WIN) |
| 18 #include "ui/base/dialogs/select_file_dialog_win.h" | 18 #include "ui/base/dialogs/select_file_dialog_win.h" |
| 19 #elif defined(OS_MACOSX) | 19 #elif defined(OS_MACOSX) |
| 20 #include "ui/base/dialogs/select_file_dialog_mac.h" | 20 #include "ui/base/dialogs/select_file_dialog_mac.h" |
| 21 #elif defined(TOOLKIT_GTK) | 21 #elif defined(TOOLKIT_GTK) |
| 22 #include "ui/base/dialogs/gtk/select_file_dialog_impl.h" | 22 #include "ui/base/dialogs/gtk/select_file_dialog_impl.h" |
| 23 #elif defined(OS_ANDROID) |
| 24 #include "ui/base/dialogs/android/select_file_dialog_android.h" |
| 23 #endif | 25 #endif |
| 24 | 26 |
| 25 namespace { | 27 namespace { |
| 26 | 28 |
| 27 // Optional dialog factory. Leaked. | 29 // Optional dialog factory. Leaked. |
| 28 ui::SelectFileDialogFactory* dialog_factory_ = NULL; | 30 ui::SelectFileDialogFactory* dialog_factory_ = NULL; |
| 29 | 31 |
| 30 } // namespace | 32 } // namespace |
| 31 | 33 |
| 32 namespace ui { | 34 namespace ui { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 #endif | 77 #endif |
| 76 | 78 |
| 77 #if defined(OS_WIN) && !defined(USE_AURA) | 79 #if defined(OS_WIN) && !defined(USE_AURA) |
| 78 // TODO(port): The windows people need this to work in aura, too. | 80 // TODO(port): The windows people need this to work in aura, too. |
| 79 return CreateWinSelectFileDialog(listener, policy); | 81 return CreateWinSelectFileDialog(listener, policy); |
| 80 #elif defined(OS_MACOSX) && !defined(USE_AURA) | 82 #elif defined(OS_MACOSX) && !defined(USE_AURA) |
| 81 return CreateMacSelectFileDialog(listener, policy); | 83 return CreateMacSelectFileDialog(listener, policy); |
| 82 #elif defined(TOOLKIT_GTK) | 84 #elif defined(TOOLKIT_GTK) |
| 83 return CreateLinuxSelectFileDialog(listener, policy); | 85 return CreateLinuxSelectFileDialog(listener, policy); |
| 84 #elif defined(OS_ANDROID) | 86 #elif defined(OS_ANDROID) |
| 85 // see crbug.com/116131 to track implemenation of SelectFileDialog | 87 return CreateAndroidSelectFileDialog(listener, policy); |
| 86 NOTIMPLEMENTED(); | |
| 87 #endif | 88 #endif |
| 88 | 89 |
| 89 return NULL; | 90 return NULL; |
| 90 } | 91 } |
| 91 | 92 |
| 92 void SelectFileDialog::SelectFile(Type type, | 93 void SelectFileDialog::SelectFile(Type type, |
| 93 const string16& title, | 94 const string16& title, |
| 94 const FilePath& default_path, | 95 const FilePath& default_path, |
| 95 const FileTypeInfo* file_types, | 96 const FileTypeInfo* file_types, |
| 96 int file_type_index, | 97 int file_type_index, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 } | 130 } |
| 130 | 131 |
| 131 SelectFileDialog::~SelectFileDialog() {} | 132 SelectFileDialog::~SelectFileDialog() {} |
| 132 | 133 |
| 133 void SelectFileDialog::CancelFileSelection(void* params) { | 134 void SelectFileDialog::CancelFileSelection(void* params) { |
| 134 if (listener_) | 135 if (listener_) |
| 135 listener_->FileSelectionCanceled(params); | 136 listener_->FileSelectionCanceled(params); |
| 136 } | 137 } |
| 137 | 138 |
| 138 } // namespace ui | 139 } // namespace ui |
| OLD | NEW |