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 1680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 = DownloadUrlParameters::FromWebContents(GetWebContents(), |
1700 GetOriginalUrl()); | 1700 GetOriginalUrl()); |
1701 } else if (GetBrowserContext()) { | 1701 } else { |
1702 download_params = make_scoped_ptr( | 1702 download_params = make_scoped_ptr( |
1703 new DownloadUrlParameters(GetOriginalUrl(), -1, -1, -1, | 1703 new DownloadUrlParameters(GetOriginalUrl(), -1, -1, -1, |
1704 GetBrowserContext()->GetResourceContext())); | 1704 GetBrowserContext()->GetResourceContext())); |
1705 } else { | |
1706 return; | |
1707 } | 1705 } |
1708 | 1706 |
1709 download_params->set_file_path(GetFullPath()); | 1707 download_params->set_file_path(GetFullPath()); |
1710 download_params->set_offset(GetReceivedBytes()); | 1708 download_params->set_offset(GetReceivedBytes()); |
1711 download_params->set_hash_state(GetHashState()); | 1709 download_params->set_hash_state(GetHashState()); |
1712 download_params->set_last_modified(GetLastModifiedTime()); | 1710 download_params->set_last_modified(GetLastModifiedTime()); |
1713 download_params->set_etag(GetETag()); | 1711 download_params->set_etag(GetETag()); |
1714 download_params->set_callback( | 1712 download_params->set_callback( |
1715 base::Bind(&DownloadItemImpl::OnResumeRequestStarted, | 1713 base::Bind(&DownloadItemImpl::OnResumeRequestStarted, |
1716 weak_ptr_factory_.GetWeakPtr())); | 1714 weak_ptr_factory_.GetWeakPtr())); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1797 case RESUME_MODE_USER_CONTINUE: | 1795 case RESUME_MODE_USER_CONTINUE: |
1798 return "USER_CONTINUE"; | 1796 return "USER_CONTINUE"; |
1799 case RESUME_MODE_USER_RESTART: | 1797 case RESUME_MODE_USER_RESTART: |
1800 return "USER_RESTART"; | 1798 return "USER_RESTART"; |
1801 } | 1799 } |
1802 NOTREACHED() << "Unknown resume mode " << mode; | 1800 NOTREACHED() << "Unknown resume mode " << mode; |
1803 return "unknown"; | 1801 return "unknown"; |
1804 } | 1802 } |
1805 | 1803 |
1806 } // namespace content | 1804 } // namespace content |
OLD | NEW |