| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 } // namespace | 105 } // namespace |
| 106 | 106 |
| 107 const char DownloadItem::kEmptyFileHash[] = ""; | 107 const char DownloadItem::kEmptyFileHash[] = ""; |
| 108 | 108 |
| 109 // The maximum number of attempts we will make to resume automatically. | 109 // The maximum number of attempts we will make to resume automatically. |
| 110 const int DownloadItemImpl::kMaxAutoResumeAttempts = 5; | 110 const int DownloadItemImpl::kMaxAutoResumeAttempts = 5; |
| 111 | 111 |
| 112 // Constructor for reading from the history service. | 112 // Constructor for reading from the history service. |
| 113 DownloadItemImpl::DownloadItemImpl(DownloadItemImplDelegate* delegate, | 113 DownloadItemImpl::DownloadItemImpl(DownloadItemImplDelegate* delegate, |
| 114 DownloadId download_id, | 114 DownloadId download_id, |
| 115 const FilePath& path, | 115 const FilePath& current_path, |
| 116 const GURL& url, | 116 const FilePath& target_path, |
| 117 const std::vector<GURL>& url_chain, |
| 117 const GURL& referrer_url, | 118 const GURL& referrer_url, |
| 118 const base::Time& start_time, | 119 const base::Time& start_time, |
| 119 const base::Time& end_time, | 120 const base::Time& end_time, |
| 120 int64 received_bytes, | 121 int64 received_bytes, |
| 121 int64 total_bytes, | 122 int64 total_bytes, |
| 122 DownloadItem::DownloadState state, | 123 DownloadItem::DownloadState state, |
| 124 DownloadDangerType danger_type, |
| 125 DownloadInterruptReason interrupt_reason, |
| 123 bool opened, | 126 bool opened, |
| 124 const net::BoundNetLog& bound_net_log) | 127 const net::BoundNetLog& bound_net_log) |
| 125 : is_save_package_download_(false), | 128 : is_save_package_download_(false), |
| 126 download_id_(download_id), | 129 download_id_(download_id), |
| 127 current_path_(path), | 130 current_path_(current_path), |
| 128 target_path_(path), | 131 target_path_(target_path), |
| 129 target_disposition_(TARGET_DISPOSITION_OVERWRITE), | 132 target_disposition_(TARGET_DISPOSITION_OVERWRITE), |
| 130 url_chain_(1, url), | 133 url_chain_(url_chain), |
| 131 referrer_url_(referrer_url), | 134 referrer_url_(referrer_url), |
| 132 transition_type_(PAGE_TRANSITION_LINK), | 135 transition_type_(PAGE_TRANSITION_LINK), |
| 133 has_user_gesture_(false), | 136 has_user_gesture_(false), |
| 134 total_bytes_(total_bytes), | 137 total_bytes_(total_bytes), |
| 135 received_bytes_(received_bytes), | 138 received_bytes_(received_bytes), |
| 136 bytes_per_sec_(0), | 139 bytes_per_sec_(0), |
| 137 last_reason_(DOWNLOAD_INTERRUPT_REASON_NONE), | 140 last_reason_(interrupt_reason), |
| 138 start_tick_(base::TimeTicks()), | 141 start_tick_(base::TimeTicks()), |
| 139 state_(ExternalToInternalState(state)), | 142 state_(ExternalToInternalState(state)), |
| 140 danger_type_(DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS), | 143 danger_type_(danger_type), |
| 141 start_time_(start_time), | 144 start_time_(start_time), |
| 142 end_time_(end_time), | 145 end_time_(end_time), |
| 143 delegate_(delegate), | 146 delegate_(delegate), |
| 144 is_paused_(false), | 147 is_paused_(false), |
| 145 auto_resume_count_(0), | 148 auto_resume_count_(0), |
| 146 open_when_complete_(false), | 149 open_when_complete_(false), |
| 147 file_externally_removed_(false), | 150 file_externally_removed_(false), |
| 148 auto_opened_(false), | 151 auto_opened_(false), |
| 149 is_temporary_(false), | 152 is_temporary_(false), |
| 150 all_data_saved_(false), | 153 all_data_saved_(false), |
| (...skipping 1476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1627 case RESUME_MODE_USER_CONTINUE: | 1630 case RESUME_MODE_USER_CONTINUE: |
| 1628 return "USER_CONTINUE"; | 1631 return "USER_CONTINUE"; |
| 1629 case RESUME_MODE_USER_RESTART: | 1632 case RESUME_MODE_USER_RESTART: |
| 1630 return "USER_RESTART"; | 1633 return "USER_RESTART"; |
| 1631 } | 1634 } |
| 1632 NOTREACHED() << "Unknown resume mode " << mode; | 1635 NOTREACHED() << "Unknown resume mode " << mode; |
| 1633 return "unknown"; | 1636 return "unknown"; |
| 1634 } | 1637 } |
| 1635 | 1638 |
| 1636 } // namespace content | 1639 } // namespace content |
| OLD | NEW |