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

Unified Diff: components/ntp_snippets/ntp_snippets_service.cc

Issue 1907233002: Allows to dump current snippets to a json in the Downloads folder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor cleanup Created 4 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/ntp_snippets/ntp_snippets_service.cc
diff --git a/components/ntp_snippets/ntp_snippets_service.cc b/components/ntp_snippets/ntp_snippets_service.cc
index 84dfaecdbeaba33b4e7e12317311c991a182ecad..2dbf344a3fd90a37a6ae422a3dc95bc04b534a52 100644
--- a/components/ntp_snippets/ntp_snippets_service.cc
+++ b/components/ntp_snippets/ntp_snippets_service.cc
@@ -141,16 +141,6 @@ bool AddSnippetsFromListValue(const base::ListValue& list,
return true;
}
-scoped_ptr<base::ListValue> SnippetsToListValue(
- const NTPSnippetsService::NTPSnippetStorage& snippets) {
- scoped_ptr<base::ListValue> list(new base::ListValue);
- for (const auto& snippet : snippets) {
- scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
- dict->Set(kContentInfo, snippet->ToDictionary());
- list->Append(std::move(dict));
- }
- return list;
-}
bool ContainsSnippet(const NTPSnippetsService::NTPSnippetStorage& haystack,
const scoped_ptr<NTPSnippet>& needle) {
@@ -392,6 +382,17 @@ bool NTPSnippetsService::LoadFromListValue(const base::ListValue& list) {
return true;
}
+scoped_ptr<base::ListValue> NTPSnippetsService::SnippetsToListValue(
+ const NTPSnippetsService::NTPSnippetStorage& snippets) const {
+ scoped_ptr<base::ListValue> list(new base::ListValue);
+ for (const auto& snippet : snippets) {
+ scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
+ dict->Set(kContentInfo, snippet->ToDictionary());
+ list->Append(std::move(dict));
+ }
+ return list;
+}
+
void NTPSnippetsService::LoadSnippetsFromPrefs() {
bool success = LoadFromListValue(*pref_service_->GetList(prefs::kSnippets));
DCHECK(success) << "Failed to parse snippets from prefs";

Powered by Google App Engine
This is Rietveld 408576698