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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 void DiscardSnippet(JNIEnv* env, | 43 void DiscardSnippet(JNIEnv* env, |
44 const base::android::JavaParamRef<jobject>& obj, | 44 const base::android::JavaParamRef<jobject>& obj, |
45 const base::android::JavaParamRef<jstring>& snippet_id); | 45 const base::android::JavaParamRef<jstring>& snippet_id); |
46 | 46 |
47 // Checks if the URL has been visited. | 47 // Checks if the URL has been visited. |
48 void SnippetVisited(JNIEnv* env, | 48 void SnippetVisited(JNIEnv* env, |
49 const base::android::JavaParamRef<jobject>& obj, | 49 const base::android::JavaParamRef<jobject>& obj, |
50 const base::android::JavaParamRef<jobject>& callback, | 50 const base::android::JavaParamRef<jobject>& callback, |
51 const base::android::JavaParamRef<jstring>& jurl); | 51 const base::android::JavaParamRef<jstring>& jurl); |
52 | 52 |
| 53 // Returns all categories in the order they should be displayed. |
| 54 base::android::ScopedJavaLocalRef<jintArray> GetCategories( |
| 55 JNIEnv* env, |
| 56 const base::android::JavaParamRef<jobject>& obj); |
| 57 |
| 58 // Returns all suggestions for the given category. |
| 59 base::android::ScopedJavaLocalRef<jobjectArray> GetSuggestionsForCategory( |
| 60 JNIEnv* env, |
| 61 const base::android::JavaParamRef<jobject>& obj, |
| 62 const int category); |
| 63 |
53 // Returns the status of the ARTICLES category. | 64 // Returns the status of the ARTICLES category. |
54 // See ContentSuggestionsCategoryStatus for more info. | 65 // See ContentSuggestionsCategoryStatus for more info. |
| 66 int GetArticlesCategoryStatus( |
| 67 JNIEnv* env, |
| 68 const base::android::JavaParamRef<jobject>& obj); |
| 69 |
| 70 // See ContentSuggestionsCategoryStatus for more info. |
55 int GetCategoryStatus(JNIEnv* env, | 71 int GetCategoryStatus(JNIEnv* env, |
56 const base::android::JavaParamRef<jobject>& obj); | 72 const base::android::JavaParamRef<jobject>& obj, |
| 73 jint category); |
57 | 74 |
58 static bool Register(JNIEnv* env); | 75 static bool Register(JNIEnv* env); |
59 | 76 |
60 private: | 77 private: |
61 ~NTPSnippetsBridge() override; | 78 ~NTPSnippetsBridge() override; |
62 | 79 |
63 // ContentSuggestionsService::Observer overrides | 80 // ContentSuggestionsService::Observer overrides |
64 void OnNewSuggestions() override; | 81 void OnNewSuggestions() override; |
65 void OnCategoryStatusChanged( | 82 void OnCategoryStatusChanged( |
66 ntp_snippets::ContentSuggestionsCategory category, | 83 ntp_snippets::ContentSuggestionsCategory category, |
(...skipping 13 matching lines...) Expand all Loading... |
80 ScopedObserver<ntp_snippets::ContentSuggestionsService, | 97 ScopedObserver<ntp_snippets::ContentSuggestionsService, |
81 ntp_snippets::ContentSuggestionsService::Observer> | 98 ntp_snippets::ContentSuggestionsService::Observer> |
82 content_suggestions_service_observer_; | 99 content_suggestions_service_observer_; |
83 | 100 |
84 base::WeakPtrFactory<NTPSnippetsBridge> weak_ptr_factory_; | 101 base::WeakPtrFactory<NTPSnippetsBridge> weak_ptr_factory_; |
85 | 102 |
86 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsBridge); | 103 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsBridge); |
87 }; | 104 }; |
88 | 105 |
89 #endif // CHROME_BROWSER_ANDROID_NTP_NTP_SNIPPETS_BRIDGE_H_ | 106 #endif // CHROME_BROWSER_ANDROID_NTP_NTP_SNIPPETS_BRIDGE_H_ |
OLD | NEW |