Index: chrome/browser/ui/webui/snippets_internals_message_handler.cc |
diff --git a/chrome/browser/ui/webui/snippets_internals_message_handler.cc b/chrome/browser/ui/webui/snippets_internals_message_handler.cc |
index 68e8bdc0b1f8d2dfcc75639a11fe29615d9f0486..f32a47df10c72d83f88f2d4a5836726d7dd357e0 100644 |
--- a/chrome/browser/ui/webui/snippets_internals_message_handler.cc |
+++ b/chrome/browser/ui/webui/snippets_internals_message_handler.cc |
@@ -21,12 +21,14 @@ |
#include "chrome/browser/android/chrome_feature_list.h" |
#include "chrome/browser/ntp_snippets/content_suggestions_service_factory.h" |
#include "chrome/browser/profiles/profile.h" |
+#include "components/ntp_snippets/category_info.h" |
#include "components/ntp_snippets/ntp_snippet.h" |
#include "components/ntp_snippets/switches.h" |
#include "content/public/browser/web_ui.h" |
using ntp_snippets::ContentSuggestion; |
using ntp_snippets::Category; |
+using ntp_snippets::CategoryInfo; |
using ntp_snippets::CategoryStatus; |
using ntp_snippets::KnownCategories; |
@@ -74,17 +76,6 @@ std::unique_ptr<base::DictionaryValue> PrepareSuggestion( |
return entry; |
} |
-// TODO(pke): Replace this as soon as the service delivers the title directly. |
-std::string GetCategoryTitle(Category category) { |
- if (category.IsKnownCategory(KnownCategories::ARTICLES)) { |
- return "Articles"; |
- } |
- if (category.IsKnownCategory(KnownCategories::OFFLINE_PAGES)) { |
- return "Offline pages (continue browsing)"; |
- } |
- return std::string(); |
-} |
- |
std::string GetCategoryStatusName(CategoryStatus status) { |
switch (status) { |
case CategoryStatus::INITIALIZING: |
@@ -323,6 +314,8 @@ void SnippetsInternalsMessageHandler::SendContentSuggestions() { |
for (Category category : content_suggestions_service_->GetCategories()) { |
CategoryStatus status = |
content_suggestions_service_->GetCategoryStatus(category); |
+ const CategoryInfo& info = |
+ content_suggestions_service_->GetCategoryInfo(category); |
const std::vector<ContentSuggestion>& suggestions = |
content_suggestions_service_->GetSuggestionsForCategory(category); |
@@ -333,7 +326,7 @@ void SnippetsInternalsMessageHandler::SendContentSuggestions() { |
std::unique_ptr<base::DictionaryValue> category_entry( |
new base::DictionaryValue); |
- category_entry->SetString("title", GetCategoryTitle(category)); |
+ category_entry->SetString("title", info.title()); |
category_entry->SetString("status", GetCategoryStatusName(status)); |
category_entry->Set("suggestions", std::move(suggestions_list)); |
categories_list->Append(std::move(category_entry)); |