| OLD | NEW |
| 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 1238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1249 for (const auto& entry : to_store) { | 1249 for (const auto& entry : to_store) { |
| 1250 const Category& category = entry.first; | 1250 const Category& category = entry.first; |
| 1251 const CategoryContent& content = *entry.second; | 1251 const CategoryContent& content = *entry.second; |
| 1252 auto dict = base::MakeUnique<base::DictionaryValue>(); | 1252 auto dict = base::MakeUnique<base::DictionaryValue>(); |
| 1253 dict->SetInteger(kCategoryContentId, category.id()); | 1253 dict->SetInteger(kCategoryContentId, category.id()); |
| 1254 // TODO(tschumann): Persist other properties of the CategoryInfo. | 1254 // TODO(tschumann): Persist other properties of the CategoryInfo. |
| 1255 dict->SetString(kCategoryContentTitle, content.info.title()); | 1255 dict->SetString(kCategoryContentTitle, content.info.title()); |
| 1256 dict->SetBoolean(kCategoryContentProvidedByServer, | 1256 dict->SetBoolean(kCategoryContentProvidedByServer, |
| 1257 content.included_in_last_server_response); | 1257 content.included_in_last_server_response); |
| 1258 dict->SetBoolean(kCategoryContentAllowFetchingMore, | 1258 dict->SetBoolean(kCategoryContentAllowFetchingMore, |
| 1259 content.info.has_more_action()); | 1259 content.info.has_fetch_action()); |
| 1260 list.Append(std::move(dict)); | 1260 list.Append(std::move(dict)); |
| 1261 } | 1261 } |
| 1262 // Finally, store the result in the pref service. | 1262 // Finally, store the result in the pref service. |
| 1263 pref_service_->Set(prefs::kRemoteSuggestionCategories, list); | 1263 pref_service_->Set(prefs::kRemoteSuggestionCategories, list); |
| 1264 } | 1264 } |
| 1265 | 1265 |
| 1266 RemoteSuggestionsProviderImpl::CategoryContent::CategoryContent( | 1266 RemoteSuggestionsProviderImpl::CategoryContent::CategoryContent( |
| 1267 const CategoryInfo& info) | 1267 const CategoryInfo& info) |
| 1268 : info(info) {} | 1268 : info(info) {} |
| 1269 | 1269 |
| 1270 RemoteSuggestionsProviderImpl::CategoryContent::CategoryContent( | 1270 RemoteSuggestionsProviderImpl::CategoryContent::CategoryContent( |
| 1271 CategoryContent&&) = default; | 1271 CategoryContent&&) = default; |
| 1272 | 1272 |
| 1273 RemoteSuggestionsProviderImpl::CategoryContent::~CategoryContent() = default; | 1273 RemoteSuggestionsProviderImpl::CategoryContent::~CategoryContent() = default; |
| 1274 | 1274 |
| 1275 RemoteSuggestionsProviderImpl::CategoryContent& | 1275 RemoteSuggestionsProviderImpl::CategoryContent& |
| 1276 RemoteSuggestionsProviderImpl::CategoryContent::operator=(CategoryContent&&) = | 1276 RemoteSuggestionsProviderImpl::CategoryContent::operator=(CategoryContent&&) = |
| 1277 default; | 1277 default; |
| 1278 | 1278 |
| 1279 } // namespace ntp_snippets | 1279 } // namespace ntp_snippets |
| OLD | NEW |