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

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

Issue 83002: download filename fix (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 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
OLDNEW
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 } 289 }
290 290
291 return true; 291 return true;
292 } 292 }
293 293
294 // Generate name for saving resource. 294 // Generate name for saving resource.
295 bool SavePackage::GenerateFilename(const std::string& disposition, 295 bool SavePackage::GenerateFilename(const std::string& disposition,
296 const GURL& url, 296 const GURL& url,
297 bool need_html_ext, 297 bool need_html_ext,
298 FilePath::StringType* generated_name) { 298 FilePath::StringType* generated_name) {
299 // TODO(jungshik): Figure out the referrer charset when having one
300 // makes sense and pass it to GetSuggestedFilename.
299 FilePath file_path = FilePath::FromWStringHack( 301 FilePath file_path = FilePath::FromWStringHack(
300 net::GetSuggestedFilename(url, disposition, kDefaultSaveName)); 302 net::GetSuggestedFilename(url, disposition, "", kDefaultSaveName));
301 303
302 DCHECK(!file_path.empty()); 304 DCHECK(!file_path.empty());
303 FilePath::StringType pure_file_name = 305 FilePath::StringType pure_file_name =
304 file_path.RemoveExtension().BaseName().value(); 306 file_path.RemoveExtension().BaseName().value();
305 FilePath::StringType file_name_ext = file_path.Extension(); 307 FilePath::StringType file_name_ext = file_path.Extension();
306 308
307 // If it is HTML resource, use ".htm" as its extension name. 309 // If it is HTML resource, use ".htm" as its extension name.
308 if (need_html_ext) 310 if (need_html_ext)
309 file_name_ext = FILE_PATH_LITERAL(".htm"); 311 file_name_ext = FILE_PATH_LITERAL(".htm");
310 312
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after
1144 int index, void* params) { 1146 int index, void* params) {
1145 SavePackageParam* save_params = reinterpret_cast<SavePackageParam*>(params); 1147 SavePackageParam* save_params = reinterpret_cast<SavePackageParam*>(params);
1146 ContinueSave(save_params, path, index); 1148 ContinueSave(save_params, path, index);
1147 delete save_params; 1149 delete save_params;
1148 } 1150 }
1149 1151
1150 void SavePackage::FileSelectionCanceled(void* params) { 1152 void SavePackage::FileSelectionCanceled(void* params) {
1151 SavePackageParam* save_params = reinterpret_cast<SavePackageParam*>(params); 1153 SavePackageParam* save_params = reinterpret_cast<SavePackageParam*>(params);
1152 delete save_params; 1154 delete save_params;
1153 } 1155 }
OLDNEW
« no previous file with comments | « chrome/browser/download/download_manager_unittest.cc ('k') | chrome/browser/history/download_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698