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

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

Issue 869233006: [net] Cleanup filename_util and make it portable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@clang-format-filename-tests
Patch Set: 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
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 1384 matching lines...) Expand 10 before | Expand all | Expand 10 after
1395 1395
1396 void SavePackage::OnPathPicked( 1396 void SavePackage::OnPathPicked(
1397 const base::FilePath& final_name, 1397 const base::FilePath& final_name,
1398 SavePageType type, 1398 SavePageType type,
1399 const SavePackageDownloadCreatedCallback& download_created_callback) { 1399 const SavePackageDownloadCreatedCallback& download_created_callback) {
1400 DCHECK((type == SAVE_PAGE_TYPE_AS_ONLY_HTML) || 1400 DCHECK((type == SAVE_PAGE_TYPE_AS_ONLY_HTML) ||
1401 (type == SAVE_PAGE_TYPE_AS_MHTML) || 1401 (type == SAVE_PAGE_TYPE_AS_MHTML) ||
1402 (type == SAVE_PAGE_TYPE_AS_COMPLETE_HTML)) << type; 1402 (type == SAVE_PAGE_TYPE_AS_COMPLETE_HTML)) << type;
1403 // Ensure the filename is safe. 1403 // Ensure the filename is safe.
1404 saved_main_file_path_ = final_name; 1404 saved_main_file_path_ = final_name;
1405 // TODO(asanka): This call may block on IO and shouldn't be made 1405 net::EnsureSafePortableFileName(std::string(),
1406 // from the UI thread. See http://crbug.com/61827. 1406 net::EXTENSION_OPTION_KEEP_EXISTING,
1407 net::GenerateSafeFileName(web_contents()->GetContentsMimeType(), false, 1407 &saved_main_file_path_);
1408 &saved_main_file_path_);
1409 1408
1410 saved_main_directory_path_ = saved_main_file_path_.DirName(); 1409 saved_main_directory_path_ = saved_main_file_path_.DirName();
1411 save_type_ = type; 1410 save_type_ = type;
1412 if (save_type_ == SAVE_PAGE_TYPE_AS_COMPLETE_HTML) { 1411 if (save_type_ == SAVE_PAGE_TYPE_AS_COMPLETE_HTML) {
1413 // Make new directory for saving complete file. 1412 // Make new directory for saving complete file.
1414 saved_main_directory_path_ = saved_main_directory_path_.Append( 1413 saved_main_directory_path_ = saved_main_directory_path_.Append(
1415 saved_main_file_path_.RemoveExtension().BaseName().value() + 1414 saved_main_file_path_.RemoveExtension().BaseName().value() +
1416 FILE_PATH_LITERAL("_files")); 1415 FILE_PATH_LITERAL("_files"));
1417 } 1416 }
1418 1417
(...skipping 15 matching lines...) Expand all
1434 1433
1435 void SavePackage::FinalizeDownloadEntry() { 1434 void SavePackage::FinalizeDownloadEntry() {
1436 DCHECK(download_); 1435 DCHECK(download_);
1437 DCHECK(download_manager_); 1436 DCHECK(download_manager_);
1438 1437
1439 download_manager_->OnSavePackageSuccessfullyFinished(download_); 1438 download_manager_->OnSavePackageSuccessfullyFinished(download_);
1440 StopObservation(); 1439 StopObservation();
1441 } 1440 }
1442 1441
1443 } // namespace content 1442 } // namespace content
OLDNEW
« no previous file with comments | « chrome/browser/download/download_target_determiner.cc ('k') | content/browser/web_contents/web_drag_source_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698