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