OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_ANDROID_INTERESTS_SERVICE_H_ |
| 6 #define CHROME_BROWSER_ANDROID_INTERESTS_SERVICE_H_ |
| 7 |
| 8 #include <jni.h> |
| 9 |
| 10 #include "base/android/scoped_java_ref.h" |
| 11 #include "chrome/browser/interests/interests_fetcher.h" |
| 12 #include "chrome/browser/profiles/profile.h" |
| 13 |
| 14 // Provides a list of user interests to Java |
| 15 class InterestsService { |
| 16 public: |
| 17 explicit InterestsService(Profile* profile); |
| 18 virtual ~InterestsService(); |
| 19 |
| 20 void Destroy(JNIEnv* env, jobject obj); |
| 21 static bool Register(JNIEnv* env); |
| 22 |
| 23 void GetInterests(JNIEnv* env, |
| 24 jobject obj, |
| 25 jobject j_callback); |
| 26 |
| 27 static jobjectArray ConvertInterestsToJava( |
| 28 const std::vector<InterestsFetcher::Interest>& interests); |
| 29 |
| 30 |
| 31 private: |
| 32 void OnObtainedInterests( |
| 33 InterestsFetcher* fetcher, |
| 34 JNIEnv *env, |
| 35 scoped_ptr<base::android::ScopedJavaGlobalRef<jobject>> j_callback, |
| 36 const std::vector<InterestsFetcher::Interest>& interests); |
| 37 |
| 38 Profile* profile_; |
| 39 |
| 40 base::WeakPtrFactory<InterestsService> weak_ptr_factory_; |
| 41 |
| 42 DISALLOW_COPY_AND_ASSIGN(InterestsService); |
| 43 }; |
| 44 |
| 45 #endif // CHROME_BROWSER_ANDROID_INTERESTS_SERVICE_H_ |
OLD | NEW |