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

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

Issue 1522893004: [Downloads] Use final URL for resumption. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@download-browsertest-cleanup
Patch Set: Make download id be a property of the fixture. Created 5 years 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
« no previous file with comments | « no previous file | content/browser/download/download_item_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1678 matching lines...) Expand 10 before | Expand all | Expand 10 after
1689 if (mode == RESUME_MODE_IMMEDIATE_RESTART || 1689 if (mode == RESUME_MODE_IMMEDIATE_RESTART ||
1690 mode == RESUME_MODE_USER_RESTART) { 1690 mode == RESUME_MODE_USER_RESTART) {
1691 received_bytes_ = 0; 1691 received_bytes_ = 0;
1692 hash_state_ = ""; 1692 hash_state_ = "";
1693 last_modified_time_ = ""; 1693 last_modified_time_ = "";
1694 etag_ = ""; 1694 etag_ = "";
1695 } 1695 }
1696 1696
1697 scoped_ptr<DownloadUrlParameters> download_params; 1697 scoped_ptr<DownloadUrlParameters> download_params;
1698 if (GetWebContents()) { 1698 if (GetWebContents()) {
1699 download_params = DownloadUrlParameters::FromWebContents(GetWebContents(), 1699 download_params =
1700 GetOriginalUrl()); 1700 DownloadUrlParameters::FromWebContents(GetWebContents(), GetURL());
1701 } else { 1701 } else {
1702 download_params = make_scoped_ptr( 1702 download_params = make_scoped_ptr(new DownloadUrlParameters(
1703 new DownloadUrlParameters(GetOriginalUrl(), -1, -1, -1, 1703 GetURL(), -1, -1, -1, GetBrowserContext()->GetResourceContext()));
1704 GetBrowserContext()->GetResourceContext()));
1705 } 1704 }
1706 1705
1707 download_params->set_file_path(GetFullPath()); 1706 download_params->set_file_path(GetFullPath());
1708 download_params->set_offset(GetReceivedBytes()); 1707 download_params->set_offset(GetReceivedBytes());
1709 download_params->set_hash_state(GetHashState()); 1708 download_params->set_hash_state(GetHashState());
1710 download_params->set_last_modified(GetLastModifiedTime()); 1709 download_params->set_last_modified(GetLastModifiedTime());
1711 download_params->set_etag(GetETag()); 1710 download_params->set_etag(GetETag());
1712 download_params->set_callback( 1711 download_params->set_callback(
1713 base::Bind(&DownloadItemImpl::OnResumeRequestStarted, 1712 base::Bind(&DownloadItemImpl::OnResumeRequestStarted,
1714 weak_ptr_factory_.GetWeakPtr())); 1713 weak_ptr_factory_.GetWeakPtr()));
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
1795 case RESUME_MODE_USER_CONTINUE: 1794 case RESUME_MODE_USER_CONTINUE:
1796 return "USER_CONTINUE"; 1795 return "USER_CONTINUE";
1797 case RESUME_MODE_USER_RESTART: 1796 case RESUME_MODE_USER_RESTART:
1798 return "USER_RESTART"; 1797 return "USER_RESTART";
1799 } 1798 }
1800 NOTREACHED() << "Unknown resume mode " << mode; 1799 NOTREACHED() << "Unknown resume mode " << mode;
1801 return "unknown"; 1800 return "unknown";
1802 } 1801 }
1803 1802
1804 } // namespace content 1803 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/download/download_item_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698