Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Side by Side Diff: content/browser/download/download_manager_impl.cc

Issue 2703883003: Read and restore persisted slice info (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 const base::Time& end_time, 134 const base::Time& end_time,
135 const std::string& etag, 135 const std::string& etag,
136 const std::string& last_modified, 136 const std::string& last_modified,
137 int64_t received_bytes, 137 int64_t received_bytes,
138 int64_t total_bytes, 138 int64_t total_bytes,
139 const std::string& hash, 139 const std::string& hash,
140 DownloadItem::DownloadState state, 140 DownloadItem::DownloadState state,
141 DownloadDangerType danger_type, 141 DownloadDangerType danger_type,
142 DownloadInterruptReason interrupt_reason, 142 DownloadInterruptReason interrupt_reason,
143 bool opened, 143 bool opened,
144 const std::vector<DownloadItem::ReceivedSlice>& received_slices,
144 const net::NetLogWithSource& net_log) override { 145 const net::NetLogWithSource& net_log) override {
145 return new DownloadItemImpl( 146 return new DownloadItemImpl(
146 delegate, guid, download_id, current_path, target_path, url_chain, 147 delegate, guid, download_id, current_path, target_path, url_chain,
147 referrer_url, site_url, tab_url, tab_refererr_url, mime_type, 148 referrer_url, site_url, tab_url, tab_refererr_url, mime_type,
148 original_mime_type, start_time, end_time, etag, last_modified, 149 original_mime_type, start_time, end_time, etag, last_modified,
149 received_bytes, total_bytes, hash, state, danger_type, interrupt_reason, 150 received_bytes, total_bytes, hash, state, danger_type, interrupt_reason,
150 opened, net_log); 151 opened, received_slices, net_log);
151 } 152 }
152 153
153 DownloadItemImpl* CreateActiveItem( 154 DownloadItemImpl* CreateActiveItem(
154 DownloadItemImplDelegate* delegate, 155 DownloadItemImplDelegate* delegate,
155 uint32_t download_id, 156 uint32_t download_id,
156 const DownloadCreateInfo& info, 157 const DownloadCreateInfo& info,
157 const net::NetLogWithSource& net_log) override { 158 const net::NetLogWithSource& net_log) override {
158 return new DownloadItemImpl(delegate, download_id, info, net_log); 159 return new DownloadItemImpl(delegate, download_id, info, net_log);
159 } 160 }
160 161
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 const base::Time& start_time, 652 const base::Time& start_time,
652 const base::Time& end_time, 653 const base::Time& end_time,
653 const std::string& etag, 654 const std::string& etag,
654 const std::string& last_modified, 655 const std::string& last_modified,
655 int64_t received_bytes, 656 int64_t received_bytes,
656 int64_t total_bytes, 657 int64_t total_bytes,
657 const std::string& hash, 658 const std::string& hash,
658 DownloadItem::DownloadState state, 659 DownloadItem::DownloadState state,
659 DownloadDangerType danger_type, 660 DownloadDangerType danger_type,
660 DownloadInterruptReason interrupt_reason, 661 DownloadInterruptReason interrupt_reason,
661 bool opened) { 662 bool opened,
663 const std::vector<DownloadItem::ReceivedSlice>& received_slices) {
662 if (base::ContainsKey(downloads_, id)) { 664 if (base::ContainsKey(downloads_, id)) {
663 NOTREACHED(); 665 NOTREACHED();
664 return nullptr; 666 return nullptr;
665 } 667 }
666 DCHECK(!base::ContainsKey(downloads_by_guid_, guid)); 668 DCHECK(!base::ContainsKey(downloads_by_guid_, guid));
667 DownloadItemImpl* item = item_factory_->CreatePersistedItem( 669 DownloadItemImpl* item = item_factory_->CreatePersistedItem(
668 this, guid, id, current_path, target_path, url_chain, referrer_url, 670 this, guid, id, current_path, target_path, url_chain, referrer_url,
669 site_url, tab_url, tab_refererr_url, mime_type, original_mime_type, 671 site_url, tab_url, tab_refererr_url, mime_type, original_mime_type,
670 start_time, end_time, etag, last_modified, received_bytes, total_bytes, 672 start_time, end_time, etag, last_modified, received_bytes, total_bytes,
671 hash, state, danger_type, interrupt_reason, opened, 673 hash, state, danger_type, interrupt_reason, opened, received_slices,
672 net::NetLogWithSource::Make(net_log_, net::NetLogSourceType::DOWNLOAD)); 674 net::NetLogWithSource::Make(net_log_, net::NetLogSourceType::DOWNLOAD));
673 downloads_[id] = base::WrapUnique(item); 675 downloads_[id] = base::WrapUnique(item);
674 downloads_by_guid_[guid] = item; 676 downloads_by_guid_[guid] = item;
675 for (auto& observer : observers_) 677 for (auto& observer : observers_)
676 observer.OnDownloadCreated(this, item); 678 observer.OnDownloadCreated(this, item);
677 DVLOG(20) << __func__ << "() download = " << item->DebugString(true); 679 DVLOG(20) << __func__ << "() download = " << item->DebugString(true);
678 return item; 680 return item;
679 } 681 }
680 682
681 int DownloadManagerImpl::InProgressCount() const { 683 int DownloadManagerImpl::InProgressCount() const {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 if (delegate_) 735 if (delegate_)
734 delegate_->OpenDownload(download); 736 delegate_->OpenDownload(download);
735 } 737 }
736 738
737 void DownloadManagerImpl::ShowDownloadInShell(DownloadItemImpl* download) { 739 void DownloadManagerImpl::ShowDownloadInShell(DownloadItemImpl* download) {
738 if (delegate_) 740 if (delegate_)
739 delegate_->ShowDownloadInShell(download); 741 delegate_->ShowDownloadInShell(download);
740 } 742 }
741 743
742 } // namespace content 744 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/download_manager_impl.h ('k') | content/browser/download/download_manager_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698