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

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

Issue 2720613002: Downloads: Added transient flag to download item and download database (Closed)
Patch Set: fix tests Created 3 years, 8 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 transient,
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, transient, 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 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 const std::string& etag, 647 const std::string& etag,
647 const std::string& last_modified, 648 const std::string& last_modified,
648 int64_t received_bytes, 649 int64_t received_bytes,
649 int64_t total_bytes, 650 int64_t total_bytes,
650 const std::string& hash, 651 const std::string& hash,
651 DownloadItem::DownloadState state, 652 DownloadItem::DownloadState state,
652 DownloadDangerType danger_type, 653 DownloadDangerType danger_type,
653 DownloadInterruptReason interrupt_reason, 654 DownloadInterruptReason interrupt_reason,
654 bool opened, 655 bool opened,
655 base::Time last_access_time, 656 base::Time last_access_time,
657 bool transient,
656 const std::vector<DownloadItem::ReceivedSlice>& received_slices) { 658 const std::vector<DownloadItem::ReceivedSlice>& received_slices) {
657 if (base::ContainsKey(downloads_, id)) { 659 if (base::ContainsKey(downloads_, id)) {
658 NOTREACHED(); 660 NOTREACHED();
659 return nullptr; 661 return nullptr;
660 } 662 }
661 DCHECK(!base::ContainsKey(downloads_by_guid_, guid)); 663 DCHECK(!base::ContainsKey(downloads_by_guid_, guid));
662 DownloadItemImpl* item = item_factory_->CreatePersistedItem( 664 DownloadItemImpl* item = item_factory_->CreatePersistedItem(
663 this, guid, id, current_path, target_path, url_chain, referrer_url, 665 this, guid, id, current_path, target_path, url_chain, referrer_url,
664 site_url, tab_url, tab_refererr_url, mime_type, original_mime_type, 666 site_url, tab_url, tab_refererr_url, mime_type, original_mime_type,
665 start_time, end_time, etag, last_modified, received_bytes, total_bytes, 667 start_time, end_time, etag, last_modified, received_bytes, total_bytes,
666 hash, state, danger_type, interrupt_reason, opened, last_access_time, 668 hash, state, danger_type, interrupt_reason, opened, last_access_time,
667 received_slices, 669 transient, received_slices,
668 net::NetLogWithSource::Make(net_log_, net::NetLogSourceType::DOWNLOAD)); 670 net::NetLogWithSource::Make(net_log_, net::NetLogSourceType::DOWNLOAD));
669 downloads_[id] = base::WrapUnique(item); 671 downloads_[id] = base::WrapUnique(item);
670 downloads_by_guid_[guid] = item; 672 downloads_by_guid_[guid] = item;
671 for (auto& observer : observers_) 673 for (auto& observer : observers_)
672 observer.OnDownloadCreated(this, item); 674 observer.OnDownloadCreated(this, item);
673 DVLOG(20) << __func__ << "() download = " << item->DebugString(true); 675 DVLOG(20) << __func__ << "() download = " << item->DebugString(true);
674 return item; 676 return item;
675 } 677 }
676 678
677 int DownloadManagerImpl::InProgressCount() const { 679 int DownloadManagerImpl::InProgressCount() const {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 if (delegate_) 749 if (delegate_)
748 delegate_->OpenDownload(download); 750 delegate_->OpenDownload(download);
749 } 751 }
750 752
751 void DownloadManagerImpl::ShowDownloadInShell(DownloadItemImpl* download) { 753 void DownloadManagerImpl::ShowDownloadInShell(DownloadItemImpl* download) {
752 if (delegate_) 754 if (delegate_)
753 delegate_->ShowDownloadInShell(download); 755 delegate_->ShowDownloadInShell(download);
754 } 756 }
755 757
756 } // namespace content 758 } // 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