Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_path_reservation_tracker.h" | 5 #include "chrome/browser/download/download_path_reservation_tracker.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 319 case DownloadItem::INTERRUPTED: | 319 case DownloadItem::INTERRUPTED: |
| 320 // The download filename will need to be re-generated when the download is | 320 // The download filename will need to be re-generated when the download is |
| 321 // restarted. Holding on to the reservation now would prevent the name | 321 // restarted. Holding on to the reservation now would prevent the name |
| 322 // from being used for a subsequent retry attempt. | 322 // from being used for a subsequent retry attempt. |
| 323 | 323 |
| 324 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, base::Bind( | 324 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, base::Bind( |
| 325 &RevokeReservation, download)); | 325 &RevokeReservation, download)); |
| 326 delete this; | 326 delete this; |
| 327 break; | 327 break; |
| 328 | 328 |
| 329 case DownloadItem::REMOVED: | |
| 330 // This is handled later by Remove(). | |
|
Dan Beam
2014/11/13 02:51:16
should we change the state in the downloads databa
| |
| 331 break; | |
| 332 | |
| 329 case DownloadItem::MAX_DOWNLOAD_STATE: | 333 case DownloadItem::MAX_DOWNLOAD_STATE: |
| 330 // Compiler appeasement. | 334 // Compiler appeasement. |
| 331 NOTREACHED(); | 335 NOTREACHED(); |
| 332 } | 336 } |
| 333 } | 337 } |
| 334 | 338 |
| 335 void DownloadItemObserver::OnDownloadDestroyed(DownloadItem* download) { | 339 void DownloadItemObserver::OnDownloadDestroyed(DownloadItem* download) { |
| 336 // Items should be COMPLETE/INTERRUPTED/CANCELLED before being destroyed. | 340 // Items should be COMPLETE/INTERRUPTED/CANCELLED before being destroyed. |
| 337 NOTREACHED(); | 341 NOTREACHED(); |
| 338 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, base::Bind( | 342 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, base::Bind( |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 370 base::Bind(&RunGetReservedPathCallback, | 374 base::Bind(&RunGetReservedPathCallback, |
| 371 callback, | 375 callback, |
| 372 base::Owned(reserved_path))); | 376 base::Owned(reserved_path))); |
| 373 } | 377 } |
| 374 | 378 |
| 375 // static | 379 // static |
| 376 bool DownloadPathReservationTracker::IsPathInUseForTesting( | 380 bool DownloadPathReservationTracker::IsPathInUseForTesting( |
| 377 const base::FilePath& path) { | 381 const base::FilePath& path) { |
| 378 return IsPathInUse(path); | 382 return IsPathInUse(path); |
| 379 } | 383 } |
| OLD | NEW |