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

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

Issue 343014: Enable localization of default downloaded filename.... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 1 month 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 | « chrome/browser/cocoa/web_drag_source.mm ('k') | chrome/browser/download/save_package.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-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/download_manager.h" 5 #include "chrome/browser/download/download_manager.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after
1192 extension += append_extension; 1192 extension += append_extension;
1193 } 1193 }
1194 } 1194 }
1195 } 1195 }
1196 1196
1197 generated_extension->swap(extension); 1197 generated_extension->swap(extension);
1198 } 1198 }
1199 1199
1200 void DownloadManager::GenerateFilename(DownloadCreateInfo* info, 1200 void DownloadManager::GenerateFilename(DownloadCreateInfo* info,
1201 FilePath* generated_name) { 1201 FilePath* generated_name) {
1202 std::wstring default_name =
1203 l10n_util::GetString(IDS_DEFAULT_DOWNLOAD_FILENAME);
1204 #if defined(OS_WIN)
1205 FilePath default_file_path(default_name);
1206 #elif defined(OS_POSIX)
1207 FilePath default_file_path(base::SysWideToNativeMB(default_name));
1208 #endif
1209
1202 *generated_name = net::GetSuggestedFilename(GURL(info->url), 1210 *generated_name = net::GetSuggestedFilename(GURL(info->url),
1203 info->content_disposition, 1211 info->content_disposition,
1204 info->referrer_charset, 1212 info->referrer_charset,
1205 "download"); 1213 default_file_path);
1214
1206 DCHECK(!generated_name->empty()); 1215 DCHECK(!generated_name->empty());
1207 1216
1208 GenerateSafeFilename(info->mime_type, generated_name); 1217 GenerateSafeFilename(info->mime_type, generated_name);
1209 } 1218 }
1210 1219
1211 void DownloadManager::AddObserver(Observer* observer) { 1220 void DownloadManager::AddObserver(Observer* observer) {
1212 observers_.AddObserver(observer); 1221 observers_.AddObserver(observer);
1213 observer->ModelChanged(); 1222 observer->ModelChanged();
1214 } 1223 }
1215 1224
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
1535 1544
1536 if (contents) 1545 if (contents)
1537 contents->OnStartDownload(download); 1546 contents->OnStartDownload(download);
1538 } 1547 }
1539 1548
1540 // Clears the last download path, used to initialize "save as" dialogs. 1549 // Clears the last download path, used to initialize "save as" dialogs.
1541 void DownloadManager::ClearLastDownloadPath() { 1550 void DownloadManager::ClearLastDownloadPath() {
1542 last_download_path_ = FilePath(); 1551 last_download_path_ = FilePath();
1543 } 1552 }
1544 1553
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/web_drag_source.mm ('k') | chrome/browser/download/save_package.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698