| 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_win.h" | 5 #include "ui/shell_dialogs/select_file_dialog_win.h" |
| 6 | 6 |
| 7 #include <shlobj.h> | 7 #include <shlobj.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| 11 #include <set> | 11 #include <set> |
| 12 #include <tuple> | 12 #include <tuple> |
| 13 | 13 |
| 14 #include "base/bind.h" | 14 #include "base/bind.h" |
| 15 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
| 16 #include "base/files/file_util.h" | 16 #include "base/files/file_util.h" |
| 17 #include "base/i18n/case_conversion.h" | 17 #include "base/i18n/case_conversion.h" |
| 18 #include "base/macros.h" | 18 #include "base/macros.h" |
| 19 #include "base/message_loop/message_loop.h" | 19 #include "base/message_loop/message_loop.h" |
| 20 #include "base/single_thread_task_runner.h" |
| 20 #include "base/threading/thread.h" | 21 #include "base/threading/thread.h" |
| 21 #include "base/win/registry.h" | 22 #include "base/win/registry.h" |
| 22 #include "base/win/scoped_comptr.h" | 23 #include "base/win/scoped_comptr.h" |
| 23 #include "base/win/shortcut.h" | 24 #include "base/win/shortcut.h" |
| 24 #include "ui/aura/window.h" | 25 #include "ui/aura/window.h" |
| 25 #include "ui/aura/window_event_dispatcher.h" | 26 #include "ui/aura/window_event_dispatcher.h" |
| 26 #include "ui/aura/window_tree_host.h" | 27 #include "ui/aura/window_tree_host.h" |
| 27 #include "ui/base/l10n/l10n_util.h" | 28 #include "ui/base/l10n/l10n_util.h" |
| 28 #include "ui/base/win/open_file_name_win.h" | 29 #include "ui/base/win/open_file_name_win.h" |
| 29 #include "ui/gfx/native_widget_types.h" | 30 #include "ui/gfx/native_widget_types.h" |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 void* params) { | 327 void* params) { |
| 327 has_multiple_file_type_choices_ = | 328 has_multiple_file_type_choices_ = |
| 328 file_types ? file_types->extensions.size() > 1 : true; | 329 file_types ? file_types->extensions.size() > 1 : true; |
| 329 HWND owner = owning_window && owning_window->GetRootWindow() | 330 HWND owner = owning_window && owning_window->GetRootWindow() |
| 330 ? owning_window->GetHost()->GetAcceleratedWidget() : NULL; | 331 ? owning_window->GetHost()->GetAcceleratedWidget() : NULL; |
| 331 | 332 |
| 332 ExecuteSelectParams execute_params(type, title, | 333 ExecuteSelectParams execute_params(type, title, |
| 333 default_path, file_types, file_type_index, | 334 default_path, file_types, file_type_index, |
| 334 default_extension, BeginRun(owner), | 335 default_extension, BeginRun(owner), |
| 335 owner, params); | 336 owner, params); |
| 336 execute_params.run_state.dialog_thread->message_loop()->PostTask( | 337 execute_params.run_state.dialog_thread->task_runner()->PostTask( |
| 337 FROM_HERE, | 338 FROM_HERE, base::Bind(&SelectFileDialogImpl::ExecuteSelectFile, this, |
| 338 base::Bind(&SelectFileDialogImpl::ExecuteSelectFile, this, | 339 execute_params)); |
| 339 execute_params)); | |
| 340 } | 340 } |
| 341 | 341 |
| 342 bool SelectFileDialogImpl::HasMultipleFileTypeChoicesImpl() { | 342 bool SelectFileDialogImpl::HasMultipleFileTypeChoicesImpl() { |
| 343 return has_multiple_file_type_choices_; | 343 return has_multiple_file_type_choices_; |
| 344 } | 344 } |
| 345 | 345 |
| 346 bool SelectFileDialogImpl::IsRunning(gfx::NativeWindow owning_window) const { | 346 bool SelectFileDialogImpl::IsRunning(gfx::NativeWindow owning_window) const { |
| 347 if (!owning_window->GetRootWindow()) | 347 if (!owning_window->GetRootWindow()) |
| 348 return false; | 348 return false; |
| 349 HWND owner = owning_window->GetHost()->GetAcceleratedWidget(); | 349 HWND owner = owning_window->GetHost()->GetAcceleratedWidget(); |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 | 707 |
| 708 SelectFileDialog* CreateSelectFileDialog(SelectFileDialog::Listener* listener, | 708 SelectFileDialog* CreateSelectFileDialog(SelectFileDialog::Listener* listener, |
| 709 SelectFilePolicy* policy) { | 709 SelectFilePolicy* policy) { |
| 710 return CreateWinSelectFileDialog(listener, | 710 return CreateWinSelectFileDialog(listener, |
| 711 policy, | 711 policy, |
| 712 base::Bind(&CallBuiltinGetOpenFileName), | 712 base::Bind(&CallBuiltinGetOpenFileName), |
| 713 base::Bind(&CallBuiltinGetSaveFileName)); | 713 base::Bind(&CallBuiltinGetSaveFileName)); |
| 714 } | 714 } |
| 715 | 715 |
| 716 } // namespace ui | 716 } // namespace ui |
| OLD | NEW |