Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(253)

Side by Side Diff: chrome/browser/interests/android/interests_service.h

Issue 1396443002: Add the JNI code in order to let Java use the InterestsFetcher. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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_INTERESTS_ANDROID_INTERESTS_SERVICE_H_
6 #define CHROME_BROWSER_INTERESTS_ANDROID_INTERESTS_SERVICE_H_
7
8 #include <jni.h>
9
10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h"
12 #include "chrome/browser/interests/interests_fetcher.h"
13
14 class Profile;
Bernhard Bauer 2015/10/08 09:04:41 Empty line afterwards.
PEConn 2015/10/08 09:40:55 Done.
15 namespace base {
16 namespace android {
17 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.
18 }
19 }
20
21 // Provides a list of user interests to Java
22 class InterestsService {
23 public:
24 explicit InterestsService(Profile* profile);
25 virtual ~InterestsService();
26
27 void Destroy(JNIEnv* env, jobject obj);
28 static bool Register(JNIEnv* env);
29 void GetInterests(JNIEnv* env,
30 jobject obj,
31 jobject j_callback);
32
33 private:
34 void OnObtainedInterests(
35 scoped_ptr<InterestsFetcher> fetcher,
36 const base::android::ScopedJavaGlobalRef<jobject>& j_callback,
37 scoped_ptr<std::vector<InterestsFetcher::Interest>> interests);
38
39 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.
40 JNIEnv* env,
41 scoped_ptr<std::vector<InterestsFetcher::Interest>> interests);
42
43 Profile* profile_;
44
45 base::WeakPtrFactory<InterestsService> weak_ptr_factory_;
46
47 DISALLOW_COPY_AND_ASSIGN(InterestsService);
48 };
49
50 #endif // CHROME_BROWSER_INTERESTS_ANDROID_INTERESTS_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698