| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/interests/android/interests_service.h" | 5 #include "chrome/browser/interests/android/interests_service.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_array.h" | 8 #include "base/android/jni_array.h" |
| 9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
| 10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 return RegisterNativesImpl(env); | 78 return RegisterNativesImpl(env); |
| 79 } | 79 } |
| 80 | 80 |
| 81 void InterestsService::OnObtainedInterests( | 81 void InterestsService::OnObtainedInterests( |
| 82 scoped_ptr<InterestsFetcher> fetcher, | 82 scoped_ptr<InterestsFetcher> fetcher, |
| 83 const ScopedJavaGlobalRef<jobject>& j_callback, | 83 const ScopedJavaGlobalRef<jobject>& j_callback, |
| 84 scoped_ptr<std::vector<InterestsFetcher::Interest>> interests) { | 84 scoped_ptr<std::vector<InterestsFetcher::Interest>> interests) { |
| 85 JNIEnv* env = AttachCurrentThread(); | 85 JNIEnv* env = AttachCurrentThread(); |
| 86 ScopedJavaLocalRef<jobjectArray> j_interests = | 86 ScopedJavaLocalRef<jobjectArray> j_interests = |
| 87 ConvertInterestsToJava(env, interests.Pass()); | 87 ConvertInterestsToJava(env, interests.Pass()); |
| 88 Java_GetInterestsCallback_onInterestsAvailableCallback(env, | 88 Java_GetInterestsCallback_onInterestsAvailable(env, |
| 89 j_callback.obj(), | 89 j_callback.obj(), |
| 90 j_interests.obj()); | 90 j_interests.obj()); |
| 91 } | 91 } |
| 92 | 92 |
| 93 static jlong Init(JNIEnv* env, | 93 static jlong Init(JNIEnv* env, |
| 94 const JavaParamRef<jobject>& jobj, | 94 const JavaParamRef<jobject>& jobj, |
| 95 const JavaParamRef<jobject>& jprofile) { | 95 const JavaParamRef<jobject>& jprofile) { |
| 96 InterestsService* interests_service = | 96 InterestsService* interests_service = |
| 97 new InterestsService(ProfileAndroid::FromProfileAndroid(jprofile)); | 97 new InterestsService(ProfileAndroid::FromProfileAndroid(jprofile)); |
| 98 return reinterpret_cast<intptr_t>(interests_service); | 98 return reinterpret_cast<intptr_t>(interests_service); |
| 99 } | 99 } |
| OLD | NEW |