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