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 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 base::Time last_access_time, | 144 base::Time last_access_time, |
| 145 bool visible, |
145 const std::vector<DownloadItem::ReceivedSlice>& received_slices, | 146 const std::vector<DownloadItem::ReceivedSlice>& received_slices, |
146 const net::NetLogWithSource& net_log) override { | 147 const net::NetLogWithSource& net_log) override { |
147 return new DownloadItemImpl( | 148 return new DownloadItemImpl( |
148 delegate, guid, download_id, current_path, target_path, url_chain, | 149 delegate, guid, download_id, current_path, target_path, url_chain, |
149 referrer_url, site_url, tab_url, tab_refererr_url, mime_type, | 150 referrer_url, site_url, tab_url, tab_refererr_url, mime_type, |
150 original_mime_type, start_time, end_time, etag, last_modified, | 151 original_mime_type, start_time, end_time, etag, last_modified, |
151 received_bytes, total_bytes, hash, state, danger_type, interrupt_reason, | 152 received_bytes, total_bytes, hash, state, danger_type, interrupt_reason, |
152 opened, last_access_time, received_slices, net_log); | 153 opened, last_access_time, visible, received_slices, net_log); |
153 } | 154 } |
154 | 155 |
155 DownloadItemImpl* CreateActiveItem( | 156 DownloadItemImpl* CreateActiveItem( |
156 DownloadItemImplDelegate* delegate, | 157 DownloadItemImplDelegate* delegate, |
157 uint32_t download_id, | 158 uint32_t download_id, |
158 const DownloadCreateInfo& info, | 159 const DownloadCreateInfo& info, |
159 const net::NetLogWithSource& net_log) override { | 160 const net::NetLogWithSource& net_log) override { |
160 return new DownloadItemImpl(delegate, download_id, info, net_log); | 161 return new DownloadItemImpl(delegate, download_id, info, net_log); |
161 } | 162 } |
162 | 163 |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 const std::string& etag, | 646 const std::string& etag, |
646 const std::string& last_modified, | 647 const std::string& last_modified, |
647 int64_t received_bytes, | 648 int64_t received_bytes, |
648 int64_t total_bytes, | 649 int64_t total_bytes, |
649 const std::string& hash, | 650 const std::string& hash, |
650 DownloadItem::DownloadState state, | 651 DownloadItem::DownloadState state, |
651 DownloadDangerType danger_type, | 652 DownloadDangerType danger_type, |
652 DownloadInterruptReason interrupt_reason, | 653 DownloadInterruptReason interrupt_reason, |
653 bool opened, | 654 bool opened, |
654 base::Time last_access_time, | 655 base::Time last_access_time, |
| 656 bool visible, |
655 const std::vector<DownloadItem::ReceivedSlice>& received_slices) { | 657 const std::vector<DownloadItem::ReceivedSlice>& received_slices) { |
656 if (base::ContainsKey(downloads_, id)) { | 658 if (base::ContainsKey(downloads_, id)) { |
657 NOTREACHED(); | 659 NOTREACHED(); |
658 return nullptr; | 660 return nullptr; |
659 } | 661 } |
660 DCHECK(!base::ContainsKey(downloads_by_guid_, guid)); | 662 DCHECK(!base::ContainsKey(downloads_by_guid_, guid)); |
661 DownloadItemImpl* item = item_factory_->CreatePersistedItem( | 663 DownloadItemImpl* item = item_factory_->CreatePersistedItem( |
662 this, guid, id, current_path, target_path, url_chain, referrer_url, | 664 this, guid, id, current_path, target_path, url_chain, referrer_url, |
663 site_url, tab_url, tab_refererr_url, mime_type, original_mime_type, | 665 site_url, tab_url, tab_refererr_url, mime_type, original_mime_type, |
664 start_time, end_time, etag, last_modified, received_bytes, total_bytes, | 666 start_time, end_time, etag, last_modified, received_bytes, total_bytes, |
665 hash, state, danger_type, interrupt_reason, opened, last_access_time, | 667 hash, state, danger_type, interrupt_reason, opened, last_access_time, |
666 received_slices, | 668 visible, received_slices, |
667 net::NetLogWithSource::Make(net_log_, net::NetLogSourceType::DOWNLOAD)); | 669 net::NetLogWithSource::Make(net_log_, net::NetLogSourceType::DOWNLOAD)); |
668 downloads_[id] = base::WrapUnique(item); | 670 downloads_[id] = base::WrapUnique(item); |
669 downloads_by_guid_[guid] = item; | 671 downloads_by_guid_[guid] = item; |
670 for (auto& observer : observers_) | 672 for (auto& observer : observers_) |
671 observer.OnDownloadCreated(this, item); | 673 observer.OnDownloadCreated(this, item); |
672 DVLOG(20) << __func__ << "() download = " << item->DebugString(true); | 674 DVLOG(20) << __func__ << "() download = " << item->DebugString(true); |
673 return item; | 675 return item; |
674 } | 676 } |
675 | 677 |
676 int DownloadManagerImpl::InProgressCount() const { | 678 int DownloadManagerImpl::InProgressCount() const { |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
746 if (delegate_) | 748 if (delegate_) |
747 delegate_->OpenDownload(download); | 749 delegate_->OpenDownload(download); |
748 } | 750 } |
749 | 751 |
750 void DownloadManagerImpl::ShowDownloadInShell(DownloadItemImpl* download) { | 752 void DownloadManagerImpl::ShowDownloadInShell(DownloadItemImpl* download) { |
751 if (delegate_) | 753 if (delegate_) |
752 delegate_->ShowDownloadInShell(download); | 754 delegate_->ShowDownloadInShell(download); |
753 } | 755 } |
754 | 756 |
755 } // namespace content | 757 } // namespace content |
OLD | NEW |