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

Side by Side Diff: content/browser/download/download_manager_impl.cc

Issue 10916201: Make the SavePackage use of the fake download item cleaner around cancellation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 months 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 | Annotate | Revision Log
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 "content/browser/download/download_manager_impl.h" 5 #include "content/browser/download/download_manager_impl.h"
6 6
7 #include <iterator> 7 #include <iterator>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after
1034 // Finalize this download if it finished before the history callback. 1034 // Finalize this download if it finished before the history callback.
1035 if (!item->IsInProgress()) 1035 if (!item->IsInProgress())
1036 SavePageDownloadFinished(item); 1036 SavePageDownloadFinished(item);
1037 } 1037 }
1038 1038
1039 void DownloadManagerImpl::SavePageDownloadFinished( 1039 void DownloadManagerImpl::SavePageDownloadFinished(
1040 content::DownloadItem* download) { 1040 content::DownloadItem* download) {
1041 if (download->IsPersisted()) { 1041 if (download->IsPersisted()) {
1042 if (delegate_) 1042 if (delegate_)
1043 delegate_->UpdateItemInPersistentStore(download); 1043 delegate_->UpdateItemInPersistentStore(download);
1044 if (download->IsComplete())
1045 content::NotificationService::current()->Notify(
1046 content::NOTIFICATION_SAVE_PACKAGE_SUCCESSFULLY_FINISHED,
1047 content::Source<DownloadManager>(this),
1048 content::Details<DownloadItem>(download));
1049 } 1044 }
1050 } 1045 }
1051 1046
1052 void DownloadManagerImpl::DownloadOpened(DownloadItemImpl* download) { 1047 void DownloadManagerImpl::DownloadOpened(DownloadItemImpl* download) {
1053 if (delegate_) 1048 if (delegate_)
1054 delegate_->UpdateItemInPersistentStore(download); 1049 delegate_->UpdateItemInPersistentStore(download);
1055 int num_unopened = 0; 1050 int num_unopened = 0;
1056 for (DownloadMap::iterator it = downloads_.begin(); 1051 for (DownloadMap::iterator it = downloads_.begin();
1057 it != downloads_.end(); ++it) { 1052 it != downloads_.end(); ++it) {
1058 DownloadItemImpl* item = it->second; 1053 DownloadItemImpl* item = it->second;
(...skipping 22 matching lines...) Expand all
1081 void DownloadManagerImpl::DownloadRenamedToFinalName( 1076 void DownloadManagerImpl::DownloadRenamedToFinalName(
1082 DownloadItemImpl* download) { 1077 DownloadItemImpl* download) {
1083 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1078 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1084 // If the rename failed, we receive an OnDownloadInterrupted() call before we 1079 // If the rename failed, we receive an OnDownloadInterrupted() call before we
1085 // receive the DownloadRenamedToFinalName() call. 1080 // receive the DownloadRenamedToFinalName() call.
1086 if (delegate_) { 1081 if (delegate_) {
1087 delegate_->UpdatePathForItemInPersistentStore( 1082 delegate_->UpdatePathForItemInPersistentStore(
1088 download, download->GetFullPath()); 1083 download, download->GetFullPath());
1089 } 1084 }
1090 } 1085 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698