Index: chrome/browser/interests/android/interests_service.h |
diff --git a/chrome/browser/interests/android/interests_service.h b/chrome/browser/interests/android/interests_service.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..8a197786e57c527dde7bc15d48756681f22a5a0d |
--- /dev/null |
+++ b/chrome/browser/interests/android/interests_service.h |
@@ -0,0 +1,50 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_INTERESTS_ANDROID_INTERESTS_SERVICE_H_ |
+#define CHROME_BROWSER_INTERESTS_ANDROID_INTERESTS_SERVICE_H_ |
+ |
+#include <jni.h> |
+ |
+#include "base/memory/scoped_ptr.h" |
+#include "base/memory/weak_ptr.h" |
+#include "chrome/browser/interests/interests_fetcher.h" |
+ |
+class Profile; |
Bernhard Bauer
2015/10/08 09:04:41
Empty line afterwards.
PEConn
2015/10/08 09:40:55
Done.
|
+namespace base { |
+namespace android { |
+template<typename T> class ScopedJavaGlobalRef; |
Marc Treib
2015/10/08 08:26:51
Ugh. TBH, I'd prefer to just include the header he
PEConn
2015/10/08 09:40:55
Done.
|
+} |
+} |
+ |
+// Provides a list of user interests to Java |
+class InterestsService { |
+ public: |
+ explicit InterestsService(Profile* profile); |
+ virtual ~InterestsService(); |
+ |
+ void Destroy(JNIEnv* env, jobject obj); |
+ static bool Register(JNIEnv* env); |
+ void GetInterests(JNIEnv* env, |
+ jobject obj, |
+ jobject j_callback); |
+ |
+ private: |
+ void OnObtainedInterests( |
+ scoped_ptr<InterestsFetcher> fetcher, |
+ const base::android::ScopedJavaGlobalRef<jobject>& j_callback, |
+ scoped_ptr<std::vector<InterestsFetcher::Interest>> interests); |
+ |
+ static jobjectArray ConvertInterestsToJava( |
Bernhard Bauer
2015/10/08 09:04:41
Can you add a comment that explains why this is a
PEConn
2015/10/08 09:40:55
Moved to anonymous namespace.
|
+ JNIEnv* env, |
+ scoped_ptr<std::vector<InterestsFetcher::Interest>> interests); |
+ |
+ Profile* profile_; |
+ |
+ base::WeakPtrFactory<InterestsService> weak_ptr_factory_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(InterestsService); |
+}; |
+ |
+#endif // CHROME_BROWSER_INTERESTS_ANDROID_INTERESTS_SERVICE_H_ |