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 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 // Without a download manager, we can't cancel the request normally, so we | 377 // Without a download manager, we can't cancel the request normally, so we |
378 // need to do it here. The normal path will also update the download | 378 // need to do it here. The normal path will also update the download |
379 // history before cancelling the request. | 379 // history before cancelling the request. |
380 download_file->CancelDownloadRequest(); | 380 download_file->CancelDownloadRequest(); |
381 return; | 381 return; |
382 } | 382 } |
383 | 383 |
384 BrowserThread::PostTask( | 384 BrowserThread::PostTask( |
385 BrowserThread::UI, FROM_HERE, | 385 BrowserThread::UI, FROM_HERE, |
386 NewRunnableMethod(download_manager, | 386 NewRunnableMethod(download_manager, |
387 &DownloadManager::DownloadCancelled, id)); | 387 &DownloadManager::CancelDownload, id)); |
388 } | 388 } |
389 | 389 |
390 void DownloadFileManager::EraseDownload(int id) { | 390 void DownloadFileManager::EraseDownload(int id) { |
391 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 391 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
392 | 392 |
393 if (!ContainsKey(downloads_, id)) | 393 if (!ContainsKey(downloads_, id)) |
394 return; | 394 return; |
395 | 395 |
396 DownloadFile* download_file = downloads_[id]; | 396 DownloadFile* download_file = downloads_[id]; |
397 | 397 |
398 VLOG(20) << " " << __FUNCTION__ << "()" | 398 VLOG(20) << " " << __FUNCTION__ << "()" |
399 << " id = " << id | 399 << " id = " << id |
400 << " download_file = " << download_file->DebugString(); | 400 << " download_file = " << download_file->DebugString(); |
401 | 401 |
402 downloads_.erase(id); | 402 downloads_.erase(id); |
403 | 403 |
404 delete download_file; | 404 delete download_file; |
405 | 405 |
406 if (downloads_.empty()) | 406 if (downloads_.empty()) |
407 StopUpdateTimer(); | 407 StopUpdateTimer(); |
408 } | 408 } |
OLD | NEW |