| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/utility/ipc_shell_handler_win.h" | 5 #include "chrome/utility/ipc_shell_handler_win.h" |
| 6 | 6 |
| 7 #include <commdlg.h> | 7 #include <commdlg.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 const ChromeUtilityMsg_GetSaveFileName_Params& params) { | 54 const ChromeUtilityMsg_GetSaveFileName_Params& params) { |
| 55 ui::win::OpenFileName open_file_name(params.owner, params.flags); | 55 ui::win::OpenFileName open_file_name(params.owner, params.flags); |
| 56 open_file_name.SetInitialSelection(params.initial_directory, | 56 open_file_name.SetInitialSelection(params.initial_directory, |
| 57 params.suggested_filename); | 57 params.suggested_filename); |
| 58 open_file_name.SetFilters(params.filters); | 58 open_file_name.SetFilters(params.filters); |
| 59 open_file_name.GetOPENFILENAME()->nFilterIndex = | 59 open_file_name.GetOPENFILENAME()->nFilterIndex = |
| 60 params.one_based_filter_index; | 60 params.one_based_filter_index; |
| 61 open_file_name.GetOPENFILENAME()->lpstrDefExt = | 61 open_file_name.GetOPENFILENAME()->lpstrDefExt = |
| 62 params.default_extension.c_str(); | 62 params.default_extension.c_str(); |
| 63 | 63 |
| 64 open_file_name.MaybeInstallWindowPositionHookForSaveAsOnXP(); | |
| 65 | |
| 66 if (::GetSaveFileName(open_file_name.GetOPENFILENAME())) { | 64 if (::GetSaveFileName(open_file_name.GetOPENFILENAME())) { |
| 67 content::UtilityThread::Get()->Send( | 65 content::UtilityThread::Get()->Send( |
| 68 new ChromeUtilityHostMsg_GetSaveFileName_Result( | 66 new ChromeUtilityHostMsg_GetSaveFileName_Result( |
| 69 base::FilePath(open_file_name.GetOPENFILENAME()->lpstrFile), | 67 base::FilePath(open_file_name.GetOPENFILENAME()->lpstrFile), |
| 70 open_file_name.GetOPENFILENAME()->nFilterIndex)); | 68 open_file_name.GetOPENFILENAME()->nFilterIndex)); |
| 71 return; | 69 return; |
| 72 } | 70 } |
| 73 | 71 |
| 74 // Zero means the dialog was closed, otherwise we had an error. | 72 // Zero means the dialog was closed, otherwise we had an error. |
| 75 DWORD error_code = ::CommDlgExtendedError(); | 73 DWORD error_code = ::CommDlgExtendedError(); |
| 76 if (error_code != 0) | 74 if (error_code != 0) |
| 77 NOTREACHED() << "GetSaveFileName failed with code: " << error_code; | 75 NOTREACHED() << "GetSaveFileName failed with code: " << error_code; |
| 78 | 76 |
| 79 content::UtilityThread::Get()->Send( | 77 content::UtilityThread::Get()->Send( |
| 80 new ChromeUtilityHostMsg_GetSaveFileName_Failed()); | 78 new ChromeUtilityHostMsg_GetSaveFileName_Failed()); |
| 81 } | 79 } |
| OLD | NEW |