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/download/save_package.h" | 5 #include "chrome/browser/download/save_package.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
940 // If the contents can not be saved as complete-HTML, do not show the | 940 // If the contents can not be saved as complete-HTML, do not show the |
941 // file filters. | 941 // file filters. |
942 if (CanSaveAsComplete(param->current_tab_mime_type)) { | 942 if (CanSaveAsComplete(param->current_tab_mime_type)) { |
943 // Create filter string. | 943 // Create filter string. |
944 std::wstring filter = l10n_util::GetString(IDS_SAVE_PAGE_FILTER); | 944 std::wstring filter = l10n_util::GetString(IDS_SAVE_PAGE_FILTER); |
945 filter.resize(filter.size() + 2); | 945 filter.resize(filter.size() + 2); |
946 filter[filter.size() - 1] = L'\0'; | 946 filter[filter.size() - 1] = L'\0'; |
947 filter[filter.size() - 2] = L'\0'; | 947 filter[filter.size() - 2] = L'\0'; |
948 | 948 |
949 if (g_should_prompt_for_filename) { | 949 if (g_should_prompt_for_filename) { |
| 950 // Since we take the suggested name from the web page's title, we want to |
| 951 // ignore the file extension generated by SaveFileAsWithFilter, since it |
| 952 // will always be ".htm". |
950 if (!win_util::SaveFileAsWithFilter(container_hwnd, | 953 if (!win_util::SaveFileAsWithFilter(container_hwnd, |
951 suggest_name, | 954 suggest_name, |
952 filter, | 955 filter, |
953 L"htm", | 956 L"htm", |
| 957 true, |
954 &index, | 958 &index, |
955 ¶m->saved_main_file_path)) | 959 ¶m->saved_main_file_path)) |
956 return false; | 960 return false; |
957 } else { | 961 } else { |
958 param->saved_main_file_path = suggest_name; | 962 param->saved_main_file_path = suggest_name; |
959 } | 963 } |
960 } else { | 964 } else { |
961 if (g_should_prompt_for_filename) { | 965 if (g_should_prompt_for_filename) { |
962 if (!win_util::SaveFileAs(container_hwnd, suggest_name, | 966 if (!win_util::SaveFileAs(container_hwnd, suggest_name, |
963 ¶m->saved_main_file_path)) | 967 ¶m->saved_main_file_path)) |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1093 | 1097 |
1094 if (available_length > dir_path_length) { | 1098 if (available_length > dir_path_length) { |
1095 *pure_file_name = | 1099 *pure_file_name = |
1096 pure_file_name->substr(0, available_length - dir_path_length); | 1100 pure_file_name->substr(0, available_length - dir_path_length); |
1097 return true; | 1101 return true; |
1098 } else { | 1102 } else { |
1099 pure_file_name->clear(); | 1103 pure_file_name->clear(); |
1100 return false; | 1104 return false; |
1101 } | 1105 } |
1102 } | 1106 } |
OLD | NEW |