| 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 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1205 extension += append_extension; | 1205 extension += append_extension; |
| 1206 } | 1206 } |
| 1207 } | 1207 } |
| 1208 } | 1208 } |
| 1209 | 1209 |
| 1210 generated_extension->swap(extension); | 1210 generated_extension->swap(extension); |
| 1211 } | 1211 } |
| 1212 | 1212 |
| 1213 void DownloadManager::GenerateFilename(DownloadCreateInfo* info, | 1213 void DownloadManager::GenerateFilename(DownloadCreateInfo* info, |
| 1214 FilePath* generated_name) { | 1214 FilePath* generated_name) { |
| 1215 *generated_name = FilePath::FromWStringHack( | 1215 *generated_name = net::GetSuggestedFilename(GURL(info->url), |
| 1216 net::GetSuggestedFilename(GURL(info->url), | 1216 info->content_disposition, |
| 1217 info->content_disposition, | 1217 info->referrer_charset, |
| 1218 info->referrer_charset, | 1218 "download"); |
| 1219 L"download")); | |
| 1220 DCHECK(!generated_name->empty()); | 1219 DCHECK(!generated_name->empty()); |
| 1221 | 1220 |
| 1222 GenerateSafeFilename(info->mime_type, generated_name); | 1221 GenerateSafeFilename(info->mime_type, generated_name); |
| 1223 } | 1222 } |
| 1224 | 1223 |
| 1225 void DownloadManager::AddObserver(Observer* observer) { | 1224 void DownloadManager::AddObserver(Observer* observer) { |
| 1226 observers_.AddObserver(observer); | 1225 observers_.AddObserver(observer); |
| 1227 observer->ModelChanged(); | 1226 observer->ModelChanged(); |
| 1228 } | 1227 } |
| 1229 | 1228 |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1549 | 1548 |
| 1550 if (contents) | 1549 if (contents) |
| 1551 contents->OnStartDownload(download); | 1550 contents->OnStartDownload(download); |
| 1552 } | 1551 } |
| 1553 | 1552 |
| 1554 // Clears the last download path, used to initialize "save as" dialogs. | 1553 // Clears the last download path, used to initialize "save as" dialogs. |
| 1555 void DownloadManager::ClearLastDownloadPath() { | 1554 void DownloadManager::ClearLastDownloadPath() { |
| 1556 last_download_path_ = FilePath(); | 1555 last_download_path_ = FilePath(); |
| 1557 } | 1556 } |
| 1558 | 1557 |
| OLD | NEW |