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

Side by Side Diff: chrome/browser/android/ntp/ntp_snippets_bridge.h

Issue 2377663002: [NTP Snippets] Introduce ContentSuggestion::ID (Closed)
Patch Set: rebase Created 4 years, 2 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 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 jint category); 47 jint category);
48 48
49 base::android::ScopedJavaLocalRef<jobject> GetSuggestionsForCategory( 49 base::android::ScopedJavaLocalRef<jobject> GetSuggestionsForCategory(
50 JNIEnv* env, 50 JNIEnv* env,
51 const base::android::JavaParamRef<jobject>& obj, 51 const base::android::JavaParamRef<jobject>& obj,
52 jint category); 52 jint category);
53 53
54 void FetchSuggestionImage( 54 void FetchSuggestionImage(
55 JNIEnv* env, 55 JNIEnv* env,
56 const base::android::JavaParamRef<jobject>& obj, 56 const base::android::JavaParamRef<jobject>& obj,
57 const base::android::JavaParamRef<jstring>& suggestion_id, 57 jint category,
58 const base::android::JavaParamRef<jstring>& id_within_category,
58 const base::android::JavaParamRef<jobject>& j_callback); 59 const base::android::JavaParamRef<jobject>& j_callback);
59 60
60 void DismissSuggestion( 61 void DismissSuggestion(
61 JNIEnv* env, 62 JNIEnv* env,
62 const base::android::JavaParamRef<jobject>& obj, 63 const base::android::JavaParamRef<jobject>& obj,
63 const base::android::JavaParamRef<jstring>& suggestion_id); 64 jint category,
65 const base::android::JavaParamRef<jstring>& id_within_category);
64 66
65 void DismissCategory(JNIEnv* env, 67 void DismissCategory(JNIEnv* env,
66 const base::android::JavaParamRef<jobject>& obj, 68 const base::android::JavaParamRef<jobject>& obj,
67 jint category); 69 jint category);
68 70
69 // Checks if the URL has been visited. The callback will not be called 71 // Checks if the URL has been visited. The callback will not be called
70 // synchronously. 72 // synchronously.
71 void GetURLVisited(JNIEnv* env, 73 void GetURLVisited(JNIEnv* env,
72 const base::android::JavaParamRef<jobject>& obj, 74 const base::android::JavaParamRef<jobject>& obj,
73 const base::android::JavaParamRef<jobject>& callback, 75 const base::android::JavaParamRef<jobject>& callback,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 static bool Register(JNIEnv* env); 119 static bool Register(JNIEnv* env);
118 120
119 private: 121 private:
120 ~NTPSnippetsBridge() override; 122 ~NTPSnippetsBridge() override;
121 123
122 // ContentSuggestionsService::Observer overrides 124 // ContentSuggestionsService::Observer overrides
123 void OnNewSuggestions(ntp_snippets::Category category) override; 125 void OnNewSuggestions(ntp_snippets::Category category) override;
124 void OnCategoryStatusChanged( 126 void OnCategoryStatusChanged(
125 ntp_snippets::Category category, 127 ntp_snippets::Category category,
126 ntp_snippets::CategoryStatus new_status) override; 128 ntp_snippets::CategoryStatus new_status) override;
127 void OnSuggestionInvalidated(ntp_snippets::Category category, 129 void OnSuggestionInvalidated(
128 const std::string& suggestion_id) override; 130 const ntp_snippets::ContentSuggestion::ID& suggestion_id) override;
129 void ContentSuggestionsServiceShutdown() override; 131 void ContentSuggestionsServiceShutdown() override;
130 132
131 void OnImageFetched(base::android::ScopedJavaGlobalRef<jobject> callback, 133 void OnImageFetched(base::android::ScopedJavaGlobalRef<jobject> callback,
132 const gfx::Image& image); 134 const gfx::Image& image);
133 135
134 ntp_snippets::Category CategoryFromIDValue(jint id); 136 ntp_snippets::Category CategoryFromIDValue(jint id);
135 137
136 ntp_snippets::ContentSuggestionsService* content_suggestions_service_; 138 ntp_snippets::ContentSuggestionsService* content_suggestions_service_;
137 history::HistoryService* history_service_; 139 history::HistoryService* history_service_;
138 base::CancelableTaskTracker tracker_; 140 base::CancelableTaskTracker tracker_;
139 141
140 ScopedObserver<ntp_snippets::ContentSuggestionsService, 142 ScopedObserver<ntp_snippets::ContentSuggestionsService,
141 ntp_snippets::ContentSuggestionsService::Observer> 143 ntp_snippets::ContentSuggestionsService::Observer>
142 content_suggestions_service_observer_; 144 content_suggestions_service_observer_;
143 145
144 // Used to notify the Java side when new snippets have been fetched. 146 // Used to notify the Java side when new snippets have been fetched.
145 base::android::ScopedJavaGlobalRef<jobject> observer_; 147 base::android::ScopedJavaGlobalRef<jobject> observer_;
146 148
147 base::WeakPtrFactory<NTPSnippetsBridge> weak_ptr_factory_; 149 base::WeakPtrFactory<NTPSnippetsBridge> weak_ptr_factory_;
148 150
149 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsBridge); 151 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsBridge);
150 }; 152 };
151 153
152 #endif // CHROME_BROWSER_ANDROID_NTP_NTP_SNIPPETS_BRIDGE_H_ 154 #endif // CHROME_BROWSER_ANDROID_NTP_NTP_SNIPPETS_BRIDGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698