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 // 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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 state_ == CANCELLED_INTERNAL); | 196 state_ == CANCELLED_INTERNAL); |
197 DCHECK(base::IsValidGUID(guid_)); | 197 DCHECK(base::IsValidGUID(guid_)); |
198 Init(false /* not actively downloading */, SRC_HISTORY_IMPORT); | 198 Init(false /* not actively downloading */, SRC_HISTORY_IMPORT); |
199 } | 199 } |
200 | 200 |
201 // Constructing for a regular download: | 201 // Constructing for a regular download: |
202 DownloadItemImpl::DownloadItemImpl(DownloadItemImplDelegate* delegate, | 202 DownloadItemImpl::DownloadItemImpl(DownloadItemImplDelegate* delegate, |
203 uint32_t download_id, | 203 uint32_t download_id, |
204 const DownloadCreateInfo& info, | 204 const DownloadCreateInfo& info, |
205 const net::NetLogWithSource& net_log) | 205 const net::NetLogWithSource& net_log) |
206 : guid_(base::ToUpperASCII(base::GenerateGUID())), | 206 : guid_(info.guid.empty() ? base::ToUpperASCII(base::GenerateGUID()) |
| 207 : info.guid), |
207 download_id_(download_id), | 208 download_id_(download_id), |
208 target_disposition_((info.save_info->prompt_for_save_location) | 209 target_disposition_((info.save_info->prompt_for_save_location) |
209 ? TARGET_DISPOSITION_PROMPT | 210 ? TARGET_DISPOSITION_PROMPT |
210 : TARGET_DISPOSITION_OVERWRITE), | 211 : TARGET_DISPOSITION_OVERWRITE), |
211 url_chain_(info.url_chain), | 212 url_chain_(info.url_chain), |
212 referrer_url_(info.referrer_url), | 213 referrer_url_(info.referrer_url), |
213 site_url_(info.site_url), | 214 site_url_(info.site_url), |
214 tab_url_(info.tab_url), | 215 tab_url_(info.tab_url), |
215 tab_referrer_url_(info.tab_referrer_url), | 216 tab_referrer_url_(info.tab_referrer_url), |
216 suggested_filename_(base::UTF16ToUTF8(info.save_info->suggested_name)), | 217 suggested_filename_(base::UTF16ToUTF8(info.save_info->suggested_name)), |
(...skipping 2084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2301 case RESUME_MODE_USER_CONTINUE: | 2302 case RESUME_MODE_USER_CONTINUE: |
2302 return "USER_CONTINUE"; | 2303 return "USER_CONTINUE"; |
2303 case RESUME_MODE_USER_RESTART: | 2304 case RESUME_MODE_USER_RESTART: |
2304 return "USER_RESTART"; | 2305 return "USER_RESTART"; |
2305 } | 2306 } |
2306 NOTREACHED() << "Unknown resume mode " << mode; | 2307 NOTREACHED() << "Unknown resume mode " << mode; |
2307 return "unknown"; | 2308 return "unknown"; |
2308 } | 2309 } |
2309 | 2310 |
2310 } // namespace content | 2311 } // namespace content |
OLD | NEW |