| Index: components/ntp_snippets/ntp_snippets_service.h
|
| diff --git a/components/ntp_snippets/ntp_snippets_service.h b/components/ntp_snippets/ntp_snippets_service.h
|
| index 1a1f0ab24c89883a6a99c044a436649d8e08bb31..7e17f61ca191e1de018b3ce4fddbdc99b08aebaf 100644
|
| --- a/components/ntp_snippets/ntp_snippets_service.h
|
| +++ b/components/ntp_snippets/ntp_snippets_service.h
|
| @@ -116,8 +116,8 @@ class NTPSnippetsService : public ContentSuggestionsProvider,
|
| // ContentSuggestionsProvider implementation
|
| CategoryStatus GetCategoryStatus(Category category) override;
|
| CategoryInfo GetCategoryInfo(Category category) override;
|
| - void DismissSuggestion(const std::string& suggestion_id) override;
|
| - void FetchSuggestionImage(const std::string& suggestion_id,
|
| + void DismissSuggestion(const ContentSuggestion::ID& suggestion_id) override;
|
| + void FetchSuggestionImage(const ContentSuggestion::ID& suggestion_id,
|
| const ImageFetchedCallback& callback) override;
|
| void ClearHistory(
|
| base::Time begin,
|
| @@ -197,12 +197,12 @@ class NTPSnippetsService : public ContentSuggestionsProvider,
|
| };
|
|
|
| // Returns the URL of the image of a snippet if it is among the current or
|
| - // among the archived snippets in |category|. Returns an empty URL, otherwise.
|
| - GURL FindSnippetImageUrl(Category category,
|
| - const std::string& snippet_id) const;
|
| + // among the archived snippets in the matching category. Returns an empty URL
|
| + // otherwise.
|
| + GURL FindSnippetImageUrl(const ContentSuggestion::ID& suggestion_id) const;
|
|
|
| // image_fetcher::ImageFetcherDelegate implementation.
|
| - void OnImageDataFetched(const std::string& suggestion_id,
|
| + void OnImageDataFetched(const std::string& within_category_id,
|
| const std::string& image_data) override;
|
|
|
| // Callbacks for the NTPSnippetsDatabase.
|
| @@ -240,19 +240,21 @@ class NTPSnippetsService : public ContentSuggestionsProvider,
|
| // observers. This is done after construction, once the database is loaded.
|
| void FinishInitialization();
|
|
|
| - void OnSnippetImageFetchedFromDatabase(const ImageFetchedCallback& callback,
|
| - const std::string& suggestion_id,
|
| - std::string data);
|
| + void OnSnippetImageFetchedFromDatabase(
|
| + const ImageFetchedCallback& callback,
|
| + const ContentSuggestion::ID& suggestion_id,
|
| + std::string data);
|
|
|
| - void OnSnippetImageDecodedFromDatabase(const ImageFetchedCallback& callback,
|
| - const std::string& suggestion_id,
|
| - const gfx::Image& image);
|
| + void OnSnippetImageDecodedFromDatabase(
|
| + const ImageFetchedCallback& callback,
|
| + const ContentSuggestion::ID& suggestion_id,
|
| + const gfx::Image& image);
|
|
|
| - void FetchSnippetImageFromNetwork(const std::string& suggestion_id,
|
| + void FetchSnippetImageFromNetwork(const ContentSuggestion::ID& suggestion_id,
|
| const ImageFetchedCallback& callback);
|
|
|
| void OnSnippetImageDecodedFromNetwork(const ImageFetchedCallback& callback,
|
| - const std::string& suggestion_id,
|
| + const std::string& within_category_id,
|
| const gfx::Image& image);
|
|
|
| // Triggers a state transition depending on the provided reason to be
|
| @@ -318,6 +320,10 @@ class NTPSnippetsService : public ContentSuggestionsProvider,
|
| // expire so we won't re-add them to |snippets| on the next fetch.
|
| NTPSnippet::PtrVector dismissed;
|
|
|
| + // Returns a non-dismissed snippet with the given |within_category_id|, or
|
| + // null if none exist.
|
| + const NTPSnippet* FindSnippet(const std::string& within_category_id) const;
|
| +
|
| CategoryContent();
|
| CategoryContent(CategoryContent&&);
|
| ~CategoryContent();
|
|
|