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 "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #include "content/browser/download/save_file_manager.h" | 7 #include "content/browser/download/save_file_manager.h" |
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 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 } | 474 } |
475 | 475 |
476 void SaveFileManager::RenameAllFiles( | 476 void SaveFileManager::RenameAllFiles( |
477 const FinalNameList& final_names, | 477 const FinalNameList& final_names, |
478 const base::FilePath& resource_dir, | 478 const base::FilePath& resource_dir, |
479 int render_process_id, | 479 int render_process_id, |
480 int render_view_id, | 480 int render_view_id, |
481 int save_package_id) { | 481 int save_package_id) { |
482 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 482 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
483 | 483 |
484 if (!resource_dir.empty() && !file_util::PathExists(resource_dir)) | 484 if (!resource_dir.empty() && !base::PathExists(resource_dir)) |
485 file_util::CreateDirectory(resource_dir); | 485 file_util::CreateDirectory(resource_dir); |
486 | 486 |
487 for (FinalNameList::const_iterator i = final_names.begin(); | 487 for (FinalNameList::const_iterator i = final_names.begin(); |
488 i != final_names.end(); ++i) { | 488 i != final_names.end(); ++i) { |
489 SaveFileMap::iterator it = save_file_map_.find(i->first); | 489 SaveFileMap::iterator it = save_file_map_.find(i->first); |
490 if (it != save_file_map_.end()) { | 490 if (it != save_file_map_.end()) { |
491 SaveFile* save_file = it->second; | 491 SaveFile* save_file = it->second; |
492 DCHECK(!save_file->InProgress()); | 492 DCHECK(!save_file->InProgress()); |
493 save_file->Rename(i->second); | 493 save_file->Rename(i->second); |
494 delete save_file; | 494 delete save_file; |
(...skipping 30 matching lines...) Expand all Loading... |
525 SaveFile* save_file = it->second; | 525 SaveFile* save_file = it->second; |
526 DCHECK(!save_file->InProgress()); | 526 DCHECK(!save_file->InProgress()); |
527 base::Delete(save_file->FullPath(), false); | 527 base::Delete(save_file->FullPath(), false); |
528 delete save_file; | 528 delete save_file; |
529 save_file_map_.erase(it); | 529 save_file_map_.erase(it); |
530 } | 530 } |
531 } | 531 } |
532 } | 532 } |
533 | 533 |
534 } // namespace content | 534 } // namespace content |
OLD | NEW |