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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 downloads_.insert(download); | 390 downloads_.insert(download); |
391 active_downloads_[download_id] = download; | 391 active_downloads_[download_id] = download; |
392 } | 392 } |
393 | 393 |
394 DownloadItem* DownloadManagerImpl::CreateSavePackageDownloadItem( | 394 DownloadItem* DownloadManagerImpl::CreateSavePackageDownloadItem( |
395 const FilePath& main_file_path, | 395 const FilePath& main_file_path, |
396 const GURL& page_url, | 396 const GURL& page_url, |
397 bool is_otr, | 397 bool is_otr, |
398 DownloadItem::Observer* observer) { | 398 DownloadItem::Observer* observer) { |
399 DownloadItem* download = new DownloadItemImpl( | 399 DownloadItem* download = new DownloadItemImpl( |
400 this, main_file_path, page_url, is_otr, GetNextId()); | 400 this, main_file_path, page_url, is_otr, GetNextId(), net::BoundNetLog()); |
401 | 401 |
402 download->AddObserver(observer); | 402 download->AddObserver(observer); |
403 | 403 |
404 DCHECK(!ContainsKey(save_page_downloads_, download->GetId())); | 404 DCHECK(!ContainsKey(save_page_downloads_, download->GetId())); |
405 downloads_.insert(download); | 405 downloads_.insert(download); |
406 save_page_downloads_[download->GetId()] = download; | 406 save_page_downloads_[download->GetId()] = download; |
407 | 407 |
408 // Will notify the observer in the callback. | 408 // Will notify the observer in the callback. |
409 delegate_->AddItemToPersistentStore(download); | 409 delegate_->AddItemToPersistentStore(download); |
410 | 410 |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
894 // The history service has retrieved all download entries. 'entries' contains | 894 // The history service has retrieved all download entries. 'entries' contains |
895 // 'DownloadPersistentStoreInfo's in sorted order (by ascending start_time). | 895 // 'DownloadPersistentStoreInfo's in sorted order (by ascending start_time). |
896 void DownloadManagerImpl::OnPersistentStoreQueryComplete( | 896 void DownloadManagerImpl::OnPersistentStoreQueryComplete( |
897 std::vector<DownloadPersistentStoreInfo>* entries) { | 897 std::vector<DownloadPersistentStoreInfo>* entries) { |
898 // TODO(rdsmith): Remove this and related logic when | 898 // TODO(rdsmith): Remove this and related logic when |
899 // http://crbug.com/96627 is fixed. | 899 // http://crbug.com/96627 is fixed. |
900 largest_db_handle_in_history_ = 0; | 900 largest_db_handle_in_history_ = 0; |
901 | 901 |
902 for (size_t i = 0; i < entries->size(); ++i) { | 902 for (size_t i = 0; i < entries->size(); ++i) { |
903 DownloadItem* download = new DownloadItemImpl( | 903 DownloadItem* download = new DownloadItemImpl( |
904 this, GetNextId(), entries->at(i)); | 904 this, GetNextId(), entries->at(i), net::BoundNetLog()); |
905 CHECK_96627(!ContainsKey(history_downloads_, download->GetDbHandle())); | 905 CHECK_96627(!ContainsKey(history_downloads_, download->GetDbHandle())); |
906 downloads_.insert(download); | 906 downloads_.insert(download); |
907 history_downloads_[download->GetDbHandle()] = download; | 907 history_downloads_[download->GetDbHandle()] = download; |
908 VLOG(20) << __FUNCTION__ << "()" << i << ">" | 908 VLOG(20) << __FUNCTION__ << "()" << i << ">" |
909 << " download = " << download->DebugString(true); | 909 << " download = " << download->DebugString(true); |
910 | 910 |
911 if (download->GetDbHandle() > largest_db_handle_in_history_) | 911 if (download->GetDbHandle() > largest_db_handle_in_history_) |
912 largest_db_handle_in_history_ = download->GetDbHandle(); | 912 largest_db_handle_in_history_ = download->GetDbHandle(); |
913 } | 913 } |
914 NotifyModelChanged(); | 914 NotifyModelChanged(); |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1152 it != history_downloads_.end(); ++it) { | 1152 it != history_downloads_.end(); ++it) { |
1153 if (it->second->IsComplete() && !it->second->GetOpened()) | 1153 if (it->second->IsComplete() && !it->second->GetOpened()) |
1154 ++num_unopened; | 1154 ++num_unopened; |
1155 } | 1155 } |
1156 download_stats::RecordOpensOutstanding(num_unopened); | 1156 download_stats::RecordOpensOutstanding(num_unopened); |
1157 } | 1157 } |
1158 | 1158 |
1159 void DownloadManagerImpl::SetFileManager(DownloadFileManager* file_manager) { | 1159 void DownloadManagerImpl::SetFileManager(DownloadFileManager* file_manager) { |
1160 file_manager_ = file_manager; | 1160 file_manager_ = file_manager; |
1161 } | 1161 } |
OLD | NEW |