OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/download/save_package.h" | 5 #include "content/browser/download/save_package.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 1226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1237 } | 1237 } |
1238 | 1238 |
1239 // Ask user for getting final saving name. | 1239 // Ask user for getting final saving name. |
1240 name_with_proper_ext = EnsureMimeExtension(name_with_proper_ext, | 1240 name_with_proper_ext = EnsureMimeExtension(name_with_proper_ext, |
1241 contents_mime_type); | 1241 contents_mime_type); |
1242 // Adjust extension for complete types. | 1242 // Adjust extension for complete types. |
1243 if (can_save_as_complete) | 1243 if (can_save_as_complete) |
1244 name_with_proper_ext = EnsureHtmlExtension(name_with_proper_ext); | 1244 name_with_proper_ext = EnsureHtmlExtension(name_with_proper_ext); |
1245 | 1245 |
1246 base::FilePath::StringType file_name = name_with_proper_ext.value(); | 1246 base::FilePath::StringType file_name = name_with_proper_ext.value(); |
1247 file_util::ReplaceIllegalCharactersInPath(&file_name, ' '); | 1247 base::i18n::ReplaceIllegalCharactersInPath(&file_name, ' '); |
1248 return base::FilePath(file_name); | 1248 return base::FilePath(file_name); |
1249 } | 1249 } |
1250 | 1250 |
1251 base::FilePath SavePackage::EnsureHtmlExtension(const base::FilePath& name) { | 1251 base::FilePath SavePackage::EnsureHtmlExtension(const base::FilePath& name) { |
1252 // If the file name doesn't have an extension suitable for HTML files, | 1252 // If the file name doesn't have an extension suitable for HTML files, |
1253 // append one. | 1253 // append one. |
1254 base::FilePath::StringType ext = name.Extension(); | 1254 base::FilePath::StringType ext = name.Extension(); |
1255 if (!ext.empty()) | 1255 if (!ext.empty()) |
1256 ext.erase(ext.begin()); // Erase preceding '.'. | 1256 ext.erase(ext.begin()); // Erase preceding '.'. |
1257 std::string mime_type; | 1257 std::string mime_type; |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1440 | 1440 |
1441 void SavePackage::FinalizeDownloadEntry() { | 1441 void SavePackage::FinalizeDownloadEntry() { |
1442 DCHECK(download_); | 1442 DCHECK(download_); |
1443 DCHECK(download_manager_); | 1443 DCHECK(download_manager_); |
1444 | 1444 |
1445 download_manager_->OnSavePackageSuccessfullyFinished(download_); | 1445 download_manager_->OnSavePackageSuccessfullyFinished(download_); |
1446 StopObservation(); | 1446 StopObservation(); |
1447 } | 1447 } |
1448 | 1448 |
1449 } // namespace content | 1449 } // namespace content |
OLD | NEW |