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

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: Michael's and Marc's comments 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.
76 virtual void OnSuggestionInvalidated(ContentSuggestionsProvider* provider,
77 Category category,
78 const std::string& suggestion_id) = 0;
67 }; 79 };
68 80
69 virtual ~ContentSuggestionsProvider(); 81 virtual ~ContentSuggestionsProvider();
70 82
71 // Returns the categories provided by this provider. 83 // Returns the categories provided by this provider.
72 // When the set of provided categories changes, the Observer is notified 84 // When the set of provided categories changes, the Observer is notified
73 // through |OnNewSuggestions| or |OnCategoryStatusChanged| for added 85 // through |OnNewSuggestions| or |OnCategoryStatusChanged| for added
74 // categories, and through |OnCategoryStatusChanged| with parameter 86 // categories, and through |OnCategoryStatusChanged| with parameter
75 // NOT_PROVIDED for removed categories. 87 // NOT_PROVIDED for removed categories.
76 virtual std::vector<Category> GetProvidedCategories() = 0; 88 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_; } 146 CategoryFactory* category_factory() const { return category_factory_; }
135 147
136 private: 148 private:
137 Observer* observer_; 149 Observer* observer_;
138 CategoryFactory* category_factory_; 150 CategoryFactory* category_factory_;
139 }; 151 };
140 152
141 } // namespace ntp_snippets 153 } // namespace ntp_snippets
142 154
143 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_PROVIDER_H_ 155 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698