OLD | NEW |
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 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1180 extension += append_extension; | 1180 extension += append_extension; |
1181 } | 1181 } |
1182 } | 1182 } |
1183 } | 1183 } |
1184 | 1184 |
1185 generated_extension->swap(extension); | 1185 generated_extension->swap(extension); |
1186 } | 1186 } |
1187 | 1187 |
1188 void DownloadManager::GenerateFilename(DownloadCreateInfo* info, | 1188 void DownloadManager::GenerateFilename(DownloadCreateInfo* info, |
1189 FilePath* generated_name) { | 1189 FilePath* generated_name) { |
| 1190 std::wstring default_name = |
| 1191 l10n_util::GetString(IDS_DEFAULT_DOWNLOAD_FILENAME); |
| 1192 #if defined(OS_WIN) |
| 1193 FilePath default_file_path(default_name); |
| 1194 #elif defined(OS_POSIX) |
| 1195 FilePath default_file_path(base::SysWideToNativeMB(default_name)); |
| 1196 #endif |
| 1197 |
1190 *generated_name = net::GetSuggestedFilename(GURL(info->url), | 1198 *generated_name = net::GetSuggestedFilename(GURL(info->url), |
1191 info->content_disposition, | 1199 info->content_disposition, |
1192 info->referrer_charset, | 1200 info->referrer_charset, |
1193 "download"); | 1201 default_file_path); |
| 1202 |
1194 DCHECK(!generated_name->empty()); | 1203 DCHECK(!generated_name->empty()); |
1195 | 1204 |
1196 GenerateSafeFilename(info->mime_type, generated_name); | 1205 GenerateSafeFilename(info->mime_type, generated_name); |
1197 } | 1206 } |
1198 | 1207 |
1199 void DownloadManager::AddObserver(Observer* observer) { | 1208 void DownloadManager::AddObserver(Observer* observer) { |
1200 observers_.AddObserver(observer); | 1209 observers_.AddObserver(observer); |
1201 observer->ModelChanged(); | 1210 observer->ModelChanged(); |
1202 } | 1211 } |
1203 | 1212 |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1571 | 1580 |
1572 if (contents) | 1581 if (contents) |
1573 contents->OnStartDownload(download); | 1582 contents->OnStartDownload(download); |
1574 } | 1583 } |
1575 | 1584 |
1576 // Clears the last download path, used to initialize "save as" dialogs. | 1585 // Clears the last download path, used to initialize "save as" dialogs. |
1577 void DownloadManager::ClearLastDownloadPath() { | 1586 void DownloadManager::ClearLastDownloadPath() { |
1578 last_download_path_ = FilePath(); | 1587 last_download_path_ = FilePath(); |
1579 } | 1588 } |
1580 | 1589 |
OLD | NEW |