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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 global_position, CategoryFromIDValue(category), category_position), | 253 global_position, CategoryFromIDValue(category), category_position), |
254 &tracker_); | 254 &tracker_); |
255 } | 255 } |
256 | 256 |
257 void NTPSnippetsBridge::DismissCategory(JNIEnv* env, | 257 void NTPSnippetsBridge::DismissCategory(JNIEnv* env, |
258 const JavaParamRef<jobject>& obj, | 258 const JavaParamRef<jobject>& obj, |
259 jint category) { | 259 jint category) { |
260 content_suggestions_service_->DismissCategory(CategoryFromIDValue(category)); | 260 content_suggestions_service_->DismissCategory(CategoryFromIDValue(category)); |
261 } | 261 } |
262 | 262 |
| 263 void NTPSnippetsBridge::RestoreDismissedCategories( |
| 264 JNIEnv* env, |
| 265 const JavaParamRef<jobject>& obj) { |
| 266 content_suggestions_service_->RestoreDismissedCategories(); |
| 267 } |
| 268 |
263 void NTPSnippetsBridge::GetURLVisited(JNIEnv* env, | 269 void NTPSnippetsBridge::GetURLVisited(JNIEnv* env, |
264 const JavaParamRef<jobject>& obj, | 270 const JavaParamRef<jobject>& obj, |
265 const JavaParamRef<jobject>& jcallback, | 271 const JavaParamRef<jobject>& jcallback, |
266 const JavaParamRef<jstring>& jurl) { | 272 const JavaParamRef<jstring>& jurl) { |
267 base::android::ScopedJavaGlobalRef<jobject> callback(jcallback); | 273 base::android::ScopedJavaGlobalRef<jobject> callback(jcallback); |
268 | 274 |
269 history_service_->QueryURL( | 275 history_service_->QueryURL( |
270 GURL(ConvertJavaStringToUTF8(env, jurl)), /*want_visits=*/false, | 276 GURL(ConvertJavaStringToUTF8(env, jurl)), /*want_visits=*/false, |
271 base::Bind(&URLVisitedHistoryRequestCallback, callback), &tracker_); | 277 base::Bind(&URLVisitedHistoryRequestCallback, callback), &tracker_); |
272 } | 278 } |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 } | 409 } |
404 | 410 |
405 Category NTPSnippetsBridge::CategoryFromIDValue(jint id) { | 411 Category NTPSnippetsBridge::CategoryFromIDValue(jint id) { |
406 return content_suggestions_service_->category_factory()->FromIDValue(id); | 412 return content_suggestions_service_->category_factory()->FromIDValue(id); |
407 } | 413 } |
408 | 414 |
409 // static | 415 // static |
410 bool NTPSnippetsBridge::Register(JNIEnv* env) { | 416 bool NTPSnippetsBridge::Register(JNIEnv* env) { |
411 return RegisterNativesImpl(env); | 417 return RegisterNativesImpl(env); |
412 } | 418 } |
OLD | NEW |