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

Side by Side Diff: components/ntp_snippets/content_suggestions_provider.h

Issue 2131943002: Change NTPSnippetsService to implement ContentSuggestionsProvider (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@neuerservice2
Patch Set: Marcs comments Created 4 years, 5 months 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_PROVIDER_H_ 5 #ifndef COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_PROVIDER_H_
6 #define COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_PROVIDER_H_ 6 #define COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_PROVIDER_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 ContentSuggestionsCategory category) = 0; 71 ContentSuggestionsCategory category) = 0;
72 72
73 // Discards the suggestion with the given ID. A provider needs to ensure that 73 // Discards the suggestion with the given ID. A provider needs to ensure that
74 // a once-discarded suggestion is never delivered again (through the 74 // a once-discarded suggestion is never delivered again (through the
75 // Observer). The provider must not call Observer::OnSuggestionsChanged if the 75 // Observer). The provider must not call Observer::OnSuggestionsChanged if the
76 // removal of the discarded suggestion is the only change. 76 // removal of the discarded suggestion is the only change.
77 virtual void DiscardSuggestion(const std::string& suggestion_id) = 0; 77 virtual void DiscardSuggestion(const std::string& suggestion_id) = 0;
78 78
79 // Fetches the image for the suggestion with the given ID and returns it 79 // Fetches the image for the suggestion with the given ID and returns it
80 // through the callback. This fetch may occur locally or from the internet. 80 // through the callback. This fetch may occur locally or from the internet.
81 // If that suggestion doesn't exist, doesn't have an image or if the fetch
82 // fails, the callback gets a null image.
81 virtual void FetchSuggestionImage(const std::string& suggestion_id, 83 virtual void FetchSuggestionImage(const std::string& suggestion_id,
82 const ImageFetchedCallback& callback) = 0; 84 const ImageFetchedCallback& callback) = 0;
83 85
84 // Used only for debugging purposes. Clears all caches so that the next 86 // Used only for debugging purposes. Clears all caches so that the next
85 // fetch starts from scratch. 87 // fetch starts from scratch.
86 virtual void ClearCachedSuggestionsForDebugging() = 0; 88 virtual void ClearCachedSuggestionsForDebugging() = 0;
87 89
88 // Used only for debugging purposes. Clears the cache of discarded 90 // Used only for debugging purposes. Clears the cache of discarded
89 // suggestions, if present, so that no suggestions are suppressed. This does 91 // suggestions, if present, so that no suggestions are suppressed. This does
90 // not necessarily make previously discarded suggestions reappear, as they may 92 // not necessarily make previously discarded suggestions reappear, as they may
(...skipping 17 matching lines...) Expand all
108 static std::string MakeUniqueID(ContentSuggestionsCategory category, 110 static std::string MakeUniqueID(ContentSuggestionsCategory category,
109 const std::string& within_category_id); 111 const std::string& within_category_id);
110 112
111 private: 113 private:
112 const std::vector<ContentSuggestionsCategory> provided_categories_; 114 const std::vector<ContentSuggestionsCategory> provided_categories_;
113 }; 115 };
114 116
115 } // namespace ntp_snippets 117 } // namespace ntp_snippets
116 118
117 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_PROVIDER_H_ 119 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698