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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 return RegisterNativesImpl(env); | 79 return RegisterNativesImpl(env); |
80 } | 80 } |
81 | 81 |
82 void InterestsService::OnObtainedInterests( | 82 void InterestsService::OnObtainedInterests( |
83 scoped_ptr<InterestsFetcher> fetcher, | 83 scoped_ptr<InterestsFetcher> fetcher, |
84 const ScopedJavaGlobalRef<jobject>& j_callback, | 84 const ScopedJavaGlobalRef<jobject>& j_callback, |
85 scoped_ptr<std::vector<InterestsFetcher::Interest>> interests) { | 85 scoped_ptr<std::vector<InterestsFetcher::Interest>> interests) { |
86 JNIEnv* env = AttachCurrentThread(); | 86 JNIEnv* env = AttachCurrentThread(); |
87 ScopedJavaLocalRef<jobjectArray> j_interests = | 87 ScopedJavaLocalRef<jobjectArray> j_interests = |
88 ConvertInterestsToJava(env, interests.Pass()); | 88 ConvertInterestsToJava(env, interests.Pass()); |
89 Java_GetInterestsCallback_onInterestsAvailableCallback(env, | 89 Java_GetInterestsCallback_onInterestsAvailable(env, |
90 j_callback.obj(), | 90 j_callback.obj(), |
91 j_interests.obj()); | 91 j_interests.obj()); |
92 } | 92 } |
93 | 93 |
94 static jlong Init(JNIEnv* env, | 94 static jlong Init(JNIEnv* env, |
95 const JavaParamRef<jobject>& jobj, | 95 const JavaParamRef<jobject>& jobj, |
96 const JavaParamRef<jobject>& jprofile) { | 96 const JavaParamRef<jobject>& jprofile) { |
97 InterestsService* interests_service = | 97 InterestsService* interests_service = |
98 new InterestsService(ProfileAndroid::FromProfileAndroid(jprofile)); | 98 new InterestsService(ProfileAndroid::FromProfileAndroid(jprofile)); |
99 return reinterpret_cast<intptr_t>(interests_service); | 99 return reinterpret_cast<intptr_t>(interests_service); |
100 } | 100 } |
OLD | NEW |