| 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 "components/history/core/browser/download_row.h" | 5 #include "components/history/core/browser/download_row.h" |
| 6 | 6 |
| 7 #include "components/history/core/browser/download_constants.h" | 7 #include "components/history/core/browser/download_constants.h" |
| 8 | 8 |
| 9 namespace history { | 9 namespace history { |
| 10 | 10 |
| 11 DownloadRow::DownloadRow() | 11 DownloadRow::DownloadRow() |
| 12 : received_bytes(0), | 12 : received_bytes(0), |
| 13 total_bytes(0), | 13 total_bytes(0), |
| 14 state(DownloadState::IN_PROGRESS), | 14 state(DownloadState::IN_PROGRESS), |
| 15 danger_type(DownloadDangerType::NOT_DANGEROUS), | 15 danger_type(DownloadDangerType::NOT_DANGEROUS), |
| 16 interrupt_reason(0), | 16 interrupt_reason(0), |
| 17 id(kInvalidDownloadId), | 17 id(kInvalidDownloadId), |
| 18 opened(false) { | 18 opened(false) { |
| 19 // |interrupt_reason| is left undefined by this constructor as the value | 19 // |interrupt_reason| is left undefined by this constructor as the value |
| 20 // has no meaning unless |state| is equal to kStateInterrupted. | 20 // has no meaning unless |state| is equal to kStateInterrupted. |
| 21 } | 21 } |
| 22 | 22 |
| 23 DownloadRow::DownloadRow(const base::FilePath& current_path, | 23 DownloadRow::DownloadRow(const base::FilePath& current_path, |
| 24 const base::FilePath& target_path, | 24 const base::FilePath& target_path, |
| 25 const std::vector<GURL>& url_chain, | 25 const std::vector<GURL>& url_chain, |
| 26 const GURL& referrer_url, | 26 const GURL& referrer_url, |
| 27 const GURL& site_instance_url, |
| 27 const GURL& tab_url, | 28 const GURL& tab_url, |
| 28 const GURL& tab_referrer_url, | 29 const GURL& tab_referrer_url, |
| 29 const std::string& http_method, | 30 const std::string& http_method, |
| 30 const std::string& mime_type, | 31 const std::string& mime_type, |
| 31 const std::string& original_mime_type, | 32 const std::string& original_mime_type, |
| 32 const base::Time& start, | 33 const base::Time& start, |
| 33 const base::Time& end, | 34 const base::Time& end, |
| 34 const std::string& etag, | 35 const std::string& etag, |
| 35 const std::string& last_modified, | 36 const std::string& last_modified, |
| 36 int64_t received, | 37 int64_t received, |
| 37 int64_t total, | 38 int64_t total, |
| 38 DownloadState download_state, | 39 DownloadState download_state, |
| 39 DownloadDangerType danger_type, | 40 DownloadDangerType danger_type, |
| 40 DownloadInterruptReason interrupt_reason, | 41 DownloadInterruptReason interrupt_reason, |
| 41 const std::string& hash, | 42 const std::string& hash, |
| 42 DownloadId id, | 43 DownloadId id, |
| 43 const std::string& guid, | 44 const std::string& guid, |
| 44 bool download_opened, | 45 bool download_opened, |
| 45 const std::string& ext_id, | 46 const std::string& ext_id, |
| 46 const std::string& ext_name) | 47 const std::string& ext_name) |
| 47 : current_path(current_path), | 48 : current_path(current_path), |
| 48 target_path(target_path), | 49 target_path(target_path), |
| 49 url_chain(url_chain), | 50 url_chain(url_chain), |
| 50 referrer_url(referrer_url), | 51 referrer_url(referrer_url), |
| 52 site_instance_url(site_instance_url), |
| 51 tab_url(tab_url), | 53 tab_url(tab_url), |
| 52 tab_referrer_url(tab_referrer_url), | 54 tab_referrer_url(tab_referrer_url), |
| 53 http_method(http_method), | 55 http_method(http_method), |
| 54 mime_type(mime_type), | 56 mime_type(mime_type), |
| 55 original_mime_type(original_mime_type), | 57 original_mime_type(original_mime_type), |
| 56 start_time(start), | 58 start_time(start), |
| 57 end_time(end), | 59 end_time(end), |
| 58 etag(etag), | 60 etag(etag), |
| 59 last_modified(last_modified), | 61 last_modified(last_modified), |
| 60 received_bytes(received), | 62 received_bytes(received), |
| 61 total_bytes(total), | 63 total_bytes(total), |
| 62 state(download_state), | 64 state(download_state), |
| 63 danger_type(danger_type), | 65 danger_type(danger_type), |
| 64 interrupt_reason(interrupt_reason), | 66 interrupt_reason(interrupt_reason), |
| 65 hash(hash), | 67 hash(hash), |
| 66 id(id), | 68 id(id), |
| 67 guid(guid), | 69 guid(guid), |
| 68 opened(download_opened), | 70 opened(download_opened), |
| 69 by_ext_id(ext_id), | 71 by_ext_id(ext_id), |
| 70 by_ext_name(ext_name) {} | 72 by_ext_name(ext_name) {} |
| 71 | 73 |
| 72 DownloadRow::DownloadRow(const DownloadRow& other) = default; | 74 DownloadRow::DownloadRow(const DownloadRow& other) = default; |
| 73 | 75 |
| 74 DownloadRow::~DownloadRow() {} | 76 DownloadRow::~DownloadRow() {} |
| 75 | 77 |
| 76 bool DownloadRow::operator==(const DownloadRow& rhs) const { | 78 bool DownloadRow::operator==(const DownloadRow& rhs) const { |
| 77 return current_path == rhs.current_path && target_path == rhs.target_path && | 79 return current_path == rhs.current_path && target_path == rhs.target_path && |
| 78 url_chain == rhs.url_chain && referrer_url == rhs.referrer_url && | 80 url_chain == rhs.url_chain && referrer_url == rhs.referrer_url && |
| 79 tab_url == rhs.tab_url && tab_referrer_url == rhs.tab_referrer_url && | 81 site_instance_url == rhs.site_instance_url && tab_url == rhs.tab_url && |
| 82 tab_referrer_url == rhs.tab_referrer_url && |
| 80 http_method == rhs.http_method && mime_type == rhs.mime_type && | 83 http_method == rhs.http_method && mime_type == rhs.mime_type && |
| 81 original_mime_type == rhs.original_mime_type && | 84 original_mime_type == rhs.original_mime_type && |
| 82 start_time == rhs.start_time && end_time == rhs.end_time && | 85 start_time == rhs.start_time && end_time == rhs.end_time && |
| 83 etag == rhs.etag && last_modified == rhs.last_modified && | 86 etag == rhs.etag && last_modified == rhs.last_modified && |
| 84 received_bytes == rhs.received_bytes && | 87 received_bytes == rhs.received_bytes && |
| 85 total_bytes == rhs.total_bytes && state == rhs.state && | 88 total_bytes == rhs.total_bytes && state == rhs.state && |
| 86 danger_type == rhs.danger_type && | 89 danger_type == rhs.danger_type && |
| 87 interrupt_reason == rhs.interrupt_reason && hash == rhs.hash && | 90 interrupt_reason == rhs.interrupt_reason && hash == rhs.hash && |
| 88 id == rhs.id && guid == rhs.guid && opened == rhs.opened && | 91 id == rhs.id && guid == rhs.guid && opened == rhs.opened && |
| 89 by_ext_id == rhs.by_ext_id && by_ext_name == rhs.by_ext_name; | 92 by_ext_id == rhs.by_ext_id && by_ext_name == rhs.by_ext_name; |
| 90 } | 93 } |
| 91 | 94 |
| 92 } // namespace history | 95 } // namespace history |
| OLD | NEW |