Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/browser/download/download_file.h" | 5 #include "chrome/browser/download/download_file.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/stl_util-inl.h" | 9 #include "base/stl_util-inl.h" |
| 10 #include "base/task.h" | 10 #include "base/task.h" |
| (...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 577 const std::string& referrer_charset, | 577 const std::string& referrer_charset, |
| 578 const DownloadSaveInfo& save_info, | 578 const DownloadSaveInfo& save_info, |
| 579 int render_process_host_id, | 579 int render_process_host_id, |
| 580 int render_view_id, | 580 int render_view_id, |
| 581 URLRequestContextGetter* request_context_getter) { | 581 URLRequestContextGetter* request_context_getter) { |
| 582 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); | 582 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); |
| 583 | 583 |
| 584 URLRequestContext* context = request_context_getter->GetURLRequestContext(); | 584 URLRequestContext* context = request_context_getter->GetURLRequestContext(); |
| 585 context->set_referrer_charset(referrer_charset); | 585 context->set_referrer_charset(referrer_charset); |
| 586 | 586 |
| 587 // Show "Save As" UI. | |
| 588 bool prompt_for_save_location = true; | |
|
Jay Civelli
2010/07/12 22:51:44
Nit: are you using a local var for commenting purp
| |
| 587 resource_dispatcher_host_->BeginDownload(url, | 589 resource_dispatcher_host_->BeginDownload(url, |
| 588 referrer, | 590 referrer, |
| 589 save_info, | 591 save_info, |
| 592 prompt_for_save_location, | |
| 590 render_process_host_id, | 593 render_process_host_id, |
| 591 render_view_id, | 594 render_view_id, |
| 592 context); | 595 context); |
| 593 } | 596 } |
| 594 | 597 |
| 595 // Actions from the UI thread and run on the download thread | 598 // Actions from the UI thread and run on the download thread |
| 596 | 599 |
| 597 // Open a download, or show it in a file explorer window. We run on this | 600 // Open a download, or show it in a file explorer window. We run on this |
| 598 // thread to avoid blocking the UI with (potentially) slow Shell operations. | 601 // thread to avoid blocking the UI with (potentially) slow Shell operations. |
| 599 // TODO(paulg): File 'stat' operations. | 602 // TODO(paulg): File 'stat' operations. |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 680 NewRunnableMethod(this, &DownloadFileManager::StopUpdateTimer)); | 683 NewRunnableMethod(this, &DownloadFileManager::StopUpdateTimer)); |
| 681 } | 684 } |
| 682 } | 685 } |
| 683 | 686 |
| 684 // static | 687 // static |
| 685 void DownloadFileManager::DeleteFile(const FilePath& path) { | 688 void DownloadFileManager::DeleteFile(const FilePath& path) { |
| 686 // Make sure we only delete files. | 689 // Make sure we only delete files. |
| 687 if (!file_util::DirectoryExists(path)) | 690 if (!file_util::DirectoryExists(path)) |
| 688 file_util::Delete(path, false); | 691 file_util::Delete(path, false); |
| 689 } | 692 } |
| OLD | NEW |