| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_manager.h" | 5 #include "chrome/browser/download/download_file_manager.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 | 310 |
| 311 // The DownloadManager in the UI thread has provided a final name for the | 311 // The DownloadManager in the UI thread has provided a final name for the |
| 312 // download specified by 'id'. Rename the in progress download, and remove it | 312 // download specified by 'id'. Rename the in progress download, and remove it |
| 313 // from our table if it has been completed or cancelled already. | 313 // from our table if it has been completed or cancelled already. |
| 314 // |need_delete_crdownload| indicates if we explicitly delete an intermediate | 314 // |need_delete_crdownload| indicates if we explicitly delete an intermediate |
| 315 // .crdownload file or not. | 315 // .crdownload file or not. |
| 316 // | 316 // |
| 317 // There are 3 possible rename cases where this method can be called: | 317 // There are 3 possible rename cases where this method can be called: |
| 318 // 1. tmp -> foo (need_delete_crdownload=T) | 318 // 1. tmp -> foo (need_delete_crdownload=T) |
| 319 // 2. foo.crdownload -> foo (need_delete_crdownload=F) | 319 // 2. foo.crdownload -> foo (need_delete_crdownload=F) |
| 320 // 3. tmp-> unconfirmed.xxx.crdownload (need_delete_crdownload=F) | 320 // 3. tmp-> Unconfirmed.xxx.crdownload (need_delete_crdownload=F) |
| 321 void DownloadFileManager::OnFinalDownloadName( | 321 void DownloadFileManager::OnFinalDownloadName( |
| 322 int id, const FilePath& full_path, bool need_delete_crdownload, | 322 int id, const FilePath& full_path, bool need_delete_crdownload, |
| 323 DownloadManager* download_manager) { | 323 DownloadManager* download_manager) { |
| 324 VLOG(20) << __FUNCTION__ << "()" << " id = " << id | 324 VLOG(20) << __FUNCTION__ << "()" << " id = " << id |
| 325 << " full_path = \"" << full_path.value() << "\"" | 325 << " full_path = \"" << full_path.value() << "\"" |
| 326 << " need_delete_crdownload = " << need_delete_crdownload; | 326 << " need_delete_crdownload = " << need_delete_crdownload; |
| 327 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 327 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 328 | 328 |
| 329 DownloadFile* download = GetDownloadFile(id); | 329 DownloadFile* download = GetDownloadFile(id); |
| 330 if (!download) | 330 if (!download) |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 if (!download_manager) { | 374 if (!download_manager) { |
| 375 download->CancelDownloadRequest(resource_dispatcher_host_); | 375 download->CancelDownloadRequest(resource_dispatcher_host_); |
| 376 return; | 376 return; |
| 377 } | 377 } |
| 378 | 378 |
| 379 BrowserThread::PostTask( | 379 BrowserThread::PostTask( |
| 380 BrowserThread::UI, FROM_HERE, | 380 BrowserThread::UI, FROM_HERE, |
| 381 NewRunnableMethod(download_manager, | 381 NewRunnableMethod(download_manager, |
| 382 &DownloadManager::DownloadCancelled, id)); | 382 &DownloadManager::DownloadCancelled, id)); |
| 383 } | 383 } |
| OLD | NEW |