| OLD | NEW |
| 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_SERVICE_H_ | 5 #ifndef COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_SERVICE_H_ |
| 6 #define COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_SERVICE_H_ | 6 #define COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_SERVICE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 public history::HistoryServiceObserver { | 43 public history::HistoryServiceObserver { |
| 44 public: | 44 public: |
| 45 class Observer { | 45 class Observer { |
| 46 public: | 46 public: |
| 47 // Fired every time the service receives a new set of data for the given | 47 // Fired every time the service receives a new set of data for the given |
| 48 // |category|, replacing any previously available data (though in most cases | 48 // |category|, replacing any previously available data (though in most cases |
| 49 // there will be an overlap and only a few changes within the data). The new | 49 // there will be an overlap and only a few changes within the data). The new |
| 50 // data is then available through |GetSuggestionsForCategory(category)|. | 50 // data is then available through |GetSuggestionsForCategory(category)|. |
| 51 virtual void OnNewSuggestions(Category category) = 0; | 51 virtual void OnNewSuggestions(Category category) = 0; |
| 52 | 52 |
| 53 // Fired when the status of a suggestions category changed. When the status | 53 // Fired when the status of a suggestions category changed. Note that for |
| 54 // changes to an unavailable status, the suggestions of the respective | 54 // some status changes, the UI must update immediately (e.g. to remove |
| 55 // category have been invalidated, which means that they must no longer be | 55 // invalidated suggestions). See comments on the individual CategoryStatus |
| 56 // displayed to the user. The UI must immediately clear any suggestions of | 56 // values for details. |
| 57 // that category. | |
| 58 virtual void OnCategoryStatusChanged(Category category, | 57 virtual void OnCategoryStatusChanged(Category category, |
| 59 CategoryStatus new_status) = 0; | 58 CategoryStatus new_status) = 0; |
| 60 | 59 |
| 61 // Fired when a suggestion has been invalidated. The UI must immediately | 60 // Fired when a suggestion has been invalidated. The UI must immediately |
| 62 // clear the suggestion even from open NTPs. Invalidation happens, for | 61 // clear the suggestion even from open NTPs. Invalidation happens, for |
| 63 // example, when the content that the suggestion refers to is gone. | 62 // example, when the content that the suggestion refers to is gone. |
| 64 // Note that this event may be fired even if the corresponding category is | 63 // Note that this event may be fired even if the corresponding category is |
| 65 // not currently AVAILABLE, because open UIs may still be showing the | 64 // not currently AVAILABLE, because open UIs may still be showing the |
| 66 // suggestion that is to be removed. This event may also be fired for | 65 // suggestion that is to be removed. This event may also be fired for |
| 67 // |suggestion_id|s that never existed and should be ignored in that case. | 66 // |suggestion_id|s that never existed and should be ignored in that case. |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 | 350 |
| 352 // Provides order for categories. | 351 // Provides order for categories. |
| 353 std::unique_ptr<CategoryRanker> category_ranker_; | 352 std::unique_ptr<CategoryRanker> category_ranker_; |
| 354 | 353 |
| 355 DISALLOW_COPY_AND_ASSIGN(ContentSuggestionsService); | 354 DISALLOW_COPY_AND_ASSIGN(ContentSuggestionsService); |
| 356 }; | 355 }; |
| 357 | 356 |
| 358 } // namespace ntp_snippets | 357 } // namespace ntp_snippets |
| 359 | 358 |
| 360 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_SERVICE_H_ | 359 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_SERVICE_H_ |
| OLD | NEW |