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

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

Issue 2244793002: Remove deleted offline page suggestions from opened NTPs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adjust MockContentSuggestionsProvider Created 4 years, 4 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 // If |new_status| is any other value, it must match the value that is 57 // If |new_status| is any other value, it must match the value that is
58 // currently returned from the provider's |GetCategoryStatus(category)|. In 58 // currently returned from the provider's |GetCategoryStatus(category)|. In
59 // case the given |category| is not known yet, the calling |provider| will 59 // case the given |category| is not known yet, the calling |provider| will
60 // be registered as its provider. Whenever the status changes to an 60 // be registered as its provider. Whenever the status changes to an
61 // unavailable status, all suggestions in that category must immediately be 61 // unavailable status, all suggestions in that category must immediately be
62 // removed from all caches and from the UI, but the provider remains 62 // removed from all caches and from the UI, but the provider remains
63 // registered. 63 // registered.
64 virtual void OnCategoryStatusChanged(ContentSuggestionsProvider* provider, 64 virtual void OnCategoryStatusChanged(ContentSuggestionsProvider* provider,
65 Category category, 65 Category category,
66 CategoryStatus new_status) = 0; 66 CategoryStatus new_status) = 0;
67
68 // Called when a suggestion has been invalidated. It will not be provided
69 // through |OnNewSuggestions| anymore, is not supported by
70 // |FetchSuggestionImage| or |DismissSuggestion| anymore, and should
71 // immediately be cleared from the UI and caches. This happens, for example,
72 // when the content that the suggestion refers to is gone.
73 // Note that this event may be fired even if the corresponding |category| is
74 // not currently AVAILABLE, because open UIs may still be showing the
75 // suggestion that is to be removed. This event may also be fired for
76 // |suggestion_id|s that never existed and should be ignored in that case.
77 virtual void OnSuggestionInvalidated(ContentSuggestionsProvider* provider,
78 Category category,
79 const std::string& suggestion_id) = 0;
67 }; 80 };
68 81
69 virtual ~ContentSuggestionsProvider(); 82 virtual ~ContentSuggestionsProvider();
70 83
71 // Returns the categories provided by this provider. 84 // Returns the categories provided by this provider.
72 // When the set of provided categories changes, the Observer is notified 85 // When the set of provided categories changes, the Observer is notified
73 // through |OnNewSuggestions| or |OnCategoryStatusChanged| for added 86 // through |OnNewSuggestions| or |OnCategoryStatusChanged| for added
74 // categories, and through |OnCategoryStatusChanged| with parameter 87 // categories, and through |OnCategoryStatusChanged| with parameter
75 // NOT_PROVIDED for removed categories. 88 // NOT_PROVIDED for removed categories.
76 virtual std::vector<Category> GetProvidedCategories() = 0; 89 virtual std::vector<Category> GetProvidedCategories() = 0;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 CategoryFactory* category_factory() const { return category_factory_; } 147 CategoryFactory* category_factory() const { return category_factory_; }
135 148
136 private: 149 private:
137 Observer* observer_; 150 Observer* observer_;
138 CategoryFactory* category_factory_; 151 CategoryFactory* category_factory_;
139 }; 152 };
140 153
141 } // namespace ntp_snippets 154 } // namespace ntp_snippets
142 155
143 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_PROVIDER_H_ 156 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_PROVIDER_H_
OLDNEW
« no previous file with comments | « components/ntp_snippets/category_factory.h ('k') | components/ntp_snippets/content_suggestions_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698