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 const base::Time& last_access_time, | 144 const 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 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 const std::string& etag, | 656 const std::string& etag, |
656 const std::string& last_modified, | 657 const std::string& last_modified, |
657 int64_t received_bytes, | 658 int64_t received_bytes, |
658 int64_t total_bytes, | 659 int64_t total_bytes, |
659 const std::string& hash, | 660 const std::string& hash, |
660 DownloadItem::DownloadState state, | 661 DownloadItem::DownloadState state, |
661 DownloadDangerType danger_type, | 662 DownloadDangerType danger_type, |
662 DownloadInterruptReason interrupt_reason, | 663 DownloadInterruptReason interrupt_reason, |
663 bool opened, | 664 bool opened, |
664 const base::Time& last_access_time, | 665 const base::Time& last_access_time, |
| 666 bool visible, |
665 const std::vector<DownloadItem::ReceivedSlice>& received_slices) { | 667 const std::vector<DownloadItem::ReceivedSlice>& received_slices) { |
666 if (base::ContainsKey(downloads_, id)) { | 668 if (base::ContainsKey(downloads_, id)) { |
667 NOTREACHED(); | 669 NOTREACHED(); |
668 return nullptr; | 670 return nullptr; |
669 } | 671 } |
670 DCHECK(!base::ContainsKey(downloads_by_guid_, guid)); | 672 DCHECK(!base::ContainsKey(downloads_by_guid_, guid)); |
671 DownloadItemImpl* item = item_factory_->CreatePersistedItem( | 673 DownloadItemImpl* item = item_factory_->CreatePersistedItem( |
672 this, guid, id, current_path, target_path, url_chain, referrer_url, | 674 this, guid, id, current_path, target_path, url_chain, referrer_url, |
673 site_url, tab_url, tab_refererr_url, mime_type, original_mime_type, | 675 site_url, tab_url, tab_refererr_url, mime_type, original_mime_type, |
674 start_time, end_time, etag, last_modified, received_bytes, total_bytes, | 676 start_time, end_time, etag, last_modified, received_bytes, total_bytes, |
675 hash, state, danger_type, interrupt_reason, opened, last_access_time, | 677 hash, state, danger_type, interrupt_reason, opened, last_access_time, |
676 received_slices, | 678 visible, received_slices, |
677 net::NetLogWithSource::Make(net_log_, net::NetLogSourceType::DOWNLOAD)); | 679 net::NetLogWithSource::Make(net_log_, net::NetLogSourceType::DOWNLOAD)); |
678 downloads_[id] = base::WrapUnique(item); | 680 downloads_[id] = base::WrapUnique(item); |
679 downloads_by_guid_[guid] = item; | 681 downloads_by_guid_[guid] = item; |
680 for (auto& observer : observers_) | 682 for (auto& observer : observers_) |
681 observer.OnDownloadCreated(this, item); | 683 observer.OnDownloadCreated(this, item); |
682 DVLOG(20) << __func__ << "() download = " << item->DebugString(true); | 684 DVLOG(20) << __func__ << "() download = " << item->DebugString(true); |
683 return item; | 685 return item; |
684 } | 686 } |
685 | 687 |
686 int DownloadManagerImpl::InProgressCount() const { | 688 int DownloadManagerImpl::InProgressCount() const { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
738 if (delegate_) | 740 if (delegate_) |
739 delegate_->OpenDownload(download); | 741 delegate_->OpenDownload(download); |
740 } | 742 } |
741 | 743 |
742 void DownloadManagerImpl::ShowDownloadInShell(DownloadItemImpl* download) { | 744 void DownloadManagerImpl::ShowDownloadInShell(DownloadItemImpl* download) { |
743 if (delegate_) | 745 if (delegate_) |
744 delegate_->ShowDownloadInShell(download); | 746 delegate_->ShowDownloadInShell(download); |
745 } | 747 } |
746 | 748 |
747 } // namespace content | 749 } // namespace content |
OLD | NEW |