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

Unified Diff: components/reading_list/core/reading_list_entry.cc

Issue 2806213004: Track if a ReadingListEntry has been dismissed (Closed)
Patch Set: Address comment Created 3 years, 8 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/reading_list/core/reading_list_entry.cc
diff --git a/components/reading_list/core/reading_list_entry.cc b/components/reading_list/core/reading_list_entry.cc
index 784f76b7375909ef933fae13e6a2c2936e5e79d6..33d97a299ddea204db01d83f5deedb8c89545fcd 100644
--- a/components/reading_list/core/reading_list_entry.cc
+++ b/components/reading_list/core/reading_list_entry.cc
@@ -68,7 +68,8 @@ ReadingListEntry::ReadingListEntry(const GURL& url,
0,
0,
0,
- std::move(backoff)) {}
+ std::move(backoff),
+ reading_list::ContentSuggestionsExtra()) {}
ReadingListEntry::ReadingListEntry(
const GURL& url,
@@ -84,7 +85,8 @@ ReadingListEntry::ReadingListEntry(
int64_t distillation_time,
int64_t distillation_size,
int failed_download_counter,
- std::unique_ptr<net::BackoffEntry> backoff)
+ std::unique_ptr<net::BackoffEntry> backoff,
+ const reading_list::ContentSuggestionsExtra& content_suggestions_extra)
: url_(url),
title_(title),
state_(state),
@@ -97,7 +99,8 @@ ReadingListEntry::ReadingListEntry(
update_time_us_(update_time),
update_title_time_us_(update_title_time),
distillation_time_us_(distillation_time),
- distillation_size_(distillation_size) {
+ distillation_size_(distillation_size),
+ content_suggestions_extra_(content_suggestions_extra) {
if (backoff) {
backoff_ = std::move(backoff);
} else {
@@ -124,7 +127,8 @@ ReadingListEntry::ReadingListEntry(ReadingListEntry&& entry)
update_time_us_(std::move(entry.update_time_us_)),
update_title_time_us_(std::move(entry.update_title_time_us_)),
distillation_time_us_(std::move(entry.distillation_time_us_)),
- distillation_size_(std::move(entry.distillation_size_)) {}
+ distillation_size_(std::move(entry.distillation_size_)),
+ content_suggestions_extra_(std::move(entry.content_suggestions_extra_)) {}
ReadingListEntry::~ReadingListEntry() {}
@@ -179,6 +183,7 @@ ReadingListEntry& ReadingListEntry::operator=(ReadingListEntry&& other) {
update_title_time_us_ = std::move(other.update_title_time_us_);
distillation_time_us_ = std::move(other.distillation_time_us_);
distillation_size_ = std::move(other.distillation_size_);
+ content_suggestions_extra_ = std::move(other.content_suggestions_extra_);
return *this;
}
@@ -216,6 +221,16 @@ bool ReadingListEntry::HasBeenSeen() const {
return state_ != UNSEEN;
}
+const reading_list::ContentSuggestionsExtra*
+ReadingListEntry::ContentSuggestionsExtra() const {
+ return &content_suggestions_extra_;
+}
+
+void ReadingListEntry::SetContentSuggestionsExtra(
+ const reading_list::ContentSuggestionsExtra& extra) {
+ content_suggestions_extra_ = extra;
+}
+
void ReadingListEntry::SetDistilledInfo(const base::FilePath& path,
const GURL& distilled_url,
int64_t distilation_size,
@@ -387,11 +402,20 @@ std::unique_ptr<ReadingListEntry> ReadingListEntry::FromReadingListLocal(
}
}
+ reading_list::ContentSuggestionsExtra content_suggestions_extra;
+ if (pb_entry.has_content_suggestions_extra()) {
+ const reading_list::ReadingListContentSuggestionsExtra& pb_extra =
+ pb_entry.content_suggestions_extra();
+ if (pb_extra.has_dismissed()) {
+ content_suggestions_extra.dismissed = pb_extra.dismissed();
+ }
+ }
+
return base::WrapUnique<ReadingListEntry>(new ReadingListEntry(
url, title, state, creation_time_us, first_read_time_us, update_time_us,
update_title_time_us, distillation_state, distilled_path, distilled_url,
distillation_time_us, distillation_size, failed_download_counter,
- std::move(backoff)));
+ std::move(backoff), content_suggestions_extra));
}
// static
@@ -452,8 +476,8 @@ std::unique_ptr<ReadingListEntry> ReadingListEntry::FromReadingListSpecifics(
return base::WrapUnique<ReadingListEntry>(new ReadingListEntry(
url, title, state, creation_time_us, first_read_time_us, update_time_us,
- update_title_time_us, WAITING, base::FilePath(), GURL(), 0, 0, 0,
- nullptr));
+ update_title_time_us, WAITING, base::FilePath(), GURL(), 0, 0, 0, nullptr,
+ reading_list::ContentSuggestionsExtra()));
}
void ReadingListEntry::MergeWithEntry(const ReadingListEntry& other) {
@@ -579,6 +603,11 @@ ReadingListEntry::AsReadingListLocal(const base::Time& now) const {
serializer.Serialize(*backoff);
pb_entry->set_backoff(output);
}
+
+ reading_list::ReadingListContentSuggestionsExtra* pb_extra =
+ pb_entry->mutable_content_suggestions_extra();
+ pb_extra->set_dismissed(content_suggestions_extra_.dismissed);
+
return pb_entry;
}

Powered by Google App Engine
This is Rietveld 408576698