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 "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 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1013 // Finalize this download if it finished before the history callback. | 1013 // Finalize this download if it finished before the history callback. |
1014 if (!item->IsInProgress()) | 1014 if (!item->IsInProgress()) |
1015 SavePageDownloadFinished(item); | 1015 SavePageDownloadFinished(item); |
1016 } | 1016 } |
1017 | 1017 |
1018 void DownloadManagerImpl::SavePageDownloadFinished( | 1018 void DownloadManagerImpl::SavePageDownloadFinished( |
1019 content::DownloadItem* download) { | 1019 content::DownloadItem* download) { |
1020 if (download->IsPersisted()) { | 1020 if (download->IsPersisted()) { |
1021 if (delegate_) | 1021 if (delegate_) |
1022 delegate_->UpdateItemInPersistentStore(download); | 1022 delegate_->UpdateItemInPersistentStore(download); |
1023 if (download->IsComplete()) | |
1024 content::NotificationService::current()->Notify( | |
1025 content::NOTIFICATION_SAVE_PACKAGE_SUCCESSFULLY_FINISHED, | |
1026 content::Source<DownloadManager>(this), | |
1027 content::Details<DownloadItem>(download)); | |
1028 } | 1023 } |
1029 } | 1024 } |
1030 | 1025 |
1031 void DownloadManagerImpl::DownloadOpened(DownloadItemImpl* download) { | 1026 void DownloadManagerImpl::DownloadOpened(DownloadItemImpl* download) { |
1032 if (delegate_) | 1027 if (delegate_) |
1033 delegate_->UpdateItemInPersistentStore(download); | 1028 delegate_->UpdateItemInPersistentStore(download); |
1034 int num_unopened = 0; | 1029 int num_unopened = 0; |
1035 for (DownloadMap::iterator it = downloads_.begin(); | 1030 for (DownloadMap::iterator it = downloads_.begin(); |
1036 it != downloads_.end(); ++it) { | 1031 it != downloads_.end(); ++it) { |
1037 DownloadItemImpl* item = it->second; | 1032 DownloadItemImpl* item = it->second; |
(...skipping 22 matching lines...) Expand all Loading... |
1060 void DownloadManagerImpl::DownloadRenamedToFinalName( | 1055 void DownloadManagerImpl::DownloadRenamedToFinalName( |
1061 DownloadItemImpl* download) { | 1056 DownloadItemImpl* download) { |
1062 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1057 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
1063 // If the rename failed, we receive an OnDownloadInterrupted() call before we | 1058 // If the rename failed, we receive an OnDownloadInterrupted() call before we |
1064 // receive the DownloadRenamedToFinalName() call. | 1059 // receive the DownloadRenamedToFinalName() call. |
1065 if (delegate_) { | 1060 if (delegate_) { |
1066 delegate_->UpdatePathForItemInPersistentStore( | 1061 delegate_->UpdatePathForItemInPersistentStore( |
1067 download, download->GetFullPath()); | 1062 download, download->GetFullPath()); |
1068 } | 1063 } |
1069 } | 1064 } |
OLD | NEW |