| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 9 #include "base/stl_util.h" |
| 10 #include "base/task.h" | 10 #include "base/task.h" |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 } | 270 } |
| 271 } | 271 } |
| 272 | 272 |
| 273 // Actions from the UI thread and run on the download thread | 273 // Actions from the UI thread and run on the download thread |
| 274 | 274 |
| 275 // The DownloadManager in the UI thread has provided an intermediate .crdownload | 275 // The DownloadManager in the UI thread has provided an intermediate .crdownload |
| 276 // name for the download specified by 'id'. Rename the in progress download. | 276 // name for the download specified by 'id'. Rename the in progress download. |
| 277 // | 277 // |
| 278 // There are 2 possible rename cases where this method can be called: | 278 // There are 2 possible rename cases where this method can be called: |
| 279 // 1. tmp -> foo.crdownload (not final, safe) | 279 // 1. tmp -> foo.crdownload (not final, safe) |
| 280 // 2. tmp-> Unconfirmed.xxx.crdownload (not final, dangerous) | 280 // 2. tmp -> Unconfirmed.xxx.crdownload (not final, dangerous) |
| 281 void DownloadFileManager::RenameInProgressDownloadFile( | 281 void DownloadFileManager::RenameInProgressDownloadFile( |
| 282 int id, const FilePath& full_path) { | 282 int id, const FilePath& full_path) { |
| 283 VLOG(20) << __FUNCTION__ << "()" << " id = " << id | 283 VLOG(20) << __FUNCTION__ << "()" << " id = " << id |
| 284 << " full_path = \"" << full_path.value() << "\""; | 284 << " full_path = \"" << full_path.value() << "\""; |
| 285 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 285 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 286 | 286 |
| 287 DownloadFile* download_file = GetDownloadFile(id); | 287 DownloadFile* download_file = GetDownloadFile(id); |
| 288 if (!download_file) | 288 if (!download_file) |
| 289 return; | 289 return; |
| 290 | 290 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 << " id = " << id | 395 << " id = " << id |
| 396 << " download_file = " << download_file->DebugString(); | 396 << " download_file = " << download_file->DebugString(); |
| 397 | 397 |
| 398 downloads_.erase(id); | 398 downloads_.erase(id); |
| 399 | 399 |
| 400 delete download_file; | 400 delete download_file; |
| 401 | 401 |
| 402 if (downloads_.empty()) | 402 if (downloads_.empty()) |
| 403 StopUpdateTimer(); | 403 StopUpdateTimer(); |
| 404 } | 404 } |
| OLD | NEW |