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 transient(true) { | |
19 // |interrupt_reason| is left undefined by this constructor as the value | 20 // |interrupt_reason| is left undefined by this constructor as the value |
20 // has no meaning unless |state| is equal to kStateInterrupted. | 21 // has no meaning unless |state| is equal to kStateInterrupted. |
21 } | 22 } |
22 | 23 |
23 DownloadRow::DownloadRow( | 24 DownloadRow::DownloadRow( |
24 const base::FilePath& current_path, | 25 const base::FilePath& current_path, |
25 const base::FilePath& target_path, | 26 const base::FilePath& target_path, |
26 const std::vector<GURL>& url_chain, | 27 const std::vector<GURL>& url_chain, |
27 const GURL& referrer_url, | 28 const GURL& referrer_url, |
28 const GURL& site_url, | 29 const GURL& site_url, |
29 const GURL& tab_url, | 30 const GURL& tab_url, |
30 const GURL& tab_referrer_url, | 31 const GURL& tab_referrer_url, |
31 const std::string& http_method, | 32 const std::string& http_method, |
32 const std::string& mime_type, | 33 const std::string& mime_type, |
33 const std::string& original_mime_type, | 34 const std::string& original_mime_type, |
34 base::Time start, | 35 base::Time start, |
35 base::Time end, | 36 base::Time end, |
36 const std::string& etag, | 37 const std::string& etag, |
37 const std::string& last_modified, | 38 const std::string& last_modified, |
38 int64_t received, | 39 int64_t received, |
39 int64_t total, | 40 int64_t total, |
40 DownloadState download_state, | 41 DownloadState download_state, |
41 DownloadDangerType danger_type, | 42 DownloadDangerType danger_type, |
42 DownloadInterruptReason interrupt_reason, | 43 DownloadInterruptReason interrupt_reason, |
43 const std::string& hash, | 44 const std::string& hash, |
44 DownloadId id, | 45 DownloadId id, |
45 const std::string& guid, | 46 const std::string& guid, |
46 bool download_opened, | 47 bool download_opened, |
47 base::Time last_access, | 48 base::Time last_access, |
49 bool transient, | |
48 const std::string& ext_id, | 50 const std::string& ext_id, |
49 const std::string& ext_name, | 51 const std::string& ext_name, |
50 const std::vector<DownloadSliceInfo>& download_slice_info) | 52 const std::vector<DownloadSliceInfo>& download_slice_info) |
51 : current_path(current_path), | 53 : current_path(current_path), |
52 target_path(target_path), | 54 target_path(target_path), |
53 url_chain(url_chain), | 55 url_chain(url_chain), |
54 referrer_url(referrer_url), | 56 referrer_url(referrer_url), |
55 site_url(site_url), | 57 site_url(site_url), |
56 tab_url(tab_url), | 58 tab_url(tab_url), |
57 tab_referrer_url(tab_referrer_url), | 59 tab_referrer_url(tab_referrer_url), |
58 http_method(http_method), | 60 http_method(http_method), |
59 mime_type(mime_type), | 61 mime_type(mime_type), |
60 original_mime_type(original_mime_type), | 62 original_mime_type(original_mime_type), |
61 start_time(start), | 63 start_time(start), |
62 end_time(end), | 64 end_time(end), |
63 etag(etag), | 65 etag(etag), |
64 last_modified(last_modified), | 66 last_modified(last_modified), |
65 received_bytes(received), | 67 received_bytes(received), |
66 total_bytes(total), | 68 total_bytes(total), |
67 state(download_state), | 69 state(download_state), |
68 danger_type(danger_type), | 70 danger_type(danger_type), |
69 interrupt_reason(interrupt_reason), | 71 interrupt_reason(interrupt_reason), |
70 hash(hash), | 72 hash(hash), |
71 id(id), | 73 id(id), |
72 guid(guid), | 74 guid(guid), |
73 opened(download_opened), | 75 opened(download_opened), |
74 last_access_time(last_access), | 76 last_access_time(last_access), |
77 transient(transient), | |
75 by_ext_id(ext_id), | 78 by_ext_id(ext_id), |
76 by_ext_name(ext_name), | 79 by_ext_name(ext_name), |
77 download_slice_info(download_slice_info) {} | 80 download_slice_info(download_slice_info) {} |
78 | 81 |
79 DownloadRow::DownloadRow(const DownloadRow& other) = default; | 82 DownloadRow::DownloadRow(const DownloadRow& other) = default; |
80 | 83 |
81 DownloadRow::~DownloadRow() {} | 84 DownloadRow::~DownloadRow() {} |
82 | 85 |
83 bool DownloadRow::operator==(const DownloadRow& rhs) const { | 86 bool DownloadRow::operator==(const DownloadRow& rhs) const { |
brettw
2017/03/29 22:54:13
In the followup patch to delete the crazy construc
shaktisahu
2017/03/29 23:46:47
Acknowledged.
| |
84 return current_path == rhs.current_path && target_path == rhs.target_path && | 87 return current_path == rhs.current_path && target_path == rhs.target_path && |
85 url_chain == rhs.url_chain && referrer_url == rhs.referrer_url && | 88 url_chain == rhs.url_chain && referrer_url == rhs.referrer_url && |
86 site_url == rhs.site_url && tab_url == rhs.tab_url && | 89 site_url == rhs.site_url && tab_url == rhs.tab_url && |
87 tab_referrer_url == rhs.tab_referrer_url && | 90 tab_referrer_url == rhs.tab_referrer_url && |
88 http_method == rhs.http_method && mime_type == rhs.mime_type && | 91 http_method == rhs.http_method && mime_type == rhs.mime_type && |
89 original_mime_type == rhs.original_mime_type && | 92 original_mime_type == rhs.original_mime_type && |
90 start_time == rhs.start_time && end_time == rhs.end_time && | 93 start_time == rhs.start_time && end_time == rhs.end_time && |
91 etag == rhs.etag && last_modified == rhs.last_modified && | 94 etag == rhs.etag && last_modified == rhs.last_modified && |
92 received_bytes == rhs.received_bytes && | 95 received_bytes == rhs.received_bytes && |
93 total_bytes == rhs.total_bytes && state == rhs.state && | 96 total_bytes == rhs.total_bytes && state == rhs.state && |
94 danger_type == rhs.danger_type && | 97 danger_type == rhs.danger_type && |
95 interrupt_reason == rhs.interrupt_reason && hash == rhs.hash && | 98 interrupt_reason == rhs.interrupt_reason && hash == rhs.hash && |
96 id == rhs.id && guid == rhs.guid && opened == rhs.opened && | 99 id == rhs.id && guid == rhs.guid && opened == rhs.opened && |
97 last_access_time == rhs.last_access_time && | 100 last_access_time == rhs.last_access_time && |
98 by_ext_id == rhs.by_ext_id && by_ext_name == rhs.by_ext_name && | 101 transient == rhs.transient && by_ext_id == rhs.by_ext_id && |
102 by_ext_name == rhs.by_ext_name && | |
99 download_slice_info == rhs.download_slice_info; | 103 download_slice_info == rhs.download_slice_info; |
100 } | 104 } |
101 | 105 |
102 } // namespace history | 106 } // namespace history |
OLD | NEW |