| 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_content/core/offline_item.h" |
| 6 |
| 7 namespace offline_content { |
| 8 |
| 9 ContentId::ContentId() = default; |
| 10 |
| 11 ContentId::ContentId(const ContentId& other) |
| 12 : name_space(other.name_space), guid(other.guid) {} |
| 13 |
| 14 ContentId::ContentId(const std::string& name_space, const std::string& guid) |
| 15 : name_space(name_space), guid(guid) {} |
| 16 |
| 17 bool ContentId::operator==(const ContentId& content_id) const { |
| 18 return name_space == content_id.name_space && guid == content_id.guid; |
| 19 } |
| 20 |
| 21 bool ContentId::operator<(const ContentId& content_id) const { |
| 22 if (name_space == content_id.name_space) |
| 23 return guid < content_id.guid; |
| 24 return name_space < content_id.name_space; |
| 25 } |
| 26 |
| 27 OfflineItem::OfflineItem() |
| 28 : filter(OfflineItemFilter::FILTER_OTHER), |
| 29 total_size_bytes(0), |
| 30 file_type(OfflineItemFileExtension::FILE_EXTENSION_OTHER), |
| 31 externally_removed(false), |
| 32 is_user_gesture(false), |
| 33 is_off_the_record(false), |
| 34 state(OfflineItemState::COMPLETE), |
| 35 is_resumable(false), |
| 36 received_size_bytes(0), |
| 37 percent_completed(0), |
| 38 time_remaining_ms(0) {} |
| 39 |
| 40 OfflineItem::OfflineItem(const OfflineItem& other) |
| 41 : id(other.id), |
| 42 title(other.title), |
| 43 description(other.description), |
| 44 icon_url(other.icon_url), |
| 45 filter(other.filter), |
| 46 total_size_bytes(other.total_size_bytes), |
| 47 file_type(other.file_type), |
| 48 externally_removed(other.externally_removed), |
| 49 creation_time(other.creation_time), |
| 50 last_accessed_time(other.last_accessed_time), |
| 51 page_url(other.page_url), |
| 52 original_url(other.original_url), |
| 53 referrer_url(other.referrer_url), |
| 54 is_user_gesture(other.is_user_gesture), |
| 55 is_off_the_record(other.is_off_the_record), |
| 56 state(other.state), |
| 57 is_resumable(other.is_resumable), |
| 58 received_size_bytes(other.received_size_bytes), |
| 59 percent_completed(other.percent_completed), |
| 60 time_remaining_ms(other.time_remaining_ms) {} |
| 61 |
| 62 OfflineItem::OfflineItem(const ContentId& id) : OfflineItem() { |
| 63 this->id = id; |
| 64 } |
| 65 |
| 66 OfflineItem::~OfflineItem() = default; |
| 67 |
| 68 bool OfflineItem::operator==(const OfflineItem& offline_item) const { |
| 69 return id == offline_item.id && title == offline_item.title && |
| 70 description == offline_item.description && |
| 71 icon_url == offline_item.icon_url && filter == offline_item.filter && |
| 72 total_size_bytes == offline_item.total_size_bytes && |
| 73 file_type == offline_item.file_type && |
| 74 externally_removed == offline_item.externally_removed && |
| 75 creation_time == offline_item.creation_time && |
| 76 last_accessed_time == offline_item.last_accessed_time && |
| 77 page_url == offline_item.page_url && |
| 78 original_url == offline_item.original_url && |
| 79 referrer_url == offline_item.referrer_url && |
| 80 is_user_gesture == offline_item.is_user_gesture && |
| 81 is_off_the_record == offline_item.is_off_the_record && |
| 82 state == offline_item.state && |
| 83 is_resumable == offline_item.is_resumable && |
| 84 received_size_bytes == offline_item.received_size_bytes && |
| 85 percent_completed == offline_item.percent_completed && |
| 86 time_remaining_ms == offline_item.time_remaining_ms; |
| 87 } |
| 88 |
| 89 } // namespace offline_content |
| OLD | NEW |