Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "components/offline_items_collection/core/offline_item.h" | |
| 6 | |
| 7 namespace offline_items_collection { | |
| 8 | |
| 9 ContentId::ContentId() = default; | |
| 10 | |
| 11 ContentId::ContentId(const ContentId& other) | |
|
dcheng
2017/03/03 08:59:45
Or just = default this too.
David Trainor- moved to gerrit
2017/03/03 09:42:01
Done.
| |
| 12 : name_space(other.name_space), id(other.id) {} | |
| 13 | |
| 14 ContentId::ContentId(const std::string& name_space, const std::string& id) | |
| 15 : name_space(name_space), id(id) {} | |
| 16 | |
| 17 ContentId::~ContentId() = default; | |
| 18 | |
| 19 bool ContentId::operator==(const ContentId& content_id) const { | |
| 20 return name_space == content_id.name_space && id == content_id.id; | |
| 21 } | |
| 22 | |
| 23 bool ContentId::operator<(const ContentId& content_id) const { | |
| 24 if (name_space == content_id.name_space) | |
|
dcheng
2017/03/03 08:59:45
return std::tie(name_space, id) < std::tie(content
David Trainor- moved to gerrit
2017/03/03 09:42:00
Done.
| |
| 25 return id < content_id.id; | |
| 26 return name_space < content_id.name_space; | |
| 27 } | |
| 28 | |
| 29 OfflineItem::OfflineItem() | |
| 30 : filter(OfflineItemFilter::FILTER_OTHER), | |
| 31 total_size_bytes(0), | |
| 32 externally_removed(false), | |
| 33 is_off_the_record(false), | |
| 34 state(OfflineItemState::COMPLETE), | |
| 35 is_resumable(false), | |
| 36 received_bytes(0), | |
| 37 percent_completed(0), | |
| 38 time_remaining_ms(0) {} | |
| 39 | |
| 40 OfflineItem::OfflineItem(const OfflineItem& other) | |
|
dcheng
2017/03/03 08:59:45
Ditto: = default will save a lot of typing here.
David Trainor- moved to gerrit
2017/03/03 09:42:00
Done.
| |
| 41 : id(other.id), | |
| 42 title(other.title), | |
| 43 description(other.description), | |
| 44 filter(other.filter), | |
| 45 total_size_bytes(other.total_size_bytes), | |
| 46 externally_removed(other.externally_removed), | |
| 47 creation_time(other.creation_time), | |
| 48 last_accessed_time(other.last_accessed_time), | |
| 49 page_url(other.page_url), | |
| 50 original_url(other.original_url), | |
| 51 is_off_the_record(other.is_off_the_record), | |
| 52 state(other.state), | |
| 53 is_resumable(other.is_resumable), | |
| 54 received_bytes(other.received_bytes), | |
| 55 percent_completed(other.percent_completed), | |
| 56 time_remaining_ms(other.time_remaining_ms) {} | |
| 57 | |
| 58 OfflineItem::OfflineItem(const ContentId& id) : OfflineItem() { | |
| 59 this->id = id; | |
| 60 } | |
| 61 | |
| 62 OfflineItem::~OfflineItem() = default; | |
| 63 | |
| 64 bool OfflineItem::operator==(const OfflineItem& offline_item) const { | |
| 65 return id == offline_item.id && title == offline_item.title && | |
| 66 description == offline_item.description && | |
| 67 filter == offline_item.filter && | |
| 68 total_size_bytes == offline_item.total_size_bytes && | |
| 69 externally_removed == offline_item.externally_removed && | |
| 70 creation_time == offline_item.creation_time && | |
| 71 last_accessed_time == offline_item.last_accessed_time && | |
| 72 page_url == offline_item.page_url && | |
| 73 original_url == offline_item.original_url && | |
| 74 is_off_the_record == offline_item.is_off_the_record && | |
| 75 state == offline_item.state && | |
| 76 is_resumable == offline_item.is_resumable && | |
| 77 received_bytes == offline_item.received_bytes && | |
| 78 percent_completed == offline_item.percent_completed && | |
| 79 time_remaining_ms == offline_item.time_remaining_ms; | |
| 80 } | |
| 81 | |
| 82 } // namespace offline_items_collection | |
| OLD | NEW |