| 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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 downloads_.insert(download); | 437 downloads_.insert(download); |
| 438 active_downloads_[download_id] = download; | 438 active_downloads_[download_id] = download; |
| 439 | 439 |
| 440 return bound_net_log; | 440 return bound_net_log; |
| 441 } | 441 } |
| 442 | 442 |
| 443 DownloadItem* DownloadManagerImpl::CreateSavePackageDownloadItem( | 443 DownloadItem* DownloadManagerImpl::CreateSavePackageDownloadItem( |
| 444 const FilePath& main_file_path, | 444 const FilePath& main_file_path, |
| 445 const GURL& page_url, | 445 const GURL& page_url, |
| 446 bool is_otr, | 446 bool is_otr, |
| 447 const std::string& mime_type, |
| 447 DownloadItem::Observer* observer) { | 448 DownloadItem::Observer* observer) { |
| 448 net::BoundNetLog bound_net_log = | 449 net::BoundNetLog bound_net_log = |
| 449 net::BoundNetLog::Make(net_log_, net::NetLog::SOURCE_DOWNLOAD); | 450 net::BoundNetLog::Make(net_log_, net::NetLog::SOURCE_DOWNLOAD); |
| 450 DownloadItem* download = new DownloadItemImpl( | 451 DownloadItem* download = new DownloadItemImpl( |
| 451 this, main_file_path, page_url, is_otr, GetNextId(), bound_net_log); | 452 this, |
| 453 main_file_path, |
| 454 page_url, |
| 455 is_otr, |
| 456 GetNextId(), |
| 457 mime_type, |
| 458 bound_net_log); |
| 452 | 459 |
| 453 download->AddObserver(observer); | 460 download->AddObserver(observer); |
| 454 | 461 |
| 455 DCHECK(!ContainsKey(save_page_downloads_, download->GetId())); | 462 DCHECK(!ContainsKey(save_page_downloads_, download->GetId())); |
| 456 downloads_.insert(download); | 463 downloads_.insert(download); |
| 457 save_page_downloads_[download->GetId()] = download; | 464 save_page_downloads_[download->GetId()] = download; |
| 458 | 465 |
| 459 // Will notify the observer in the callback. | 466 // Will notify the observer in the callback. |
| 460 delegate_->AddItemToPersistentStore(download); | 467 delegate_->AddItemToPersistentStore(download); |
| 461 | 468 |
| (...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1208 if (it->second->IsComplete() && !it->second->GetOpened()) | 1215 if (it->second->IsComplete() && !it->second->GetOpened()) |
| 1209 ++num_unopened; | 1216 ++num_unopened; |
| 1210 } | 1217 } |
| 1211 download_stats::RecordOpensOutstanding(num_unopened); | 1218 download_stats::RecordOpensOutstanding(num_unopened); |
| 1212 } | 1219 } |
| 1213 | 1220 |
| 1214 void DownloadManagerImpl::SetFileManagerForTesting( | 1221 void DownloadManagerImpl::SetFileManagerForTesting( |
| 1215 DownloadFileManager* file_manager) { | 1222 DownloadFileManager* file_manager) { |
| 1216 file_manager_ = file_manager; | 1223 file_manager_ = file_manager; |
| 1217 } | 1224 } |
| OLD | NEW |