1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
|
// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/offline_items_collection/core/offline_item.h"
#include <utility>
namespace offline_items_collection {
// -----------------------------------------------------------------------------
// ContentId.
ContentId::ContentId() = default;
ContentId::ContentId(const ContentId& other) = default;
ContentId::ContentId(const std::string& name_space, const std::string& id)
: name_space(name_space), id(id) {
DCHECK_EQ(std::string::npos, name_space.find_first_of(","));
}
ContentId::~ContentId() = default;
// -----------------------------------------------------------------------------
// OfflineItem.
OfflineItem::Progress::Progress()
: value(0), unit(OfflineItemProgressUnit::BYTES) {}
OfflineItem::Progress::Progress(const OfflineItem::Progress& other) = default;
OfflineItem::Progress::~Progress() = default;
bool OfflineItem::Progress::operator==(
const OfflineItem::Progress& other) const {
return value == other.value && max == other.max && unit == other.unit;
}
OfflineItem::OfflineItem()
: filter(OfflineItemFilter::FILTER_OTHER),
is_transient(false),
is_suggested(false),
is_accelerated(false),
promote_origin(false),
can_rename(false),
ignore_visuals(false),
content_quality_score(0),
total_size_bytes(0),
externally_removed(false),
is_openable(false),
is_off_the_record(false),
has_user_gesture(false),
state(OfflineItemState::COMPLETE),
fail_state(FailState::NO_FAILURE),
pending_state(PendingState::NOT_PENDING),
is_resumable(false),
allow_metered(false),
received_bytes(0),
time_remaining_ms(0),
danger_type(download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS),
is_dangerous(false) {}
OfflineItem::OfflineItem(const OfflineItem& other) = default;
OfflineItem& OfflineItem::operator=(const OfflineItem& other) = default;
OfflineItem::OfflineItem(const ContentId& id) : OfflineItem() {
this->id = id;
}
OfflineItem::~OfflineItem() = default;
bool OfflineItem::operator==(const OfflineItem& offline_item) const {
return id == offline_item.id && title == offline_item.title &&
description == offline_item.description &&
filter == offline_item.filter &&
is_transient == offline_item.is_transient &&
is_suggested == offline_item.is_suggested &&
is_accelerated == offline_item.is_accelerated &&
promote_origin == offline_item.promote_origin &&
can_rename == offline_item.can_rename &&
ignore_visuals == offline_item.ignore_visuals &&
content_quality_score == offline_item.content_quality_score &&
total_size_bytes == offline_item.total_size_bytes &&
externally_removed == offline_item.externally_removed &&
creation_time == offline_item.creation_time &&
completion_time == offline_item.completion_time &&
last_accessed_time == offline_item.last_accessed_time &&
is_openable == offline_item.is_openable &&
has_user_gesture == offline_item.has_user_gesture &&
file_path == offline_item.file_path &&
mime_type == offline_item.mime_type && url == offline_item.url &&
original_url == offline_item.original_url &&
is_off_the_record == offline_item.is_off_the_record &&
otr_profile_id == offline_item.otr_profile_id &&
attribution == offline_item.attribution &&
referrer_url == offline_item.referrer_url &&
state == offline_item.state && fail_state == offline_item.fail_state &&
pending_state == offline_item.pending_state &&
is_resumable == offline_item.is_resumable &&
allow_metered == offline_item.allow_metered &&
received_bytes == offline_item.received_bytes &&
progress == offline_item.progress &&
time_remaining_ms == offline_item.time_remaining_ms &&
danger_type == offline_item.danger_type &&
is_dangerous == offline_item.is_dangerous;
}
OfflineItemVisuals::OfflineItemVisuals() = default;
OfflineItemVisuals::OfflineItemVisuals(const gfx::Image& icon,
const gfx::Image& custom_favicon)
: icon(icon), custom_favicon(custom_favicon) {}
OfflineItemVisuals::OfflineItemVisuals(const OfflineItemVisuals& other) =
default;
OfflineItemVisuals::~OfflineItemVisuals() = default;
OfflineItemShareInfo::OfflineItemShareInfo() = default;
OfflineItemShareInfo::OfflineItemShareInfo(const OfflineItemShareInfo& other) =
default;
OfflineItemShareInfo::~OfflineItemShareInfo() = default;
} // namespace offline_items_collection
|