Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(228)

Side by Side Diff: chrome/browser/download/save_package.cc

Issue 18699: Fix a bug when saving web pages that have a period in their title (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/views/shell_dialogs.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 &param->saved_main_file_path)) 959 &param->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 &param->saved_main_file_path)) 967 &param->saved_main_file_path))
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/views/shell_dialogs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698