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 CHROME_BROWSER_ANDROID_NTP_NTP_SNIPPETS_BRIDGE_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_NTP_NTP_SNIPPETS_BRIDGE_H_ |
6 #define CHROME_BROWSER_ANDROID_NTP_NTP_SNIPPETS_BRIDGE_H_ | 6 #define CHROME_BROWSER_ANDROID_NTP_NTP_SNIPPETS_BRIDGE_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 | 9 |
10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 static bool Register(JNIEnv* env); | 72 static bool Register(JNIEnv* env); |
73 | 73 |
74 private: | 74 private: |
75 ~NTPSnippetsBridge() override; | 75 ~NTPSnippetsBridge() override; |
76 | 76 |
77 // ContentSuggestionsService::Observer overrides | 77 // ContentSuggestionsService::Observer overrides |
78 void OnNewSuggestions(ntp_snippets::Category category) override; | 78 void OnNewSuggestions(ntp_snippets::Category category) override; |
79 void OnCategoryStatusChanged( | 79 void OnCategoryStatusChanged( |
80 ntp_snippets::Category category, | 80 ntp_snippets::Category category, |
81 ntp_snippets::CategoryStatus new_status) override; | 81 ntp_snippets::CategoryStatus new_status) override; |
| 82 void OnSuggestionInvalidated(ntp_snippets::Category category, |
| 83 const std::string& suggestion_id) override; |
82 void ContentSuggestionsServiceShutdown() override; | 84 void ContentSuggestionsServiceShutdown() override; |
83 | 85 |
84 void OnImageFetched(base::android::ScopedJavaGlobalRef<jobject> callback, | 86 void OnImageFetched(base::android::ScopedJavaGlobalRef<jobject> callback, |
85 const std::string& snippet_id, | 87 const std::string& snippet_id, |
86 const gfx::Image& image); | 88 const gfx::Image& image); |
87 | 89 |
88 ntp_snippets::ContentSuggestionsService* content_suggestions_service_; | 90 ntp_snippets::ContentSuggestionsService* content_suggestions_service_; |
89 history::HistoryService* history_service_; | 91 history::HistoryService* history_service_; |
90 base::CancelableTaskTracker tracker_; | 92 base::CancelableTaskTracker tracker_; |
91 | 93 |
92 ScopedObserver<ntp_snippets::ContentSuggestionsService, | 94 ScopedObserver<ntp_snippets::ContentSuggestionsService, |
93 ntp_snippets::ContentSuggestionsService::Observer> | 95 ntp_snippets::ContentSuggestionsService::Observer> |
94 content_suggestions_service_observer_; | 96 content_suggestions_service_observer_; |
95 | 97 |
96 // Used to notify the Java side when new snippets have been fetched. | 98 // Used to notify the Java side when new snippets have been fetched. |
97 base::android::ScopedJavaGlobalRef<jobject> observer_; | 99 base::android::ScopedJavaGlobalRef<jobject> observer_; |
98 | 100 |
99 base::WeakPtrFactory<NTPSnippetsBridge> weak_ptr_factory_; | 101 base::WeakPtrFactory<NTPSnippetsBridge> weak_ptr_factory_; |
100 | 102 |
101 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsBridge); | 103 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsBridge); |
102 }; | 104 }; |
103 | 105 |
104 #endif // CHROME_BROWSER_ANDROID_NTP_NTP_SNIPPETS_BRIDGE_H_ | 106 #endif // CHROME_BROWSER_ANDROID_NTP_NTP_SNIPPETS_BRIDGE_H_ |
OLD | NEW |