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

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

Issue 869823003: Update ReplaceIllegalCharactersInPath to handle quirks in HFS+ and VFS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unnecessary #if def Created 5 years, 10 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
« no previous file with comments | « base/i18n/file_util_icu_unittest.cc ('k') | content/browser/download/save_package_unittest.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) 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/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 1224 matching lines...) Expand 10 before | Expand all | Expand 10 after
1235 } 1235 }
1236 1236
1237 // Ask user for getting final saving name. 1237 // Ask user for getting final saving name.
1238 name_with_proper_ext = EnsureMimeExtension(name_with_proper_ext, 1238 name_with_proper_ext = EnsureMimeExtension(name_with_proper_ext,
1239 contents_mime_type); 1239 contents_mime_type);
1240 // Adjust extension for complete types. 1240 // Adjust extension for complete types.
1241 if (can_save_as_complete) 1241 if (can_save_as_complete)
1242 name_with_proper_ext = EnsureHtmlExtension(name_with_proper_ext); 1242 name_with_proper_ext = EnsureHtmlExtension(name_with_proper_ext);
1243 1243
1244 base::FilePath::StringType file_name = name_with_proper_ext.value(); 1244 base::FilePath::StringType file_name = name_with_proper_ext.value();
1245 base::i18n::ReplaceIllegalCharactersInPath(&file_name, ' '); 1245 base::i18n::ReplaceIllegalCharactersInPath(&file_name, '_');
1246 return base::FilePath(file_name); 1246 return base::FilePath(file_name);
1247 } 1247 }
1248 1248
1249 base::FilePath SavePackage::EnsureHtmlExtension(const base::FilePath& name) { 1249 base::FilePath SavePackage::EnsureHtmlExtension(const base::FilePath& name) {
1250 // If the file name doesn't have an extension suitable for HTML files, 1250 // If the file name doesn't have an extension suitable for HTML files,
1251 // append one. 1251 // append one.
1252 base::FilePath::StringType ext = name.Extension(); 1252 base::FilePath::StringType ext = name.Extension();
1253 if (!ext.empty()) 1253 if (!ext.empty())
1254 ext.erase(ext.begin()); // Erase preceding '.'. 1254 ext.erase(ext.begin()); // Erase preceding '.'.
1255 std::string mime_type; 1255 std::string mime_type;
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
1434 1434
1435 void SavePackage::FinalizeDownloadEntry() { 1435 void SavePackage::FinalizeDownloadEntry() {
1436 DCHECK(download_); 1436 DCHECK(download_);
1437 DCHECK(download_manager_); 1437 DCHECK(download_manager_);
1438 1438
1439 download_manager_->OnSavePackageSuccessfullyFinished(download_); 1439 download_manager_->OnSavePackageSuccessfullyFinished(download_);
1440 StopObservation(); 1440 StopObservation();
1441 } 1441 }
1442 1442
1443 } // namespace content 1443 } // namespace content
OLDNEW
« no previous file with comments | « base/i18n/file_util_icu_unittest.cc ('k') | content/browser/download/save_package_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698