File: offline_item.cc

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (121 lines) | stat: -rw-r--r-- 4,780 bytes parent folder | download | duplicates (5)
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