OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/browser/shell_dialogs.h" | 5 #include "chrome/browser/shell_dialogs.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 #include <atlbase.h> | 10 #include <atlbase.h> |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 void SelectFileDialogImpl::ExecuteSelectFile( | 317 void SelectFileDialogImpl::ExecuteSelectFile( |
318 const ExecuteSelectParams& params) { | 318 const ExecuteSelectParams& params) { |
319 FilePath path = params.default_path; | 319 FilePath path = params.default_path; |
320 bool success = false; | 320 bool success = false; |
321 unsigned filter_index = params.filter_index; | 321 unsigned filter_index = params.filter_index; |
322 if (params.type == SELECT_FOLDER) { | 322 if (params.type == SELECT_FOLDER) { |
323 success = RunSelectFolderDialog(params.title, | 323 success = RunSelectFolderDialog(params.title, |
324 params.run_state.owner, | 324 params.run_state.owner, |
325 &path); | 325 &path); |
326 } else if (params.type == SELECT_SAVEAS_FILE) { | 326 } else if (params.type == SELECT_SAVEAS_FILE) { |
| 327 std::wstring path_as_wstring = path.ToWStringHack(); |
327 success = win_util::SaveFileAsWithFilter(params.run_state.owner, | 328 success = win_util::SaveFileAsWithFilter(params.run_state.owner, |
328 params.default_path.ToWStringHack(), params.filter, | 329 params.default_path.ToWStringHack(), params.filter, |
329 params.default_extension, false, &filter_index, &path.ToWStringHack()); | 330 params.default_extension, false, &filter_index, &path_as_wstring); |
| 331 if(success) { |
| 332 path = FilePath::FromWStringHack(path_as_wstring); |
| 333 } |
330 DisableOwner(params.run_state.owner); | 334 DisableOwner(params.run_state.owner); |
331 } else if (params.type == SELECT_OPEN_FILE) { | 335 } else if (params.type == SELECT_OPEN_FILE) { |
332 success = RunOpenFileDialog(params.title, params.filter, | 336 success = RunOpenFileDialog(params.title, params.filter, |
333 params.run_state.owner, &path); | 337 params.run_state.owner, &path); |
334 } else if (params.type == SELECT_OPEN_MULTI_FILE) { | 338 } else if (params.type == SELECT_OPEN_MULTI_FILE) { |
335 std::vector<FilePath> paths; | 339 std::vector<FilePath> paths; |
336 if (RunOpenMultiFileDialog(params.title, params.filter, | 340 if (RunOpenMultiFileDialog(params.title, params.filter, |
337 params.run_state.owner, &paths)) { | 341 params.run_state.owner, &paths)) { |
338 ui_loop_->PostTask(FROM_HERE, NewRunnableMethod(this, | 342 ui_loop_->PostTask(FROM_HERE, NewRunnableMethod(this, |
339 &SelectFileDialogImpl::MultiFilesSelected, | 343 &SelectFileDialogImpl::MultiFilesSelected, |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
687 void SelectFontDialogImpl::FontNotSelected(void* params, RunState run_state) { | 691 void SelectFontDialogImpl::FontNotSelected(void* params, RunState run_state) { |
688 if (listener_) | 692 if (listener_) |
689 listener_->FontSelectionCanceled(params); | 693 listener_->FontSelectionCanceled(params); |
690 EndRun(run_state); | 694 EndRun(run_state); |
691 } | 695 } |
692 | 696 |
693 // static | 697 // static |
694 SelectFontDialog* SelectFontDialog::Create(Listener* listener) { | 698 SelectFontDialog* SelectFontDialog::Create(Listener* listener) { |
695 return new SelectFontDialogImpl(listener); | 699 return new SelectFontDialogImpl(listener); |
696 } | 700 } |
OLD | NEW |