| 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 <windows.h> | 7 #include <windows.h> |
| 8 #include <commdlg.h> | 8 #include <commdlg.h> |
| 9 #include <shlobj.h> | 9 #include <shlobj.h> |
| 10 | 10 |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 aura::HandleSelectFolder( | 594 aura::HandleSelectFolder( |
| 595 base::UTF16ToWide(title_string), | 595 base::UTF16ToWide(title_string), |
| 596 base::Bind(&ui::SelectFileDialog::Listener::FileSelected, | 596 base::Bind(&ui::SelectFileDialog::Listener::FileSelected, |
| 597 base::Unretained(listener_)), | 597 base::Unretained(listener_)), |
| 598 base::Bind(&ui::SelectFileDialog::Listener::FileSelectionCanceled, | 598 base::Bind(&ui::SelectFileDialog::Listener::FileSelectionCanceled, |
| 599 base::Unretained(listener_))); | 599 base::Unretained(listener_))); |
| 600 return; | 600 return; |
| 601 } | 601 } |
| 602 } | 602 } |
| 603 HWND owner = owning_window && owning_window->GetRootWindow() | 603 HWND owner = owning_window && owning_window->GetRootWindow() |
| 604 ? owning_window->GetDispatcher()->host()->GetAcceleratedWidget() : NULL; | 604 ? owning_window->GetHost()->GetAcceleratedWidget() : NULL; |
| 605 #else | 605 #else |
| 606 HWND owner = owning_window; | 606 HWND owner = owning_window; |
| 607 #endif | 607 #endif |
| 608 ExecuteSelectParams execute_params(type, base::UTF16ToWide(title), | 608 ExecuteSelectParams execute_params(type, base::UTF16ToWide(title), |
| 609 default_path, file_types, file_type_index, | 609 default_path, file_types, file_type_index, |
| 610 default_extension, BeginRun(owner), | 610 default_extension, BeginRun(owner), |
| 611 owner, params); | 611 owner, params); |
| 612 execute_params.run_state.dialog_thread->message_loop()->PostTask( | 612 execute_params.run_state.dialog_thread->message_loop()->PostTask( |
| 613 FROM_HERE, | 613 FROM_HERE, |
| 614 base::Bind(&SelectFileDialogImpl::ExecuteSelectFile, this, | 614 base::Bind(&SelectFileDialogImpl::ExecuteSelectFile, this, |
| 615 execute_params)); | 615 execute_params)); |
| 616 } | 616 } |
| 617 | 617 |
| 618 bool SelectFileDialogImpl::HasMultipleFileTypeChoicesImpl() { | 618 bool SelectFileDialogImpl::HasMultipleFileTypeChoicesImpl() { |
| 619 return has_multiple_file_type_choices_; | 619 return has_multiple_file_type_choices_; |
| 620 } | 620 } |
| 621 | 621 |
| 622 bool SelectFileDialogImpl::IsRunning(gfx::NativeWindow owning_window) const { | 622 bool SelectFileDialogImpl::IsRunning(gfx::NativeWindow owning_window) const { |
| 623 #if defined(USE_AURA) | 623 #if defined(USE_AURA) |
| 624 if (!owning_window->GetRootWindow()) | 624 if (!owning_window->GetRootWindow()) |
| 625 return false; | 625 return false; |
| 626 HWND owner = owning_window->GetDispatcher()->host()->GetAcceleratedWidget(); | 626 HWND owner = owning_window->GetHost()->GetAcceleratedWidget(); |
| 627 #else | 627 #else |
| 628 HWND owner = owning_window; | 628 HWND owner = owning_window; |
| 629 #endif | 629 #endif |
| 630 return listener_ && IsRunningDialogForOwner(owner); | 630 return listener_ && IsRunningDialogForOwner(owner); |
| 631 } | 631 } |
| 632 | 632 |
| 633 void SelectFileDialogImpl::ListenerDestroyed() { | 633 void SelectFileDialogImpl::ListenerDestroyed() { |
| 634 // Our associated listener has gone away, so we shouldn't call back to it if | 634 // Our associated listener has gone away, so we shouldn't call back to it if |
| 635 // our worker thread returns after the listener is dead. | 635 // our worker thread returns after the listener is dead. |
| 636 listener_ = NULL; | 636 listener_ = NULL; |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 949 return return_value; | 949 return return_value; |
| 950 } | 950 } |
| 951 | 951 |
| 952 SelectFileDialog* CreateWinSelectFileDialog( | 952 SelectFileDialog* CreateWinSelectFileDialog( |
| 953 SelectFileDialog::Listener* listener, | 953 SelectFileDialog::Listener* listener, |
| 954 SelectFilePolicy* policy) { | 954 SelectFilePolicy* policy) { |
| 955 return new SelectFileDialogImpl(listener, policy); | 955 return new SelectFileDialogImpl(listener, policy); |
| 956 } | 956 } |
| 957 | 957 |
| 958 } // namespace ui | 958 } // namespace ui |
| OLD | NEW |