| 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/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 base::FilePath temp_file; | 520 base::FilePath temp_file; |
| 521 base::CreateTemporaryFile(&temp_file); | 521 base::CreateTemporaryFile(&temp_file); |
| 522 file_name = temp_file.RemoveExtension().BaseName().value(); | 522 file_name = temp_file.RemoveExtension().BaseName().value(); |
| 523 // Get safe pure file name. | 523 // Get safe pure file name. |
| 524 if (!GetSafePureFileName(saved_main_directory_path_, | 524 if (!GetSafePureFileName(saved_main_directory_path_, |
| 525 base::FilePath::StringType(), | 525 base::FilePath::StringType(), |
| 526 max_path, &file_name)) | 526 max_path, &file_name)) |
| 527 return false; | 527 return false; |
| 528 } else { | 528 } else { |
| 529 for (int i = ordinal_number; i < kMaxFileOrdinalNumber; ++i) { | 529 for (int i = ordinal_number; i < kMaxFileOrdinalNumber; ++i) { |
| 530 base::FilePath::StringType new_name = base_file_name + | 530 base::FilePath::StringType new_name = base_file_name/* + |
| 531 base::StringPrintf(FILE_PATH_LITERAL("(%d)"), i) + file_name_ext; | 531 base::StringPrintf(FILE_PATH_LITERAL("(%d)"), i) + file_name_ext*/; |
| 532 if (file_name_set_.find(new_name) == file_name_set_.end()) { | 532 if (file_name_set_.find(new_name) == file_name_set_.end()) { |
| 533 // Resolved name conflict. | 533 // Resolved name conflict. |
| 534 file_name = new_name; | 534 file_name = new_name; |
| 535 file_name_count_map_[base_file_name] = ++i; | 535 file_name_count_map_[base_file_name] = ++i; |
| 536 break; | 536 break; |
| 537 } | 537 } |
| 538 } | 538 } |
| 539 } | 539 } |
| 540 | 540 |
| 541 file_name_set_.insert(file_name); | 541 file_name_set_.insert(file_name); |
| (...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1505 | 1505 |
| 1506 void SavePackage::FinalizeDownloadEntry() { | 1506 void SavePackage::FinalizeDownloadEntry() { |
| 1507 DCHECK(download_); | 1507 DCHECK(download_); |
| 1508 DCHECK(download_manager_); | 1508 DCHECK(download_manager_); |
| 1509 | 1509 |
| 1510 download_manager_->OnSavePackageSuccessfullyFinished(download_); | 1510 download_manager_->OnSavePackageSuccessfullyFinished(download_); |
| 1511 StopObservation(); | 1511 StopObservation(); |
| 1512 } | 1512 } |
| 1513 | 1513 |
| 1514 } // namespace content | 1514 } // namespace content |
| OLD | NEW |