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

Unified Diff: components/offline_content/core/offline_item.cc

Issue 2690333002: Initial checkin of OfflineContentProvider. (Closed)
Patch Set: ItemsAvailable -> AreItemsAvailable 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 side-by-side diff with in-line comments
Download patch
Index: components/offline_content/core/offline_item.cc
diff --git a/components/offline_content/core/offline_item.cc b/components/offline_content/core/offline_item.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f901d3db5731d6bd0b594f34ac106367d380576a
--- /dev/null
+++ b/components/offline_content/core/offline_item.cc
@@ -0,0 +1,89 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/offline_content/core/offline_item.h"
+
+namespace offline_content {
+
+ContentId::ContentId() = default;
+
+ContentId::ContentId(const ContentId& other)
+ : name_space(other.name_space), guid(other.guid) {}
+
+ContentId::ContentId(const std::string& name_space, const std::string& guid)
+ : name_space(name_space), guid(guid) {}
+
+bool ContentId::operator==(const ContentId& content_id) const {
+ return name_space == content_id.name_space && guid == content_id.guid;
+}
+
+bool ContentId::operator<(const ContentId& content_id) const {
+ if (name_space == content_id.name_space)
+ return guid < content_id.guid;
+ return name_space < content_id.name_space;
+}
+
+OfflineItem::OfflineItem()
+ : filter(OfflineItemFilter::FILTER_OTHER),
+ total_size_bytes(0),
+ file_type(OfflineItemFileExtension::FILE_EXTENSION_OTHER),
+ externally_removed(false),
+ is_user_gesture(false),
+ is_off_the_record(false),
+ state(OfflineItemState::COMPLETE),
+ is_resumable(false),
+ received_size_bytes(0),
+ percent_completed(0),
+ time_remaining_ms(0) {}
+
+OfflineItem::OfflineItem(const OfflineItem& other)
+ : id(other.id),
+ title(other.title),
+ description(other.description),
+ icon_url(other.icon_url),
+ filter(other.filter),
+ total_size_bytes(other.total_size_bytes),
+ file_type(other.file_type),
+ externally_removed(other.externally_removed),
+ creation_time(other.creation_time),
+ last_accessed_time(other.last_accessed_time),
+ page_url(other.page_url),
+ original_url(other.original_url),
+ referrer_url(other.referrer_url),
+ is_user_gesture(other.is_user_gesture),
+ is_off_the_record(other.is_off_the_record),
+ state(other.state),
+ is_resumable(other.is_resumable),
+ received_size_bytes(other.received_size_bytes),
+ percent_completed(other.percent_completed),
+ time_remaining_ms(other.time_remaining_ms) {}
+
+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 &&
+ icon_url == offline_item.icon_url && filter == offline_item.filter &&
+ total_size_bytes == offline_item.total_size_bytes &&
+ file_type == offline_item.file_type &&
+ externally_removed == offline_item.externally_removed &&
+ creation_time == offline_item.creation_time &&
+ last_accessed_time == offline_item.last_accessed_time &&
+ page_url == offline_item.page_url &&
+ original_url == offline_item.original_url &&
+ referrer_url == offline_item.referrer_url &&
+ is_user_gesture == offline_item.is_user_gesture &&
+ is_off_the_record == offline_item.is_off_the_record &&
+ state == offline_item.state &&
+ is_resumable == offline_item.is_resumable &&
+ received_size_bytes == offline_item.received_size_bytes &&
+ percent_completed == offline_item.percent_completed &&
+ time_remaining_ms == offline_item.time_remaining_ms;
+}
+
+} // namespace offline_content

Powered by Google App Engine
This is Rietveld 408576698