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 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 downloads_.insert(download); | 404 downloads_.insert(download); |
405 active_downloads_[download_id] = download; | 405 active_downloads_[download_id] = download; |
406 } | 406 } |
407 | 407 |
408 DownloadItem* DownloadManagerImpl::CreateSavePackageDownloadItem( | 408 DownloadItem* DownloadManagerImpl::CreateSavePackageDownloadItem( |
409 const FilePath& main_file_path, | 409 const FilePath& main_file_path, |
410 const GURL& page_url, | 410 const GURL& page_url, |
411 bool is_otr, | 411 bool is_otr, |
412 DownloadItem::Observer* observer) { | 412 DownloadItem::Observer* observer) { |
413 DownloadItem* download = new DownloadItemImpl( | 413 DownloadItem* download = new DownloadItemImpl( |
414 this, main_file_path, page_url, is_otr, GetNextId()); | 414 this, main_file_path, page_url, is_otr, GetNextId(), NULL); |
415 | 415 |
416 download->AddObserver(observer); | 416 download->AddObserver(observer); |
417 | 417 |
418 DCHECK(!ContainsKey(save_page_downloads_, download->GetId())); | 418 DCHECK(!ContainsKey(save_page_downloads_, download->GetId())); |
419 downloads_.insert(download); | 419 downloads_.insert(download); |
420 save_page_downloads_[download->GetId()] = download; | 420 save_page_downloads_[download->GetId()] = download; |
421 | 421 |
422 // Will notify the observer in the callback. | 422 // Will notify the observer in the callback. |
423 delegate_->AddItemToPersistentStore(download); | 423 delegate_->AddItemToPersistentStore(download); |
424 | 424 |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
942 // The history service has retrieved all download entries. 'entries' contains | 942 // The history service has retrieved all download entries. 'entries' contains |
943 // 'DownloadPersistentStoreInfo's in sorted order (by ascending start_time). | 943 // 'DownloadPersistentStoreInfo's in sorted order (by ascending start_time). |
944 void DownloadManagerImpl::OnPersistentStoreQueryComplete( | 944 void DownloadManagerImpl::OnPersistentStoreQueryComplete( |
945 std::vector<DownloadPersistentStoreInfo>* entries) { | 945 std::vector<DownloadPersistentStoreInfo>* entries) { |
946 // TODO(rdsmith): Remove this and related logic when | 946 // TODO(rdsmith): Remove this and related logic when |
947 // http://crbug.com/96627 is fixed. | 947 // http://crbug.com/96627 is fixed. |
948 largest_db_handle_in_history_ = 0; | 948 largest_db_handle_in_history_ = 0; |
949 | 949 |
950 for (size_t i = 0; i < entries->size(); ++i) { | 950 for (size_t i = 0; i < entries->size(); ++i) { |
951 DownloadItem* download = new DownloadItemImpl( | 951 DownloadItem* download = new DownloadItemImpl( |
952 this, GetNextId(), entries->at(i)); | 952 this, GetNextId(), entries->at(i), NULL); |
953 CHECK_96627(!ContainsKey(history_downloads_, download->GetDbHandle())); | 953 CHECK_96627(!ContainsKey(history_downloads_, download->GetDbHandle())); |
954 downloads_.insert(download); | 954 downloads_.insert(download); |
955 history_downloads_[download->GetDbHandle()] = download; | 955 history_downloads_[download->GetDbHandle()] = download; |
956 VLOG(20) << __FUNCTION__ << "()" << i << ">" | 956 VLOG(20) << __FUNCTION__ << "()" << i << ">" |
957 << " download = " << download->DebugString(true); | 957 << " download = " << download->DebugString(true); |
958 | 958 |
959 if (download->GetDbHandle() > largest_db_handle_in_history_) | 959 if (download->GetDbHandle() > largest_db_handle_in_history_) |
960 largest_db_handle_in_history_ = download->GetDbHandle(); | 960 largest_db_handle_in_history_ = download->GetDbHandle(); |
961 } | 961 } |
962 NotifyModelChanged(); | 962 NotifyModelChanged(); |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1200 it != history_downloads_.end(); ++it) { | 1200 it != history_downloads_.end(); ++it) { |
1201 if (it->second->IsComplete() && !it->second->GetOpened()) | 1201 if (it->second->IsComplete() && !it->second->GetOpened()) |
1202 ++num_unopened; | 1202 ++num_unopened; |
1203 } | 1203 } |
1204 download_stats::RecordOpensOutstanding(num_unopened); | 1204 download_stats::RecordOpensOutstanding(num_unopened); |
1205 } | 1205 } |
1206 | 1206 |
1207 void DownloadManagerImpl::SetFileManager(DownloadFileManager* file_manager) { | 1207 void DownloadManagerImpl::SetFileManager(DownloadFileManager* file_manager) { |
1208 file_manager_ = file_manager; | 1208 file_manager_ = file_manager; |
1209 } | 1209 } |
OLD | NEW |