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" |
11 #include "ui/base/l10n/l10n_util.h" | 11 #include "ui/base/l10n/l10n_util.h" |
12 #include "ui/shell_dialogs/select_file_dialog_factory.h" | 12 #include "ui/shell_dialogs/select_file_dialog_factory.h" |
13 #include "ui/shell_dialogs/select_file_policy.h" | 13 #include "ui/shell_dialogs/select_file_policy.h" |
14 #include "ui/shell_dialogs/selected_file_info.h" | 14 #include "ui/shell_dialogs/selected_file_info.h" |
15 #include "ui/shell_dialogs/shell_dialogs_delegate.h" | 15 #include "ui/shell_dialogs/shell_dialogs_delegate.h" |
16 | 16 |
17 #if defined(OS_WIN) | 17 #if defined(OS_WIN) |
18 #include "ui/shell_dialogs/select_file_dialog_win.h" | 18 #include "ui/shell_dialogs/select_file_dialog_win.h" |
19 #elif defined(OS_MACOSX) | 19 #elif defined(OS_MACOSX) |
20 #include "ui/shell_dialogs/select_file_dialog_mac.h" | 20 #include "ui/shell_dialogs/select_file_dialog_mac.h" |
21 #elif defined(OS_ANDROID) | 21 #elif defined(OS_ANDROID) |
22 #include "ui/shell_dialogs/select_file_dialog_android.h" | 22 #include "ui/shell_dialogs/select_file_dialog_android.h" |
23 #elif defined(USE_AURA) && defined(OS_LINUX) && !defined(OS_CHROMEOS) | 23 #elif defined(USE_AURA) && !defined(USE_ASH) && defined(OS_LINUX) |
24 #include "ui/shell_dialogs/linux_shell_dialog.h" | 24 #include "ui/shell_dialogs/linux_shell_dialog.h" |
25 #endif | 25 #endif |
26 | 26 |
27 namespace { | 27 namespace { |
28 | 28 |
29 // Optional dialog factory. Leaked. | 29 // Optional dialog factory. Leaked. |
30 ui::SelectFileDialogFactory* dialog_factory_ = NULL; | 30 ui::SelectFileDialogFactory* dialog_factory_ = NULL; |
31 | 31 |
32 // The global shell dialogs delegate. | 32 // The global shell dialogs delegate. |
33 ui::ShellDialogsDelegate* g_shell_dialogs_delegate_ = NULL; | 33 ui::ShellDialogsDelegate* g_shell_dialogs_delegate_ = NULL; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 // static | 69 // static |
70 scoped_refptr<SelectFileDialog> SelectFileDialog::Create( | 70 scoped_refptr<SelectFileDialog> SelectFileDialog::Create( |
71 Listener* listener, | 71 Listener* listener, |
72 ui::SelectFilePolicy* policy) { | 72 ui::SelectFilePolicy* policy) { |
73 if (dialog_factory_) { | 73 if (dialog_factory_) { |
74 SelectFileDialog* dialog = dialog_factory_->Create(listener, policy); | 74 SelectFileDialog* dialog = dialog_factory_->Create(listener, policy); |
75 if (dialog) | 75 if (dialog) |
76 return dialog; | 76 return dialog; |
77 } | 77 } |
78 | 78 |
79 #if defined(USE_AURA) && defined(OS_LINUX) && !defined(OS_CHROMEOS) | 79 #if defined(USE_AURA) && !defined(USE_ASH) && defined(OS_LINUX) |
80 const ui::LinuxShellDialog* shell_dialogs = ui::LinuxShellDialog::instance(); | 80 const ui::LinuxShellDialog* shell_dialogs = ui::LinuxShellDialog::instance(); |
81 if (shell_dialogs) | 81 if (shell_dialogs) |
82 return shell_dialogs->CreateSelectFileDialog(listener, policy); | 82 return shell_dialogs->CreateSelectFileDialog(listener, policy); |
83 #endif | 83 #endif |
84 | 84 |
85 #if defined(OS_WIN) | 85 #if defined(OS_WIN) |
86 // TODO(ananta) | 86 // TODO(ananta) |
87 // Fix this for Chrome ASH on Windows. | 87 // Fix this for Chrome ASH on Windows. |
88 return CreateWinSelectFileDialog(listener, policy); | 88 return CreateWinSelectFileDialog(listener, policy); |
89 #elif defined(OS_MACOSX) && !defined(USE_AURA) | 89 #elif defined(OS_MACOSX) && !defined(USE_AURA) |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 void SelectFileDialog::CancelFileSelection(void* params) { | 146 void SelectFileDialog::CancelFileSelection(void* params) { |
147 if (listener_) | 147 if (listener_) |
148 listener_->FileSelectionCanceled(params); | 148 listener_->FileSelectionCanceled(params); |
149 } | 149 } |
150 | 150 |
151 ShellDialogsDelegate* SelectFileDialog::GetShellDialogsDelegate() { | 151 ShellDialogsDelegate* SelectFileDialog::GetShellDialogsDelegate() { |
152 return g_shell_dialogs_delegate_; | 152 return g_shell_dialogs_delegate_; |
153 } | 153 } |
154 | 154 |
155 } // namespace ui | 155 } // namespace ui |
OLD | NEW |