| 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 "content/browser/download/download_file_manager.h" | 5 #include "content/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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 // Without a download manager, we can't cancel the request normally, so we | 357 // Without a download manager, we can't cancel the request normally, so we |
| 358 // need to do it here. The normal path will also update the download | 358 // need to do it here. The normal path will also update the download |
| 359 // history before cancelling the request. | 359 // history before cancelling the request. |
| 360 download_file->CancelDownloadRequest(); | 360 download_file->CancelDownloadRequest(); |
| 361 return; | 361 return; |
| 362 } | 362 } |
| 363 | 363 |
| 364 BrowserThread::PostTask( | 364 BrowserThread::PostTask( |
| 365 BrowserThread::UI, FROM_HERE, | 365 BrowserThread::UI, FROM_HERE, |
| 366 NewRunnableMethod(download_manager, | 366 NewRunnableMethod(download_manager, |
| 367 &DownloadManager::DownloadCancelled, id)); | 367 &DownloadManager::CancelDownload, id)); |
| 368 } | 368 } |
| 369 | 369 |
| 370 void DownloadFileManager::EraseDownload(int id) { | 370 void DownloadFileManager::EraseDownload(int id) { |
| 371 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 371 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 372 | 372 |
| 373 if (!ContainsKey(downloads_, id)) | 373 if (!ContainsKey(downloads_, id)) |
| 374 return; | 374 return; |
| 375 | 375 |
| 376 DownloadFile* download_file = downloads_[id]; | 376 DownloadFile* download_file = downloads_[id]; |
| 377 | 377 |
| 378 VLOG(20) << " " << __FUNCTION__ << "()" | 378 VLOG(20) << " " << __FUNCTION__ << "()" |
| 379 << " id = " << id | 379 << " id = " << id |
| 380 << " download_file = " << download_file->DebugString(); | 380 << " download_file = " << download_file->DebugString(); |
| 381 | 381 |
| 382 downloads_.erase(id); | 382 downloads_.erase(id); |
| 383 | 383 |
| 384 delete download_file; | 384 delete download_file; |
| 385 | 385 |
| 386 if (downloads_.empty()) | 386 if (downloads_.empty()) |
| 387 StopUpdateTimer(); | 387 StopUpdateTimer(); |
| 388 } | 388 } |
| OLD | NEW |