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) = default; | |
| 12 | |
| 13 ContentId::ContentId(const std::string& name_space, const std::string& id) | |
| 14 : name_space(name_space), id(id) {} | |
| 15 | |
| 16 ContentId::~ContentId() = default; | |
| 17 | |
| 18 bool ContentId::operator==(const ContentId& content_id) const { | |
| 19 return name_space == content_id.name_space && id == content_id.id; | |
| 20 } | |
| 21 | |
| 22 bool ContentId::operator<(const ContentId& content_id) const { | |
| 23 return std::tie(name_space, id) < | |
|
fgorski
2017/03/03 17:57:47
wow!
David Trainor- moved to gerrit
2017/03/06 19:03:22
+1!
| |
| 24 std::tie(content_id.name_space, content_id.id); | |
| 25 } | |
| 26 | |
| 27 OfflineItem::OfflineItem() | |
| 28 : filter(OfflineItemFilter::FILTER_OTHER), | |
| 29 total_size_bytes(0), | |
| 30 externally_removed(false), | |
| 31 is_off_the_record(false), | |
| 32 state(OfflineItemState::COMPLETE), | |
| 33 is_resumable(false), | |
| 34 received_bytes(0), | |
| 35 percent_completed(0), | |
| 36 time_remaining_ms(0) {} | |
| 37 | |
| 38 OfflineItem::OfflineItem(const OfflineItem& other) = default; | |
| 39 | |
| 40 OfflineItem::OfflineItem(const ContentId& id) : OfflineItem() { | |
| 41 this->id = id; | |
| 42 } | |
| 43 | |
| 44 OfflineItem::~OfflineItem() = default; | |
| 45 | |
| 46 bool OfflineItem::operator==(const OfflineItem& offline_item) const { | |
| 47 return id == offline_item.id && title == offline_item.title && | |
| 48 description == offline_item.description && | |
| 49 filter == offline_item.filter && | |
| 50 total_size_bytes == offline_item.total_size_bytes && | |
| 51 externally_removed == offline_item.externally_removed && | |
| 52 creation_time == offline_item.creation_time && | |
| 53 last_accessed_time == offline_item.last_accessed_time && | |
| 54 page_url == offline_item.page_url && | |
| 55 original_url == offline_item.original_url && | |
| 56 is_off_the_record == offline_item.is_off_the_record && | |
| 57 state == offline_item.state && | |
| 58 is_resumable == offline_item.is_resumable && | |
| 59 received_bytes == offline_item.received_bytes && | |
| 60 percent_completed == offline_item.percent_completed && | |
| 61 time_remaining_ms == offline_item.time_remaining_ms; | |
| 62 } | |
| 63 | |
| 64 } // namespace offline_items_collection | |
| OLD | NEW |