| 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 private: | 132 private: |
| 133 ~NTPSnippetsBridge() override; | 133 ~NTPSnippetsBridge() override; |
| 134 | 134 |
| 135 // ContentSuggestionsService::Observer overrides | 135 // ContentSuggestionsService::Observer overrides |
| 136 void OnNewSuggestions(ntp_snippets::Category category) override; | 136 void OnNewSuggestions(ntp_snippets::Category category) override; |
| 137 void OnCategoryStatusChanged( | 137 void OnCategoryStatusChanged( |
| 138 ntp_snippets::Category category, | 138 ntp_snippets::Category category, |
| 139 ntp_snippets::CategoryStatus new_status) override; | 139 ntp_snippets::CategoryStatus new_status) override; |
| 140 void OnSuggestionInvalidated( | 140 void OnSuggestionInvalidated( |
| 141 const ntp_snippets::ContentSuggestion::ID& suggestion_id) override; | 141 const ntp_snippets::ContentSuggestion::ID& suggestion_id) override; |
| 142 void OnFullRefreshRequired() override; |
| 142 void ContentSuggestionsServiceShutdown() override; | 143 void ContentSuggestionsServiceShutdown() override; |
| 143 | 144 |
| 144 void OnImageFetched(base::android::ScopedJavaGlobalRef<jobject> callback, | 145 void OnImageFetched(base::android::ScopedJavaGlobalRef<jobject> callback, |
| 145 const gfx::Image& image); | 146 const gfx::Image& image); |
| 146 void OnSuggestionsFetched( | 147 void OnSuggestionsFetched( |
| 147 ntp_snippets::Category category, | 148 ntp_snippets::Category category, |
| 148 ntp_snippets::Status status, | 149 ntp_snippets::Status status, |
| 149 std::vector<ntp_snippets::ContentSuggestion> suggestions); | 150 std::vector<ntp_snippets::ContentSuggestion> suggestions); |
| 150 | 151 |
| 151 ntp_snippets::Category CategoryFromIDValue(jint id); | 152 ntp_snippets::Category CategoryFromIDValue(jint id); |
| 152 | 153 |
| 153 ntp_snippets::ContentSuggestionsService* content_suggestions_service_; | 154 ntp_snippets::ContentSuggestionsService* content_suggestions_service_; |
| 154 history::HistoryService* history_service_; | 155 history::HistoryService* history_service_; |
| 155 base::CancelableTaskTracker tracker_; | 156 base::CancelableTaskTracker tracker_; |
| 156 | 157 |
| 157 ScopedObserver<ntp_snippets::ContentSuggestionsService, | 158 ScopedObserver<ntp_snippets::ContentSuggestionsService, |
| 158 ntp_snippets::ContentSuggestionsService::Observer> | 159 ntp_snippets::ContentSuggestionsService::Observer> |
| 159 content_suggestions_service_observer_; | 160 content_suggestions_service_observer_; |
| 160 | 161 |
| 161 // Used to notify the Java side when new snippets have been fetched. | 162 // Used to notify the Java side when new snippets have been fetched. |
| 162 base::android::ScopedJavaGlobalRef<jobject> observer_; | 163 base::android::ScopedJavaGlobalRef<jobject> observer_; |
| 163 | 164 |
| 164 base::WeakPtrFactory<NTPSnippetsBridge> weak_ptr_factory_; | 165 base::WeakPtrFactory<NTPSnippetsBridge> weak_ptr_factory_; |
| 165 | 166 |
| 166 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsBridge); | 167 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsBridge); |
| 167 }; | 168 }; |
| 168 | 169 |
| 169 #endif // CHROME_BROWSER_ANDROID_NTP_NTP_SNIPPETS_BRIDGE_H_ | 170 #endif // CHROME_BROWSER_ANDROID_NTP_NTP_SNIPPETS_BRIDGE_H_ |
| OLD | NEW |