Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(697)

Side by Side Diff: chrome/browser/download/download_path_reservation_tracker.cc

Issue 722953002: downloads: add the ability to undo download removal. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: whoops Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698