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 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 DCHECK(original_file_url.SchemeIsFile()); | 452 DCHECK(original_file_url.SchemeIsFile()); |
453 base::FilePath file_path; | 453 base::FilePath file_path; |
454 net::FileURLToFilePath(original_file_url, &file_path); | 454 net::FileURLToFilePath(original_file_url, &file_path); |
455 // If we can not get valid file path from original URL, treat it as | 455 // If we can not get valid file path from original URL, treat it as |
456 // disk error. | 456 // disk error. |
457 if (file_path.empty()) | 457 if (file_path.empty()) |
458 SaveFinished(save_id, original_file_url, render_process_id, false); | 458 SaveFinished(save_id, original_file_url, render_process_id, false); |
459 | 459 |
460 // Copy the local file to the temporary file. It will be renamed to its | 460 // Copy the local file to the temporary file. It will be renamed to its |
461 // final name later. | 461 // final name later. |
462 bool success = file_util::CopyFile(file_path, save_file->FullPath()); | 462 bool success = base::CopyFile(file_path, save_file->FullPath()); |
463 if (!success) | 463 if (!success) |
464 base::Delete(save_file->FullPath(), false); | 464 base::Delete(save_file->FullPath(), false); |
465 SaveFinished(save_id, original_file_url, render_process_id, success); | 465 SaveFinished(save_id, original_file_url, render_process_id, success); |
466 } | 466 } |
467 | 467 |
468 void SaveFileManager::OnDeleteDirectoryOrFile(const base::FilePath& full_path, | 468 void SaveFileManager::OnDeleteDirectoryOrFile(const base::FilePath& full_path, |
469 bool is_dir) { | 469 bool is_dir) { |
470 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 470 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
471 DCHECK(!full_path.empty()); | 471 DCHECK(!full_path.empty()); |
472 | 472 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |