| 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 9b3d770447bb1d81ebf1a370f5383de575646072..703d28073dcfd8202e4592891b653d0c0e1418b2 100644
|
| --- a/chrome/browser/ui/webui/snippets_internals_message_handler.cc
|
| +++ b/chrome/browser/ui/webui/snippets_internals_message_handler.cc
|
| @@ -30,6 +30,7 @@
|
| #include "chrome/common/chrome_features.h"
|
| #include "components/ntp_snippets/category.h"
|
| #include "components/ntp_snippets/category_info.h"
|
| +#include "components/ntp_snippets/category_rankers/category_ranker.h"
|
| #include "components/ntp_snippets/features.h"
|
| #include "components/ntp_snippets/pref_names.h"
|
| #include "components/ntp_snippets/remote/remote_suggestions_fetcher.h"
|
| @@ -375,6 +376,7 @@ void SnippetsInternalsMessageHandler::SendAllContent() {
|
| chrome::android::kPhysicalWebFeature));
|
|
|
| SendClassification();
|
| + SendRankerDebugData();
|
| SendLastRemoteSuggestionsBackgroundFetchTime();
|
|
|
| if (remote_suggestions_provider_) {
|
| @@ -412,6 +414,24 @@ void SnippetsInternalsMessageHandler::SendClassification() {
|
| UserClassifier::Metric::SUGGESTIONS_USED)));
|
| }
|
|
|
| +void SnippetsInternalsMessageHandler::SendRankerDebugData() {
|
| + std::vector<ntp_snippets::CategoryRanker::DebugDataItem> data =
|
| + content_suggestions_service_->category_ranker()->GetDebugData();
|
| +
|
| + std::unique_ptr<base::ListValue> items_list(new base::ListValue);
|
| + for (const auto& item : data) {
|
| + auto entry = base::MakeUnique<base::DictionaryValue>();
|
| + entry->SetString("label", item.label);
|
| + entry->SetString("content", item.content);
|
| + items_list->Append(std::move(entry));
|
| + }
|
| +
|
| + base::DictionaryValue result;
|
| + result.Set("list", std::move(items_list));
|
| + web_ui()->CallJavascriptFunctionUnsafe(
|
| + "chrome.SnippetsInternals.receiveRankerDebugData", result);
|
| +}
|
| +
|
| void SnippetsInternalsMessageHandler::
|
| SendLastRemoteSuggestionsBackgroundFetchTime() {
|
| base::Time time = base::Time::FromInternalValue(pref_service_->GetInt64(
|
|
|