Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(290)

Side by Side Diff: ui/shell_dialogs/select_file_dialog_win.cc

Issue 1169923009: Remove remaining use of the deprecated MessageLoopProxy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix typo. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/compositor/compositor.h ('k') | win8/metro_driver/chrome_app_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <set> 10 #include <set>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
14 #include "base/files/file_util.h" 14 #include "base/files/file_util.h"
15 #include "base/i18n/case_conversion.h" 15 #include "base/i18n/case_conversion.h"
16 #include "base/message_loop/message_loop.h" 16 #include "base/message_loop/message_loop.h"
17 #include "base/message_loop/message_loop_proxy.h"
18 #include "base/threading/thread.h" 17 #include "base/threading/thread.h"
19 #include "base/tuple.h" 18 #include "base/tuple.h"
20 #include "base/win/registry.h" 19 #include "base/win/registry.h"
21 #include "base/win/scoped_comptr.h" 20 #include "base/win/scoped_comptr.h"
22 #include "base/win/shortcut.h" 21 #include "base/win/shortcut.h"
23 #include "ui/aura/window.h" 22 #include "ui/aura/window.h"
24 #include "ui/aura/window_event_dispatcher.h" 23 #include "ui/aura/window_event_dispatcher.h"
25 #include "ui/aura/window_tree_host.h" 24 #include "ui/aura/window_tree_host.h"
26 #include "ui/base/l10n/l10n_util.h" 25 #include "ui/base/l10n/l10n_util.h"
27 #include "ui/base/win/open_file_name_win.h" 26 #include "ui/base/win/open_file_name_win.h"
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 const std::wstring& default_extension, 193 const std::wstring& default_extension,
195 RunState run_state, 194 RunState run_state,
196 HWND owner, 195 HWND owner,
197 void* params) 196 void* params)
198 : type(type), 197 : type(type),
199 title(title), 198 title(title),
200 default_path(default_path), 199 default_path(default_path),
201 file_type_index(file_type_index), 200 file_type_index(file_type_index),
202 default_extension(default_extension), 201 default_extension(default_extension),
203 run_state(run_state), 202 run_state(run_state),
204 ui_proxy(base::MessageLoopForUI::current()->message_loop_proxy()), 203 ui_task_runner(base::MessageLoopForUI::current()->task_runner()),
205 owner(owner), 204 owner(owner),
206 params(params) { 205 params(params) {
207 if (file_types) 206 if (file_types)
208 this->file_types = *file_types; 207 this->file_types = *file_types;
209 } 208 }
210 SelectFileDialog::Type type; 209 SelectFileDialog::Type type;
211 std::wstring title; 210 std::wstring title;
212 base::FilePath default_path; 211 base::FilePath default_path;
213 FileTypeInfo file_types; 212 FileTypeInfo file_types;
214 int file_type_index; 213 int file_type_index;
215 std::wstring default_extension; 214 std::wstring default_extension;
216 RunState run_state; 215 RunState run_state;
217 scoped_refptr<base::MessageLoopProxy> ui_proxy; 216 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner;
218 HWND owner; 217 HWND owner;
219 void* params; 218 void* params;
220 }; 219 };
221 220
222 // Shows the file selection dialog modal to |owner| and calls the result 221 // Shows the file selection dialog modal to |owner| and calls the result
223 // back on the ui thread. Run on the dialog thread. 222 // back on the ui thread. Run on the dialog thread.
224 void ExecuteSelectFile(const ExecuteSelectParams& params); 223 void ExecuteSelectFile(const ExecuteSelectParams& params);
225 224
226 // Prompt the user for location to save a file. 225 // Prompt the user for location to save a file.
227 // Callers should provide the filter string, and also a filter index. 226 // Callers should provide the filter string, and also a filter index.
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 if (success) 434 if (success)
436 path = base::FilePath(path_as_wstring); 435 path = base::FilePath(path_as_wstring);
437 DisableOwner(params.run_state.owner); 436 DisableOwner(params.run_state.owner);
438 } else if (params.type == SELECT_OPEN_FILE) { 437 } else if (params.type == SELECT_OPEN_FILE) {
439 success = RunOpenFileDialog(params.title, filter, 438 success = RunOpenFileDialog(params.title, filter,
440 params.run_state.owner, &path); 439 params.run_state.owner, &path);
441 } else if (params.type == SELECT_OPEN_MULTI_FILE) { 440 } else if (params.type == SELECT_OPEN_MULTI_FILE) {
442 std::vector<base::FilePath> paths; 441 std::vector<base::FilePath> paths;
443 if (RunOpenMultiFileDialog(params.title, filter, 442 if (RunOpenMultiFileDialog(params.title, filter,
444 params.run_state.owner, &paths)) { 443 params.run_state.owner, &paths)) {
445 params.ui_proxy->PostTask( 444 params.ui_task_runner->PostTask(
446 FROM_HERE, 445 FROM_HERE, base::Bind(&SelectFileDialogImpl::MultiFilesSelected, this,
447 base::Bind(&SelectFileDialogImpl::MultiFilesSelected, this, paths, 446 paths, params.params, params.run_state));
448 params.params, params.run_state));
449 return; 447 return;
450 } 448 }
451 } 449 }
452 450
453 if (success) { 451 if (success) {
454 params.ui_proxy->PostTask( 452 params.ui_task_runner->PostTask(
455 FROM_HERE, 453 FROM_HERE, base::Bind(&SelectFileDialogImpl::FileSelected, this, path,
456 base::Bind(&SelectFileDialogImpl::FileSelected, this, path, 454 filter_index, params.params, params.run_state));
457 filter_index, params.params, params.run_state));
458 } else { 455 } else {
459 params.ui_proxy->PostTask( 456 params.ui_task_runner->PostTask(
460 FROM_HERE, 457 FROM_HERE, base::Bind(&SelectFileDialogImpl::FileNotSelected, this,
461 base::Bind(&SelectFileDialogImpl::FileNotSelected, this, params.params, 458 params.params, params.run_state));
462 params.run_state));
463 } 459 }
464 } 460 }
465 461
466 bool SelectFileDialogImpl::SaveFileAsWithFilter( 462 bool SelectFileDialogImpl::SaveFileAsWithFilter(
467 HWND owner, 463 HWND owner,
468 const std::wstring& suggested_name, 464 const std::wstring& suggested_name,
469 const std::wstring& filter, 465 const std::wstring& filter,
470 const std::wstring& def_ext, 466 const std::wstring& def_ext,
471 bool ignore_suggested_ext, 467 bool ignore_suggested_ext,
472 unsigned* index, 468 unsigned* index,
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 SelectFileDialog* CreateDefaultWinSelectFileDialog( 762 SelectFileDialog* CreateDefaultWinSelectFileDialog(
767 SelectFileDialog::Listener* listener, 763 SelectFileDialog::Listener* listener,
768 SelectFilePolicy* policy) { 764 SelectFilePolicy* policy) {
769 return CreateWinSelectFileDialog(listener, 765 return CreateWinSelectFileDialog(listener,
770 policy, 766 policy,
771 base::Bind(&CallBuiltinGetOpenFileName), 767 base::Bind(&CallBuiltinGetOpenFileName),
772 base::Bind(&CallBuiltinGetSaveFileName)); 768 base::Bind(&CallBuiltinGetSaveFileName));
773 } 769 }
774 770
775 } // namespace ui 771 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/compositor.h ('k') | win8/metro_driver/chrome_app_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698