| 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 DownloadItemImpl::Delegate* delegate, | 145 DownloadItemImpl::Delegate* delegate, |
| 146 content::DownloadId download_id, | 146 content::DownloadId download_id, |
| 147 const content::DownloadPersistentStoreInfo& info, | 147 const content::DownloadPersistentStoreInfo& info, |
| 148 const net::BoundNetLog& bound_net_log) OVERRIDE { | 148 const net::BoundNetLog& bound_net_log) OVERRIDE { |
| 149 return new DownloadItemImpl(delegate, download_id, info, bound_net_log); | 149 return new DownloadItemImpl(delegate, download_id, info, bound_net_log); |
| 150 } | 150 } |
| 151 | 151 |
| 152 virtual content::DownloadItem* CreateActiveItem( | 152 virtual content::DownloadItem* CreateActiveItem( |
| 153 DownloadItemImpl::Delegate* delegate, | 153 DownloadItemImpl::Delegate* delegate, |
| 154 const DownloadCreateInfo& info, | 154 const DownloadCreateInfo& info, |
| 155 DownloadRequestHandleInterface* request_handle, | 155 scoped_ptr<DownloadRequestHandleInterface> request_handle, |
| 156 bool is_otr, | 156 bool is_otr, |
| 157 const net::BoundNetLog& bound_net_log) OVERRIDE { | 157 const net::BoundNetLog& bound_net_log) OVERRIDE { |
| 158 return new DownloadItemImpl(delegate, info, request_handle, is_otr, | 158 return new DownloadItemImpl(delegate, info, request_handle.Pass(), |
| 159 bound_net_log); | 159 is_otr, bound_net_log); |
| 160 } | 160 } |
| 161 | 161 |
| 162 virtual content::DownloadItem* CreateSavePageItem( | 162 virtual content::DownloadItem* CreateSavePageItem( |
| 163 DownloadItemImpl::Delegate* delegate, | 163 DownloadItemImpl::Delegate* delegate, |
| 164 const FilePath& path, | 164 const FilePath& path, |
| 165 const GURL& url, | 165 const GURL& url, |
| 166 bool is_otr, | 166 bool is_otr, |
| 167 content::DownloadId download_id, | 167 content::DownloadId download_id, |
| 168 const std::string& mime_type, | 168 const std::string& mime_type, |
| 169 const net::BoundNetLog& bound_net_log) OVERRIDE { | 169 const net::BoundNetLog& bound_net_log) OVERRIDE { |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 | 453 |
| 454 net::BoundNetLog DownloadManagerImpl::CreateDownloadItem( | 454 net::BoundNetLog DownloadManagerImpl::CreateDownloadItem( |
| 455 DownloadCreateInfo* info, const DownloadRequestHandle& request_handle) { | 455 DownloadCreateInfo* info, const DownloadRequestHandle& request_handle) { |
| 456 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 456 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 457 | 457 |
| 458 net::BoundNetLog bound_net_log = | 458 net::BoundNetLog bound_net_log = |
| 459 net::BoundNetLog::Make(net_log_, net::NetLog::SOURCE_DOWNLOAD); | 459 net::BoundNetLog::Make(net_log_, net::NetLog::SOURCE_DOWNLOAD); |
| 460 if (!info->download_id.IsValid()) | 460 if (!info->download_id.IsValid()) |
| 461 info->download_id = GetNextId(); | 461 info->download_id = GetNextId(); |
| 462 DownloadItem* download = factory_->CreateActiveItem( | 462 DownloadItem* download = factory_->CreateActiveItem( |
| 463 this, *info, new DownloadRequestHandle(request_handle), | 463 this, *info, scoped_ptr<DownloadRequestHandleInterface>( |
| 464 new DownloadRequestHandle(request_handle)).Pass(), |
| 464 browser_context_->IsOffTheRecord(), bound_net_log); | 465 browser_context_->IsOffTheRecord(), bound_net_log); |
| 465 int32 download_id = info->download_id.local(); | 466 int32 download_id = info->download_id.local(); |
| 466 | 467 |
| 467 DCHECK(!ContainsKey(active_downloads_, download_id)); | 468 DCHECK(!ContainsKey(active_downloads_, download_id)); |
| 468 downloads_.insert(download); | 469 downloads_.insert(download); |
| 469 active_downloads_[download_id] = download; | 470 active_downloads_[download_id] = download; |
| 470 | 471 |
| 471 return bound_net_log; | 472 return bound_net_log; |
| 472 } | 473 } |
| 473 | 474 |
| (...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1176 void DownloadManagerImpl::DownloadRenamedToFinalName( | 1177 void DownloadManagerImpl::DownloadRenamedToFinalName( |
| 1177 DownloadItem* download) { | 1178 DownloadItem* download) { |
| 1178 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1179 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 1179 // If the rename failed, we receive an OnDownloadInterrupted() call before we | 1180 // If the rename failed, we receive an OnDownloadInterrupted() call before we |
| 1180 // receive the DownloadRenamedToFinalName() call. | 1181 // receive the DownloadRenamedToFinalName() call. |
| 1181 if (delegate_) { | 1182 if (delegate_) { |
| 1182 delegate_->UpdatePathForItemInPersistentStore( | 1183 delegate_->UpdatePathForItemInPersistentStore( |
| 1183 download, download->GetFullPath()); | 1184 download, download->GetFullPath()); |
| 1184 } | 1185 } |
| 1185 } | 1186 } |
| OLD | NEW |