| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 return metro_get_save_file_name(ofn) == TRUE; | 79 return metro_get_save_file_name(ofn) == TRUE; |
| 80 } else { | 80 } else { |
| 81 return GetSaveFileName(ofn) == TRUE; | 81 return GetSaveFileName(ofn) == TRUE; |
| 82 } | 82 } |
| 83 } | 83 } |
| 84 | 84 |
| 85 // Distinguish directories from regular files. | 85 // Distinguish directories from regular files. |
| 86 bool IsDirectory(const base::FilePath& path) { | 86 bool IsDirectory(const base::FilePath& path) { |
| 87 base::PlatformFileInfo file_info; | 87 base::PlatformFileInfo file_info; |
| 88 return file_util::GetFileInfo(path, &file_info) ? | 88 return file_util::GetFileInfo(path, &file_info) ? |
| 89 file_info.is_directory : file_util::EndsWithSeparator(path); | 89 file_info.is_directory : path.EndsWithSeparator(); |
| 90 } | 90 } |
| 91 | 91 |
| 92 // Get the file type description from the registry. This will be "Text Document" | 92 // Get the file type description from the registry. This will be "Text Document" |
| 93 // for .txt files, "JPEG Image" for .jpg files, etc. If the registry doesn't | 93 // for .txt files, "JPEG Image" for .jpg files, etc. If the registry doesn't |
| 94 // have an entry for the file type, we return false, true if the description was | 94 // have an entry for the file type, we return false, true if the description was |
| 95 // found. 'file_ext' must be in form ".txt". | 95 // found. 'file_ext' must be in form ".txt". |
| 96 static bool GetRegistryDescriptionFromExtension(const std::wstring& file_ext, | 96 static bool GetRegistryDescriptionFromExtension(const std::wstring& file_ext, |
| 97 std::wstring* reg_description) { | 97 std::wstring* reg_description) { |
| 98 DCHECK(reg_description); | 98 DCHECK(reg_description); |
| 99 base::win::RegKey reg_ext(HKEY_CLASSES_ROOT, file_ext.c_str(), KEY_READ); | 99 base::win::RegKey reg_ext(HKEY_CLASSES_ROOT, file_ext.c_str(), KEY_READ); |
| (...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 914 return return_value; | 914 return return_value; |
| 915 } | 915 } |
| 916 | 916 |
| 917 SelectFileDialog* CreateWinSelectFileDialog( | 917 SelectFileDialog* CreateWinSelectFileDialog( |
| 918 SelectFileDialog::Listener* listener, | 918 SelectFileDialog::Listener* listener, |
| 919 SelectFilePolicy* policy) { | 919 SelectFilePolicy* policy) { |
| 920 return new SelectFileDialogImpl(listener, policy); | 920 return new SelectFileDialogImpl(listener, policy); |
| 921 } | 921 } |
| 922 | 922 |
| 923 } // namespace ui | 923 } // namespace ui |
| OLD | NEW |