| 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 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 bound_net_log); | 552 bound_net_log); |
| 553 | 553 |
| 554 download->AddObserver(observer); | 554 download->AddObserver(observer); |
| 555 | 555 |
| 556 DCHECK(!ContainsKey(downloads_, download->GetId())); | 556 DCHECK(!ContainsKey(downloads_, download->GetId())); |
| 557 downloads_[download->GetId()] = download; | 557 downloads_[download->GetId()] = download; |
| 558 DCHECK(!SavePageData::Get(download)); | 558 DCHECK(!SavePageData::Get(download)); |
| 559 new SavePageData(download); | 559 new SavePageData(download); |
| 560 DCHECK(SavePageData::Get(download)); | 560 DCHECK(SavePageData::Get(download)); |
| 561 | 561 |
| 562 // TODO(benjhayden): Fire OnDownloadCreated for SavePackage downloads when | 562 FOR_EACH_OBSERVER(Observer, observers_, OnDownloadCreated(this, download)); |
| 563 // we're comfortable with the user interacting with them. | |
| 564 // FOR_EACH_OBSERVER(Observer, observers_, OnDownloadCreated(this, download)); | |
| 565 | 563 |
| 566 // Will notify the observer in the callback. | 564 // Will notify the observer in the callback. |
| 567 if (delegate_) | 565 if (delegate_) |
| 568 delegate_->AddItemToPersistentStore(download); | 566 delegate_->AddItemToPersistentStore(download); |
| 569 | 567 |
| 570 return download; | 568 return download; |
| 571 } | 569 } |
| 572 | 570 |
| 573 void DownloadManagerImpl::UpdateDownload(int32 download_id, | 571 void DownloadManagerImpl::UpdateDownload(int32 download_id, |
| 574 int64 bytes_so_far, | 572 int64 bytes_so_far, |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1092 void DownloadManagerImpl::DownloadRenamedToFinalName( | 1090 void DownloadManagerImpl::DownloadRenamedToFinalName( |
| 1093 DownloadItemImpl* download) { | 1091 DownloadItemImpl* download) { |
| 1094 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1092 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 1095 // If the rename failed, we receive an OnDownloadInterrupted() call before we | 1093 // If the rename failed, we receive an OnDownloadInterrupted() call before we |
| 1096 // receive the DownloadRenamedToFinalName() call. | 1094 // receive the DownloadRenamedToFinalName() call. |
| 1097 if (delegate_) { | 1095 if (delegate_) { |
| 1098 delegate_->UpdatePathForItemInPersistentStore( | 1096 delegate_->UpdatePathForItemInPersistentStore( |
| 1099 download, download->GetFullPath()); | 1097 download, download->GetFullPath()); |
| 1100 } | 1098 } |
| 1101 } | 1099 } |
| OLD | NEW |