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

Unified Diff: components/ntp_snippets/ntp_snippet.cc

Issue 1922083004: Allow fetching personalized snippets from ChromeReader. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: After code review #4 Created 4 years, 7 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/ntp_snippets/ntp_snippet.cc
diff --git a/components/ntp_snippets/ntp_snippet.cc b/components/ntp_snippets/ntp_snippet.cc
index d5164c56a82a1a81fb4fa30f1f0247e7c162ee1c..06c88749659d62a8fa58cd13aeb1936361727850 100644
--- a/components/ntp_snippets/ntp_snippet.cc
+++ b/components/ntp_snippets/ntp_snippet.cc
@@ -10,6 +10,7 @@
namespace {
+const char kScore[] = "score";
const char kContentInfo[] = "contentInfo";
const char kUrl[] = "url";
@@ -142,6 +143,10 @@ std::unique_ptr<NTPSnippet> NTPSnippet::CreateFromDictionary(
return nullptr;
}
+ double score;
+ if (dict.GetDouble(kScore, &score))
+ snippet->set_score(score);
+
return snippet;
}
@@ -198,6 +203,8 @@ std::unique_ptr<base::DictionaryValue> NTPSnippet::ToDictionary() const {
std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue);
result->Set(kContentInfo, std::move(dict));
+ result->SetDouble(kScore, score_);
+
return result;
}

Powered by Google App Engine
This is Rietveld 408576698