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

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

Issue 12767006: [Cleanup] Remove StringPrintf from global namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase, once more Created 7 years, 9 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 | Annotate | Revision Log
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/file_util.h" 10 #include "base/file_util.h"
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 file_util::CreateTemporaryFile(&temp_file); 508 file_util::CreateTemporaryFile(&temp_file);
509 file_name = temp_file.RemoveExtension().BaseName().value(); 509 file_name = temp_file.RemoveExtension().BaseName().value();
510 // Get safe pure file name. 510 // Get safe pure file name.
511 if (!GetSafePureFileName(saved_main_directory_path_, 511 if (!GetSafePureFileName(saved_main_directory_path_,
512 base::FilePath::StringType(), 512 base::FilePath::StringType(),
513 max_path, &file_name)) 513 max_path, &file_name))
514 return false; 514 return false;
515 } else { 515 } else {
516 for (int i = ordinal_number; i < kMaxFileOrdinalNumber; ++i) { 516 for (int i = ordinal_number; i < kMaxFileOrdinalNumber; ++i) {
517 base::FilePath::StringType new_name = base_file_name + 517 base::FilePath::StringType new_name = base_file_name +
518 StringPrintf(FILE_PATH_LITERAL("(%d)"), i) + file_name_ext; 518 base::StringPrintf(FILE_PATH_LITERAL("(%d)"), i) + file_name_ext;
519 if (file_name_set_.find(new_name) == file_name_set_.end()) { 519 if (file_name_set_.find(new_name) == file_name_set_.end()) {
520 // Resolved name conflict. 520 // Resolved name conflict.
521 file_name = new_name; 521 file_name = new_name;
522 file_name_count_map_[base_file_name] = ++i; 522 file_name_count_map_[base_file_name] = ++i;
523 break; 523 break;
524 } 524 }
525 } 525 }
526 } 526 }
527 527
528 file_name_set_.insert(file_name); 528 file_name_set_.insert(file_name);
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after
1427 1427
1428 void SavePackage::FinalizeDownloadEntry() { 1428 void SavePackage::FinalizeDownloadEntry() {
1429 DCHECK(download_); 1429 DCHECK(download_);
1430 DCHECK(download_manager_); 1430 DCHECK(download_manager_);
1431 1431
1432 download_manager_->OnSavePackageSuccessfullyFinished(download_); 1432 download_manager_->OnSavePackageSuccessfullyFinished(download_);
1433 StopObservation(); 1433 StopObservation();
1434 } 1434 }
1435 1435
1436 } // namespace content 1436 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698