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, | 26 const GURL& referrer, |
| 27 const GURL& tab_url, |
| 28 const GURL& tab_referrer_url, |
27 const std::string& http_method, | 29 const std::string& http_method, |
28 const std::string& mime_type, | 30 const std::string& mime_type, |
29 const std::string& original_mime_type, | 31 const std::string& original_mime_type, |
30 const base::Time& start, | 32 const base::Time& start, |
31 const base::Time& end, | 33 const base::Time& end, |
32 const std::string& etag, | 34 const std::string& etag, |
33 const std::string& last_modified, | 35 const std::string& last_modified, |
34 int64_t received, | 36 int64_t received, |
35 int64_t total, | 37 int64_t total, |
36 DownloadState download_state, | 38 DownloadState download_state, |
37 DownloadDangerType danger_type, | 39 DownloadDangerType danger_type, |
38 DownloadInterruptReason interrupt_reason, | 40 DownloadInterruptReason interrupt_reason, |
39 const std::string& hash, | 41 const std::string& hash, |
40 DownloadId id, | 42 DownloadId id, |
41 const std::string& guid, | 43 const std::string& guid, |
42 bool download_opened, | 44 bool download_opened, |
43 const std::string& ext_id, | 45 const std::string& ext_id, |
44 const std::string& ext_name) | 46 const std::string& ext_name) |
45 : current_path(current_path), | 47 : current_path(current_path), |
46 target_path(target_path), | 48 target_path(target_path), |
47 url_chain(url_chain), | 49 url_chain(url_chain), |
48 referrer_url(referrer), | 50 referrer_url(referrer), |
| 51 tab_url(tab_url), |
| 52 tab_referrer_url(tab_referrer_url), |
49 http_method(http_method), | 53 http_method(http_method), |
50 mime_type(mime_type), | 54 mime_type(mime_type), |
51 original_mime_type(original_mime_type), | 55 original_mime_type(original_mime_type), |
52 start_time(start), | 56 start_time(start), |
53 end_time(end), | 57 end_time(end), |
54 etag(etag), | 58 etag(etag), |
55 last_modified(last_modified), | 59 last_modified(last_modified), |
56 received_bytes(received), | 60 received_bytes(received), |
57 total_bytes(total), | 61 total_bytes(total), |
58 state(download_state), | 62 state(download_state), |
59 danger_type(danger_type), | 63 danger_type(danger_type), |
60 interrupt_reason(interrupt_reason), | 64 interrupt_reason(interrupt_reason), |
61 hash(hash), | 65 hash(hash), |
62 id(id), | 66 id(id), |
63 guid(guid), | 67 guid(guid), |
64 opened(download_opened), | 68 opened(download_opened), |
65 by_ext_id(ext_id), | 69 by_ext_id(ext_id), |
66 by_ext_name(ext_name) {} | 70 by_ext_name(ext_name) {} |
67 | 71 |
68 DownloadRow::DownloadRow(const DownloadRow& other) = default; | 72 DownloadRow::DownloadRow(const DownloadRow& other) = default; |
69 | 73 |
70 DownloadRow::~DownloadRow() {} | 74 DownloadRow::~DownloadRow() {} |
71 | 75 |
72 bool DownloadRow::operator==(const DownloadRow& rhs) const { | 76 bool DownloadRow::operator==(const DownloadRow& rhs) const { |
73 return current_path == rhs.current_path && | 77 return current_path == rhs.current_path && target_path == rhs.target_path && |
74 target_path == rhs.target_path && | 78 url_chain == rhs.url_chain && referrer_url == rhs.referrer_url && |
75 url_chain == rhs.url_chain && | 79 tab_url == rhs.tab_url && tab_referrer_url == rhs.tab_referrer_url && |
76 referrer_url == rhs.referrer_url && | 80 http_method == rhs.http_method && mime_type == rhs.mime_type && |
77 http_method == rhs.http_method && | |
78 mime_type == rhs.mime_type && | |
79 original_mime_type == rhs.original_mime_type && | 81 original_mime_type == rhs.original_mime_type && |
80 start_time == rhs.start_time && | 82 start_time == rhs.start_time && end_time == rhs.end_time && |
81 end_time == rhs.end_time && | 83 etag == rhs.etag && last_modified == rhs.last_modified && |
82 etag == rhs.etag && | |
83 last_modified == rhs.last_modified && | |
84 received_bytes == rhs.received_bytes && | 84 received_bytes == rhs.received_bytes && |
85 total_bytes == rhs.total_bytes && | 85 total_bytes == rhs.total_bytes && state == rhs.state && |
86 state == rhs.state && | |
87 danger_type == rhs.danger_type && | 86 danger_type == rhs.danger_type && |
88 interrupt_reason == rhs.interrupt_reason && | 87 interrupt_reason == rhs.interrupt_reason && hash == rhs.hash && |
89 hash == rhs.hash && | 88 id == rhs.id && guid == rhs.guid && opened == rhs.opened && |
90 id == rhs.id && | 89 by_ext_id == rhs.by_ext_id && by_ext_name == rhs.by_ext_name; |
91 guid == rhs.guid && | |
92 opened == rhs.opened && | |
93 by_ext_id == rhs.by_ext_id && | |
94 by_ext_name == rhs.by_ext_name; | |
95 } | 90 } |
96 | 91 |
97 } // namespace history | 92 } // namespace history |
OLD | NEW |