OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_READING_LIST_READING_LIST_SUGGESTIONS_PROVIDER_H
_ | 5 #ifndef COMPONENTS_NTP_SNIPPETS_READING_LIST_READING_LIST_SUGGESTIONS_PROVIDER_H
_ |
6 #define COMPONENTS_NTP_SNIPPETS_READING_LIST_READING_LIST_SUGGESTIONS_PROVIDER_H
_ | 6 #define COMPONENTS_NTP_SNIPPETS_READING_LIST_READING_LIST_SUGGESTIONS_PROVIDER_H
_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
| 11 #include "base/scoped_observer.h" |
11 #include "components/ntp_snippets/callbacks.h" | 12 #include "components/ntp_snippets/callbacks.h" |
12 #include "components/ntp_snippets/category.h" | 13 #include "components/ntp_snippets/category.h" |
13 #include "components/ntp_snippets/category_info.h" | 14 #include "components/ntp_snippets/category_info.h" |
14 #include "components/ntp_snippets/category_status.h" | 15 #include "components/ntp_snippets/category_status.h" |
15 #include "components/ntp_snippets/content_suggestion.h" | 16 #include "components/ntp_snippets/content_suggestion.h" |
16 #include "components/ntp_snippets/content_suggestions_provider.h" | 17 #include "components/ntp_snippets/content_suggestions_provider.h" |
17 #include "components/reading_list/core/reading_list_model_observer.h" | 18 #include "components/reading_list/core/reading_list_model_observer.h" |
18 | 19 |
19 class ReadingListModel; | 20 class ReadingListModel; |
20 | 21 |
(...skipping 21 matching lines...) Expand all Loading... |
42 base::Time end, | 43 base::Time end, |
43 const base::Callback<bool(const GURL& url)>& filter) override; | 44 const base::Callback<bool(const GURL& url)>& filter) override; |
44 void ClearCachedSuggestions(Category category) override; | 45 void ClearCachedSuggestions(Category category) override; |
45 void GetDismissedSuggestionsForDebugging( | 46 void GetDismissedSuggestionsForDebugging( |
46 Category category, | 47 Category category, |
47 const DismissedSuggestionsCallback& callback) override; | 48 const DismissedSuggestionsCallback& callback) override; |
48 void ClearDismissedSuggestionsForDebugging(Category category) override; | 49 void ClearDismissedSuggestionsForDebugging(Category category) override; |
49 | 50 |
50 // ReadingListModelObserver implementation. | 51 // ReadingListModelObserver implementation. |
51 void ReadingListModelLoaded(const ReadingListModel* model) override; | 52 void ReadingListModelLoaded(const ReadingListModel* model) override; |
| 53 void ReadingListModelBeingDeleted(const ReadingListModel* model) override; |
52 | 54 |
53 private: | 55 private: |
| 56 // The actual method to fetch Reading List entries. Must be called after the |
| 57 // model is loaded. |
54 void FetchReadingListInternal(); | 58 void FetchReadingListInternal(); |
55 | 59 |
| 60 // Updates the |category_status_| and notifies the |observer_|, if necessary. |
| 61 void NotifyStatusChanged(CategoryStatus new_status); |
56 CategoryStatus category_status_; | 62 CategoryStatus category_status_; |
57 const Category provided_category_; | 63 const Category provided_category_; |
58 | 64 |
59 ReadingListModel* reading_list_model_; | 65 ReadingListModel* reading_list_model_; |
| 66 ScopedObserver<ReadingListModel, ReadingListModelObserver> scoped_observer_; |
60 | 67 |
61 DISALLOW_COPY_AND_ASSIGN(ReadingListSuggestionsProvider); | 68 DISALLOW_COPY_AND_ASSIGN(ReadingListSuggestionsProvider); |
62 }; | 69 }; |
63 | 70 |
64 } // namespace ntp_snippets | 71 } // namespace ntp_snippets |
65 | 72 |
66 #endif // COMPONENTS_NTP_SNIPPETS_READING_LIST_READING_LIST_SUGGESTIONS_PROVIDE
R_H_ | 73 #endif // COMPONENTS_NTP_SNIPPETS_READING_LIST_READING_LIST_SUGGESTIONS_PROVIDE
R_H_ |
OLD | NEW |