| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "chrome/browser/download/download_item.h" | 5 #include "chrome/browser/download/download_item.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 72 |
| 73 } // namespace | 73 } // namespace |
| 74 | 74 |
| 75 // Constructor for reading from the history service. | 75 // Constructor for reading from the history service. |
| 76 DownloadItem::DownloadItem(DownloadManager* download_manager, | 76 DownloadItem::DownloadItem(DownloadManager* download_manager, |
| 77 const DownloadCreateInfo& info) | 77 const DownloadCreateInfo& info) |
| 78 : id_(-1), | 78 : id_(-1), |
| 79 full_path_(info.path), | 79 full_path_(info.path), |
| 80 path_uniquifier_(0), | 80 path_uniquifier_(0), |
| 81 url_(info.url), | 81 url_(info.url), |
| 82 original_url_(info.original_url), |
| 82 referrer_url_(info.referrer_url), | 83 referrer_url_(info.referrer_url), |
| 83 mime_type_(info.mime_type), | 84 mime_type_(info.mime_type), |
| 84 original_mime_type_(info.original_mime_type), | 85 original_mime_type_(info.original_mime_type), |
| 85 total_bytes_(info.total_bytes), | 86 total_bytes_(info.total_bytes), |
| 86 received_bytes_(info.received_bytes), | 87 received_bytes_(info.received_bytes), |
| 87 start_tick_(base::TimeTicks()), | 88 start_tick_(base::TimeTicks()), |
| 88 state_(static_cast<DownloadState>(info.state)), | 89 state_(static_cast<DownloadState>(info.state)), |
| 89 start_time_(info.start_time), | 90 start_time_(info.start_time), |
| 90 db_handle_(info.db_handle), | 91 db_handle_(info.db_handle), |
| 91 download_manager_(download_manager), | 92 download_manager_(download_manager), |
| (...skipping 16 matching lines...) Expand all Loading... |
| 108 } | 109 } |
| 109 | 110 |
| 110 // Constructing for a regular download: | 111 // Constructing for a regular download: |
| 111 DownloadItem::DownloadItem(DownloadManager* download_manager, | 112 DownloadItem::DownloadItem(DownloadManager* download_manager, |
| 112 const DownloadCreateInfo& info, | 113 const DownloadCreateInfo& info, |
| 113 bool is_otr) | 114 bool is_otr) |
| 114 : id_(info.download_id), | 115 : id_(info.download_id), |
| 115 full_path_(info.path), | 116 full_path_(info.path), |
| 116 path_uniquifier_(info.path_uniquifier), | 117 path_uniquifier_(info.path_uniquifier), |
| 117 url_(info.url), | 118 url_(info.url), |
| 119 original_url_(info.original_url), |
| 118 referrer_url_(info.referrer_url), | 120 referrer_url_(info.referrer_url), |
| 119 mime_type_(info.mime_type), | 121 mime_type_(info.mime_type), |
| 120 original_mime_type_(info.original_mime_type), | 122 original_mime_type_(info.original_mime_type), |
| 121 total_bytes_(info.total_bytes), | 123 total_bytes_(info.total_bytes), |
| 122 received_bytes_(0), | 124 received_bytes_(0), |
| 123 start_tick_(base::TimeTicks::Now()), | 125 start_tick_(base::TimeTicks::Now()), |
| 124 state_(IN_PROGRESS), | 126 state_(IN_PROGRESS), |
| 125 start_time_(info.start_time), | 127 start_time_(info.start_time), |
| 126 db_handle_(DownloadHistory::kUninitializedHandle), | 128 db_handle_(DownloadHistory::kUninitializedHandle), |
| 127 download_manager_(download_manager), | 129 download_manager_(download_manager), |
| (...skipping 15 matching lines...) Expand all Loading... |
| 143 | 145 |
| 144 // Constructing for the "Save Page As..." feature: | 146 // Constructing for the "Save Page As..." feature: |
| 145 DownloadItem::DownloadItem(DownloadManager* download_manager, | 147 DownloadItem::DownloadItem(DownloadManager* download_manager, |
| 146 const FilePath& path, | 148 const FilePath& path, |
| 147 const GURL& url, | 149 const GURL& url, |
| 148 bool is_otr) | 150 bool is_otr) |
| 149 : id_(1), | 151 : id_(1), |
| 150 full_path_(path), | 152 full_path_(path), |
| 151 path_uniquifier_(0), | 153 path_uniquifier_(0), |
| 152 url_(url), | 154 url_(url), |
| 155 original_url_(url), |
| 153 referrer_url_(GURL()), | 156 referrer_url_(GURL()), |
| 154 mime_type_(std::string()), | 157 mime_type_(std::string()), |
| 155 original_mime_type_(std::string()), | 158 original_mime_type_(std::string()), |
| 156 total_bytes_(0), | 159 total_bytes_(0), |
| 157 received_bytes_(0), | 160 received_bytes_(0), |
| 158 start_tick_(base::TimeTicks::Now()), | 161 start_tick_(base::TimeTicks::Now()), |
| 159 state_(IN_PROGRESS), | 162 state_(IN_PROGRESS), |
| 160 start_time_(base::Time::Now()), | 163 start_time_(base::Time::Now()), |
| 161 db_handle_(DownloadHistory::kUninitializedHandle), | 164 db_handle_(DownloadHistory::kUninitializedHandle), |
| 162 download_manager_(download_manager), | 165 download_manager_(download_manager), |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 target_name_.value().c_str(), | 550 target_name_.value().c_str(), |
| 548 full_path().value().c_str()); | 551 full_path().value().c_str()); |
| 549 } else { | 552 } else { |
| 550 description += base::StringPrintf(" url = \"%s\"", url().spec().c_str()); | 553 description += base::StringPrintf(" url = \"%s\"", url().spec().c_str()); |
| 551 } | 554 } |
| 552 | 555 |
| 553 description += " }"; | 556 description += " }"; |
| 554 | 557 |
| 555 return description; | 558 return description; |
| 556 } | 559 } |
| OLD | NEW |