| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/browser/download/download_item.h" | 5 #include "content/browser/download/download_item.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
| 10 #include "base/i18n/case_conversion.h" | 10 #include "base/i18n/case_conversion.h" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 | 113 |
| 114 // Our download table ID starts at 1, so we use 0 to represent a download that | 114 // Our download table ID starts at 1, so we use 0 to represent a download that |
| 115 // has started, but has not yet had its data persisted in the table. We use fake | 115 // has started, but has not yet had its data persisted in the table. We use fake |
| 116 // database handles in incognito mode starting at -1 and progressively getting | 116 // database handles in incognito mode starting at -1 and progressively getting |
| 117 // more negative. | 117 // more negative. |
| 118 // static | 118 // static |
| 119 const int DownloadItem::kUninitializedHandle = 0; | 119 const int DownloadItem::kUninitializedHandle = 0; |
| 120 | 120 |
| 121 // Constructor for reading from the history service. | 121 // Constructor for reading from the history service. |
| 122 DownloadItem::DownloadItem(DownloadManager* download_manager, | 122 DownloadItem::DownloadItem(DownloadManager* download_manager, |
| 123 const DownloadPersistentStoreInfo& info) | 123 const DownloadPersistentStoreInfo& info, |
| 124 : download_id_(-1), | 124 int id) |
| 125 : download_id_(id), |
| 125 full_path_(info.path), | 126 full_path_(info.path), |
| 126 url_chain_(1, info.url), | 127 url_chain_(1, info.url), |
| 127 referrer_url_(info.referrer_url), | 128 referrer_url_(info.referrer_url), |
| 128 total_bytes_(info.total_bytes), | 129 total_bytes_(info.total_bytes), |
| 129 received_bytes_(info.received_bytes), | 130 received_bytes_(info.received_bytes), |
| 130 start_tick_(base::TimeTicks()), | 131 start_tick_(base::TimeTicks()), |
| 131 state_(static_cast<DownloadState>(info.state)), | 132 state_(static_cast<DownloadState>(info.state)), |
| 132 start_time_(info.start_time), | 133 start_time_(info.start_time), |
| 133 db_handle_(info.db_handle), | 134 db_handle_(info.db_handle), |
| 134 download_manager_(download_manager), | 135 download_manager_(download_manager), |
| (...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 804 state_info_.target_name.value().c_str(), | 805 state_info_.target_name.value().c_str(), |
| 805 full_path().value().c_str()); | 806 full_path().value().c_str()); |
| 806 } else { | 807 } else { |
| 807 description += base::StringPrintf(" url = \"%s\"", url_list.c_str()); | 808 description += base::StringPrintf(" url = \"%s\"", url_list.c_str()); |
| 808 } | 809 } |
| 809 | 810 |
| 810 description += " }"; | 811 description += " }"; |
| 811 | 812 |
| 812 return description; | 813 return description; |
| 813 } | 814 } |
| OLD | NEW |