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 #include "chrome/browser/android/ntp/ntp_snippets_bridge.h" | 5 #include "chrome/browser/android/ntp/ntp_snippets_bridge.h" |
6 | 6 |
7 #include <jni.h> | 7 #include <jni.h> |
8 | 8 |
9 #include "base/android/callback_android.h" | 9 #include "base/android/callback_android.h" |
10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 global_position, CategoryFromIDValue(category), category_position), | 244 global_position, CategoryFromIDValue(category), category_position), |
245 &tracker_); | 245 &tracker_); |
246 } | 246 } |
247 | 247 |
248 void NTPSnippetsBridge::DismissCategory(JNIEnv* env, | 248 void NTPSnippetsBridge::DismissCategory(JNIEnv* env, |
249 const JavaParamRef<jobject>& obj, | 249 const JavaParamRef<jobject>& obj, |
250 jint category) { | 250 jint category) { |
251 content_suggestions_service_->DismissCategory(CategoryFromIDValue(category)); | 251 content_suggestions_service_->DismissCategory(CategoryFromIDValue(category)); |
252 } | 252 } |
253 | 253 |
| 254 void NTPSnippetsBridge::RestoreDismissedCategories( |
| 255 JNIEnv* env, |
| 256 const JavaParamRef<jobject>& obj) { |
| 257 content_suggestions_service_->RestoreDismissedCategories(); |
| 258 } |
| 259 |
254 void NTPSnippetsBridge::OnPageShown( | 260 void NTPSnippetsBridge::OnPageShown( |
255 JNIEnv* env, | 261 JNIEnv* env, |
256 const JavaParamRef<jobject>& obj, | 262 const JavaParamRef<jobject>& obj, |
257 const JavaParamRef<jintArray>& jcategories, | 263 const JavaParamRef<jintArray>& jcategories, |
258 const JavaParamRef<jintArray>& jsuggestions_per_category) { | 264 const JavaParamRef<jintArray>& jsuggestions_per_category) { |
259 std::vector<int> categories_int; | 265 std::vector<int> categories_int; |
260 JavaIntArrayToIntVector(env, jcategories, &categories_int); | 266 JavaIntArrayToIntVector(env, jcategories, &categories_int); |
261 std::vector<int> suggestions_per_category_int; | 267 std::vector<int> suggestions_per_category_int; |
262 JavaIntArrayToIntVector(env, jsuggestions_per_category, | 268 JavaIntArrayToIntVector(env, jsuggestions_per_category, |
263 &suggestions_per_category_int); | 269 &suggestions_per_category_int); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 } | 389 } |
384 | 390 |
385 Category NTPSnippetsBridge::CategoryFromIDValue(jint id) { | 391 Category NTPSnippetsBridge::CategoryFromIDValue(jint id) { |
386 return content_suggestions_service_->category_factory()->FromIDValue(id); | 392 return content_suggestions_service_->category_factory()->FromIDValue(id); |
387 } | 393 } |
388 | 394 |
389 // static | 395 // static |
390 bool NTPSnippetsBridge::Register(JNIEnv* env) { | 396 bool NTPSnippetsBridge::Register(JNIEnv* env) { |
391 return RegisterNativesImpl(env); | 397 return RegisterNativesImpl(env); |
392 } | 398 } |
OLD | NEW |