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