| Index: chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/ContentSuggestionsSource.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/ContentSuggestionsSource.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/ContentSuggestionsSource.java
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..22d0252aa85ae72279584e5d4009b398539d6ccf
|
| --- /dev/null
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/ContentSuggestionsSource.java
|
| @@ -0,0 +1,74 @@
|
| +// Copyright 2016 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.
|
| +
|
| +package org.chromium.chrome.browser.ntp.snippets;
|
| +
|
| +import android.graphics.Bitmap;
|
| +
|
| +import org.chromium.base.Callback;
|
| +import org.chromium.chrome.browser.ntp.cards.SuggestionsCategoryInfo;
|
| +import org.chromium.chrome.browser.ntp.snippets.CategoryStatus.CategoryStatusEnum;
|
| +import org.chromium.chrome.browser.ntp.snippets.KnownCategories.KnownCategoriesEnum;
|
| +
|
| +import java.util.List;
|
| +
|
| +/**
|
| + * An interface for classes that provide content suggestions.
|
| + */
|
| +public interface ContentSuggestionsSource {
|
| + /**
|
| + * An observer for events in the content suggestions service.
|
| + */
|
| + interface SnippetsObserver {
|
| + /** Called when a category has a new list of content suggestions. */
|
| + void onNewSuggestions(@KnownCategoriesEnum int category);
|
| +
|
| + /** Called when a category changed its status. */
|
| + void onCategoryStatusChanged(
|
| + @KnownCategoriesEnum int category, @CategoryStatusEnum int newStatus);
|
| + }
|
| +
|
| + /**
|
| + * Gets the categories in the order in which they should be displayed.
|
| + * @return The categories.
|
| + */
|
| + int[] getCategories();
|
| +
|
| + /**
|
| + * Gets the status of a category, possibly indicating the reason why it is disabled.
|
| + */
|
| + @CategoryStatusEnum
|
| + int getCategoryStatus(int category);
|
| +
|
| + /**
|
| + * Gets the meta information of a category.
|
| + */
|
| + SuggestionsCategoryInfo getCategoryInfo(int category);
|
| +
|
| + /**
|
| + * Gets the current content suggestions for a category, in the order in which they should be
|
| + * displayed.
|
| + */
|
| + List<SnippetArticleListItem> getSuggestionsForCategory(int category);
|
| +
|
| + /**
|
| + * Fetches the thumbnail image for a content suggestion.
|
| + */
|
| + void fetchSuggestionImage(SnippetArticleListItem suggestion, Callback<Bitmap> callback);
|
| +
|
| + /**
|
| + * Tells the source to dismiss the content suggestion.
|
| + */
|
| + void dismissSuggestion(SnippetArticleListItem suggestion);
|
| +
|
| + /**
|
| + * Checks whether a content suggestion has been visited.
|
| + */
|
| + void getSuggestionVisited(SnippetArticleListItem suggestion, Callback<Boolean> callback);
|
| +
|
| + /**
|
| + * Sets the recipient for update events from the source.
|
| + */
|
| + void setObserver(SnippetsObserver observer);
|
| +}
|
|
|