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

Side by Side Diff: components/ntp_snippets/remote/remote_suggestions_provider_impl.cc

Issue 2751093003: Unifies the additional actions for Categories (Closed)
Patch Set: Address comments Created 3 years, 9 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/ntp_snippets/remote/remote_suggestions_provider_impl.h" 5 #include "components/ntp_snippets/remote/remote_suggestions_provider_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 1236 matching lines...) Expand 10 before | Expand all | Expand 10 after
1247 base::ListValue list; 1247 base::ListValue list;
1248 for (const auto& entry : to_store) { 1248 for (const auto& entry : to_store) {
1249 const Category& category = entry.first; 1249 const Category& category = entry.first;
1250 const CategoryContent& content = *entry.second; 1250 const CategoryContent& content = *entry.second;
1251 auto dict = base::MakeUnique<base::DictionaryValue>(); 1251 auto dict = base::MakeUnique<base::DictionaryValue>();
1252 dict->SetInteger(kCategoryContentId, category.id()); 1252 dict->SetInteger(kCategoryContentId, category.id());
1253 // TODO(tschumann): Persist other properties of the CategoryInfo. 1253 // TODO(tschumann): Persist other properties of the CategoryInfo.
1254 dict->SetString(kCategoryContentTitle, content.info.title()); 1254 dict->SetString(kCategoryContentTitle, content.info.title());
1255 dict->SetBoolean(kCategoryContentProvidedByServer, 1255 dict->SetBoolean(kCategoryContentProvidedByServer,
1256 content.included_in_last_server_response); 1256 content.included_in_last_server_response);
1257 dict->SetBoolean(kCategoryContentAllowFetchingMore, 1257 bool has_fetch_action = content.info.additional_action() ==
1258 content.info.has_fetch_action()); 1258 ContentSuggestionsAdditionalAction::FETCH;
1259 dict->SetBoolean(kCategoryContentAllowFetchingMore, has_fetch_action);
1259 list.Append(std::move(dict)); 1260 list.Append(std::move(dict));
1260 } 1261 }
1261 // Finally, store the result in the pref service. 1262 // Finally, store the result in the pref service.
1262 pref_service_->Set(prefs::kRemoteSuggestionCategories, list); 1263 pref_service_->Set(prefs::kRemoteSuggestionCategories, list);
1263 } 1264 }
1264 1265
1265 RemoteSuggestionsProviderImpl::CategoryContent::CategoryContent( 1266 RemoteSuggestionsProviderImpl::CategoryContent::CategoryContent(
1266 const CategoryInfo& info) 1267 const CategoryInfo& info)
1267 : info(info) {} 1268 : info(info) {}
1268 1269
1269 RemoteSuggestionsProviderImpl::CategoryContent::CategoryContent( 1270 RemoteSuggestionsProviderImpl::CategoryContent::CategoryContent(
1270 CategoryContent&&) = default; 1271 CategoryContent&&) = default;
1271 1272
1272 RemoteSuggestionsProviderImpl::CategoryContent::~CategoryContent() = default; 1273 RemoteSuggestionsProviderImpl::CategoryContent::~CategoryContent() = default;
1273 1274
1274 RemoteSuggestionsProviderImpl::CategoryContent& 1275 RemoteSuggestionsProviderImpl::CategoryContent&
1275 RemoteSuggestionsProviderImpl::CategoryContent::operator=(CategoryContent&&) = 1276 RemoteSuggestionsProviderImpl::CategoryContent::operator=(CategoryContent&&) =
1276 default; 1277 default;
1277 1278
1278 } // namespace ntp_snippets 1279 } // namespace ntp_snippets
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698