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

Side by Side Diff: content/browser/download/download_item_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 // File method ordering: Methods in this file are in the same order as 5 // File method ordering: Methods in this file are in the same order as
6 // in download_item_impl.h, with the following exception: The public 6 // in download_item_impl.h, with the following exception: The public
7 // interface Start is placed in chronological order with the other 7 // interface Start is placed in chronological order with the other
8 // (private) routines that together define a DownloadItem's state 8 // (private) routines that together define a DownloadItem's state
9 // transitions as the download progresses. See "Download progression 9 // transitions as the download progresses. See "Download progression
10 // cascade" later in this file. 10 // cascade" later in this file.
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 const std::string& etag, 142 const std::string& etag,
143 const std::string& last_modified, 143 const std::string& last_modified,
144 int64_t received_bytes, 144 int64_t received_bytes,
145 int64_t total_bytes, 145 int64_t total_bytes,
146 const std::string& hash, 146 const std::string& hash,
147 DownloadItem::DownloadState state, 147 DownloadItem::DownloadState state,
148 DownloadDangerType danger_type, 148 DownloadDangerType danger_type,
149 DownloadInterruptReason interrupt_reason, 149 DownloadInterruptReason interrupt_reason,
150 bool opened, 150 bool opened,
151 base::Time last_access_time, 151 base::Time last_access_time,
152 bool transient,
152 const std::vector<DownloadItem::ReceivedSlice>& received_slices, 153 const std::vector<DownloadItem::ReceivedSlice>& received_slices,
153 const net::NetLogWithSource& net_log) 154 const net::NetLogWithSource& net_log)
154 : guid_(base::ToUpperASCII(guid)), 155 : guid_(base::ToUpperASCII(guid)),
155 download_id_(download_id), 156 download_id_(download_id),
156 target_path_(target_path), 157 target_path_(target_path),
157 url_chain_(url_chain), 158 url_chain_(url_chain),
158 referrer_url_(referrer_url), 159 referrer_url_(referrer_url),
159 site_url_(site_url), 160 site_url_(site_url),
160 tab_url_(tab_url), 161 tab_url_(tab_url),
161 tab_referrer_url_(tab_refererr_url), 162 tab_referrer_url_(tab_refererr_url),
162 mime_type_(mime_type), 163 mime_type_(mime_type),
163 original_mime_type_(original_mime_type), 164 original_mime_type_(original_mime_type),
164 total_bytes_(total_bytes), 165 total_bytes_(total_bytes),
165 last_reason_(interrupt_reason), 166 last_reason_(interrupt_reason),
166 start_tick_(base::TimeTicks()), 167 start_tick_(base::TimeTicks()),
167 state_(ExternalToInternalState(state)), 168 state_(ExternalToInternalState(state)),
168 danger_type_(danger_type), 169 danger_type_(danger_type),
169 start_time_(start_time), 170 start_time_(start_time),
170 end_time_(end_time), 171 end_time_(end_time),
171 delegate_(delegate), 172 delegate_(delegate),
172 opened_(opened), 173 opened_(opened),
173 last_access_time_(last_access_time), 174 last_access_time_(last_access_time),
175 transient_(transient),
174 current_path_(current_path), 176 current_path_(current_path),
175 received_bytes_(received_bytes), 177 received_bytes_(received_bytes),
176 all_data_saved_(state == COMPLETE), 178 all_data_saved_(state == COMPLETE),
177 hash_(hash), 179 hash_(hash),
178 last_modified_time_(last_modified), 180 last_modified_time_(last_modified),
179 etag_(etag), 181 etag_(etag),
180 received_slices_(received_slices), 182 received_slices_(received_slices),
181 net_log_(net_log), 183 net_log_(net_log),
182 weak_ptr_factory_(this) { 184 weak_ptr_factory_(this) {
183 delegate_->Attach(); 185 delegate_->Attach();
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 } 783 }
782 784
783 bool DownloadItemImpl::GetOpened() const { 785 bool DownloadItemImpl::GetOpened() const {
784 return opened_; 786 return opened_;
785 } 787 }
786 788
787 base::Time DownloadItemImpl::GetLastAccessTime() const { 789 base::Time DownloadItemImpl::GetLastAccessTime() const {
788 return last_access_time_; 790 return last_access_time_;
789 } 791 }
790 792
793 bool DownloadItemImpl::IsTransient() const {
794 return transient_;
795 }
796
791 BrowserContext* DownloadItemImpl::GetBrowserContext() const { 797 BrowserContext* DownloadItemImpl::GetBrowserContext() const {
792 return delegate_->GetBrowserContext(); 798 return delegate_->GetBrowserContext();
793 } 799 }
794 800
795 WebContents* DownloadItemImpl::GetWebContents() const { 801 WebContents* DownloadItemImpl::GetWebContents() const {
796 // TODO(rdsmith): Remove null check after removing GetWebContents() from 802 // TODO(rdsmith): Remove null check after removing GetWebContents() from
797 // paths that might be used by DownloadItems created from history import. 803 // paths that might be used by DownloadItems created from history import.
798 // Currently such items have null request_handle_s, where other items 804 // Currently such items have null request_handle_s, where other items
799 // (regular and SavePackage downloads) have actual objects off the pointer. 805 // (regular and SavePackage downloads) have actual objects off the pointer.
800 if (job_) 806 if (job_)
(...skipping 1384 matching lines...) Expand 10 before | Expand all | Expand 10 after
2185 case RESUME_MODE_USER_CONTINUE: 2191 case RESUME_MODE_USER_CONTINUE:
2186 return "USER_CONTINUE"; 2192 return "USER_CONTINUE";
2187 case RESUME_MODE_USER_RESTART: 2193 case RESUME_MODE_USER_RESTART:
2188 return "USER_RESTART"; 2194 return "USER_RESTART";
2189 } 2195 }
2190 NOTREACHED() << "Unknown resume mode " << mode; 2196 NOTREACHED() << "Unknown resume mode " << mode;
2191 return "unknown"; 2197 return "unknown";
2192 } 2198 }
2193 2199
2194 } // namespace content 2200 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/download_item_impl.h ('k') | content/browser/download/download_manager_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698