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

Unified Diff: chrome/browser/ui/webui/snippets_internals_message_handler.cc

Issue 2557363002: [NTP Snippets] Refactor background scheduling for remote suggestions (Closed)
Patch Set: Rebase Created 4 years 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: 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 c32b36c4355fb5317082bdb2a46a42dcebaacfdd..e4d134abe8b79ac31975c12a11e75253b146bdf2 100644
--- a/chrome/browser/ui/webui/snippets_internals_message_handler.cc
+++ b/chrome/browser/ui/webui/snippets_internals_message_handler.cc
@@ -37,6 +37,7 @@ using ntp_snippets::Category;
using ntp_snippets::CategoryInfo;
using ntp_snippets::CategoryStatus;
using ntp_snippets::KnownCategories;
+using ntp_snippets::RemoteSuggestionsProvider;
using ntp_snippets::UserClassifier;
namespace {
@@ -88,7 +89,8 @@ SnippetsInternalsMessageHandler::SnippetsInternalsMessageHandler(
dom_loaded_(false),
content_suggestions_service_(content_suggestions_service),
remote_suggestions_provider_(
- content_suggestions_service_->ntp_snippets_service()),
+ content_suggestions_service_
+ ->remote_suggestions_provider_for_debugging()),
pref_service_(pref_service),
weak_ptr_factory_(this) {}
@@ -195,7 +197,7 @@ void SnippetsInternalsMessageHandler::HandleDownload(
if (!remote_suggestions_provider_)
return;
- remote_suggestions_provider_->FetchSnippetsForAllCategories();
+ remote_suggestions_provider_->ReloadSuggestions();
}
void SnippetsInternalsMessageHandler::HandleClearCachedSuggestions(
@@ -271,7 +273,8 @@ void SnippetsInternalsMessageHandler::ClearClassification(
void SnippetsInternalsMessageHandler::FetchRemoteSuggestionsInTheBackground(
const base::ListValue* args) {
DCHECK_EQ(0u, args->GetSize());
- remote_suggestions_provider_->FetchSnippetsInTheBackground();
+ remote_suggestions_provider_->RefetchInTheBackground(
+ RemoteSuggestionsProvider::FetchStatusCallback());
}
void SnippetsInternalsMessageHandler::SendAllContent() {

Powered by Google App Engine
This is Rietveld 408576698