Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: components/offline_items_collection/core/offline_item.cc

Issue 2690333002: Initial checkin of OfflineContentProvider. (Closed)
Patch Set: Moved files to components/offline_items_collection. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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)
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 bool ContentId::operator==(const ContentId& content_id) const {
18 return name_space == content_id.name_space && id == content_id.id;
19 }
20
21 bool ContentId::operator<(const ContentId& content_id) const {
22 if (name_space == content_id.name_space)
23 return id < content_id.id;
24 return name_space < content_id.name_space;
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_size_bytes(0),
35 percent_completed(0),
36 time_remaining_ms(0) {}
37
38 OfflineItem::OfflineItem(const OfflineItem& other)
39 : id(other.id),
40 title(other.title),
41 description(other.description),
42 filter(other.filter),
43 total_size_bytes(other.total_size_bytes),
44 externally_removed(other.externally_removed),
45 creation_time(other.creation_time),
46 last_accessed_time(other.last_accessed_time),
47 page_url(other.page_url),
48 original_url(other.original_url),
49 is_off_the_record(other.is_off_the_record),
50 state(other.state),
51 is_resumable(other.is_resumable),
52 received_size_bytes(other.received_size_bytes),
53 percent_completed(other.percent_completed),
54 time_remaining_ms(other.time_remaining_ms) {}
55
56 OfflineItem::OfflineItem(const ContentId& id) : OfflineItem() {
57 this->id = id;
58 }
59
60 OfflineItem::~OfflineItem() = default;
61
62 bool OfflineItem::operator==(const OfflineItem& offline_item) const {
63 return id == offline_item.id && title == offline_item.title &&
64 description == offline_item.description &&
65 filter == offline_item.filter &&
66 total_size_bytes == offline_item.total_size_bytes &&
67 externally_removed == offline_item.externally_removed &&
68 creation_time == offline_item.creation_time &&
69 last_accessed_time == offline_item.last_accessed_time &&
70 page_url == offline_item.page_url &&
71 original_url == offline_item.original_url &&
72 is_off_the_record == offline_item.is_off_the_record &&
73 state == offline_item.state &&
74 is_resumable == offline_item.is_resumable &&
75 received_size_bytes == offline_item.received_size_bytes &&
76 percent_completed == offline_item.percent_completed &&
77 time_remaining_ms == offline_item.time_remaining_ms;
78 }
79
80 } // namespace offline_items_collection
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698