| 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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 } | 208 } |
| 209 | 209 |
| 210 void NTPSnippetsBridge::DismissSuggestion( | 210 void NTPSnippetsBridge::DismissSuggestion( |
| 211 JNIEnv* env, | 211 JNIEnv* env, |
| 212 const JavaParamRef<jobject>& obj, | 212 const JavaParamRef<jobject>& obj, |
| 213 const JavaParamRef<jstring>& suggestion_id) { | 213 const JavaParamRef<jstring>& suggestion_id) { |
| 214 content_suggestions_service_->DismissSuggestion( | 214 content_suggestions_service_->DismissSuggestion( |
| 215 ConvertJavaStringToUTF8(env, suggestion_id)); | 215 ConvertJavaStringToUTF8(env, suggestion_id)); |
| 216 } | 216 } |
| 217 | 217 |
| 218 void NTPSnippetsBridge::DismissCategory(JNIEnv* env, |
| 219 const JavaParamRef<jobject>& obj, |
| 220 jint category) { |
| 221 content_suggestions_service_->DismissCategory(CategoryFromIDValue(category)); |
| 222 } |
| 223 |
| 218 void NTPSnippetsBridge::GetURLVisited(JNIEnv* env, | 224 void NTPSnippetsBridge::GetURLVisited(JNIEnv* env, |
| 219 const JavaParamRef<jobject>& obj, | 225 const JavaParamRef<jobject>& obj, |
| 220 const JavaParamRef<jobject>& jcallback, | 226 const JavaParamRef<jobject>& jcallback, |
| 221 const JavaParamRef<jstring>& jurl) { | 227 const JavaParamRef<jstring>& jurl) { |
| 222 base::android::ScopedJavaGlobalRef<jobject> callback(jcallback); | 228 base::android::ScopedJavaGlobalRef<jobject> callback(jcallback); |
| 223 | 229 |
| 224 history_service_->QueryURL( | 230 history_service_->QueryURL( |
| 225 GURL(ConvertJavaStringToUTF8(env, jurl)), false, | 231 GURL(ConvertJavaStringToUTF8(env, jurl)), false, |
| 226 base::Bind(&URLVisitedHistoryRequestCallback, callback), &tracker_); | 232 base::Bind(&URLVisitedHistoryRequestCallback, callback), &tracker_); |
| 227 } | 233 } |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 } | 360 } |
| 355 | 361 |
| 356 Category NTPSnippetsBridge::CategoryFromIDValue(jint id) { | 362 Category NTPSnippetsBridge::CategoryFromIDValue(jint id) { |
| 357 return content_suggestions_service_->category_factory()->FromIDValue(id); | 363 return content_suggestions_service_->category_factory()->FromIDValue(id); |
| 358 } | 364 } |
| 359 | 365 |
| 360 // static | 366 // static |
| 361 bool NTPSnippetsBridge::Register(JNIEnv* env) { | 367 bool NTPSnippetsBridge::Register(JNIEnv* env) { |
| 362 return RegisterNativesImpl(env); | 368 return RegisterNativesImpl(env); |
| 363 } | 369 } |
| OLD | NEW |