| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/shell_dialogs.h" | 5 #include "chrome/browser/ui/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 | 10 |
| 11 #include <algorithm> | 11 #include <algorithm> |
| 12 #include <set> | 12 #include <set> |
| 13 | 13 |
| 14 #include "base/bind.h" | 14 #include "base/bind.h" |
| 15 #include "base/file_path.h" | 15 #include "base/file_path.h" |
| 16 #include "base/file_util.h" | 16 #include "base/file_util.h" |
| 17 #include "base/i18n/case_conversion.h" | 17 #include "base/i18n/case_conversion.h" |
| 18 #include "base/message_loop.h" | 18 #include "base/message_loop.h" |
| 19 #include "base/string_split.h" | 19 #include "base/string_split.h" |
| 20 #include "base/threading/thread.h" | 20 #include "base/threading/thread.h" |
| 21 #include "base/utf_string_conversions.h" | 21 #include "base/utf_string_conversions.h" |
| 22 #include "base/win/registry.h" | 22 #include "base/win/registry.h" |
| 23 #include "base/win/scoped_comptr.h" | 23 #include "base/win/scoped_comptr.h" |
| 24 #include "base/win/windows_version.h" | 24 #include "base/win/windows_version.h" |
| 25 #include "content/public/browser/browser_thread.h" | 25 #include "content/public/browser/browser_thread.h" |
| 26 #include "grit/generated_resources.h" | 26 #include "grit/generated_resources.h" |
| 27 #include "grit/ui_strings.h" | 27 #include "grit/ui_strings.h" |
| 28 #include "ui/base/l10n/l10n_util.h" | 28 #include "ui/base/l10n/l10n_util.h" |
| 29 | 29 |
| 30 using content::BrowserThread; |
| 31 |
| 30 // This function takes the output of a SaveAs dialog: a filename, a filter and | 32 // This function takes the output of a SaveAs dialog: a filename, a filter and |
| 31 // the extension originally suggested to the user (shown in the dialog box) and | 33 // the extension originally suggested to the user (shown in the dialog box) and |
| 32 // returns back the filename with the appropriate extension tacked on. If the | 34 // returns back the filename with the appropriate extension tacked on. If the |
| 33 // user requests an unknown extension and is not using the 'All files' filter, | 35 // user requests an unknown extension and is not using the 'All files' filter, |
| 34 // the suggested extension will be appended, otherwise we will leave the | 36 // the suggested extension will be appended, otherwise we will leave the |
| 35 // filename unmodified. |filename| should contain the filename selected in the | 37 // filename unmodified. |filename| should contain the filename selected in the |
| 36 // SaveAs dialog box and may include the path, |filter_selected| should be | 38 // SaveAs dialog box and may include the path, |filter_selected| should be |
| 37 // '*.something', for example '*.*' or it can be blank (which is treated as | 39 // '*.something', for example '*.*' or it can be blank (which is treated as |
| 38 // *.*). |suggested_ext| should contain the extension without the dot (.) in | 40 // *.*). |suggested_ext| should contain the extension without the dot (.) in |
| 39 // front, for example 'jpg'. | 41 // front, for example 'jpg'. |
| (...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 949 } | 951 } |
| 950 } | 952 } |
| 951 } | 953 } |
| 952 return success; | 954 return success; |
| 953 } | 955 } |
| 954 | 956 |
| 955 // static | 957 // static |
| 956 SelectFileDialog* SelectFileDialog::Create(Listener* listener) { | 958 SelectFileDialog* SelectFileDialog::Create(Listener* listener) { |
| 957 return new SelectFileDialogImpl(listener); | 959 return new SelectFileDialogImpl(listener); |
| 958 } | 960 } |
| OLD | NEW |