blob: f130c77f881bef209ca6cd828cf5b44546b915e9 [file] [log] [blame]
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <vector>
#include "base/callback_forward.h"
#include "components/ntp_snippets/remote/json_to_categories.h"
namespace ntp_snippets {
// Listens to pushed breaking news and refresh requests from the content
// suggestion servers.
class BreakingNewsListener {
using OnNewRemoteSuggestionCallback =
base::Callback<void(std::unique_ptr<RemoteSuggestion> remote_suggestion)>;
using OnRefreshRequestedCallback = base::Callback<void()>;
virtual ~BreakingNewsListener() = default;
// Subscribe to the breaking news service and start listening for pushed
// messages from the content suggestion server. Must not be called if already
// listening.
virtual void StartListening(
OnNewRemoteSuggestionCallback on_new_remote_suggestion_callback,
OnRefreshRequestedCallback on_refresh_requested_callback) = 0;
// Stop listening for pushed messages from the content suggestion server. Any
// further pushed messages will be ignored. Must be called while listening.
virtual void StopListening() = 0;
virtual bool IsListening() const = 0;
} // namespace ntp_snippets