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

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

Issue 1334233003: Add the JNI code in order to let Java use the InterestsFetcher. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ntp-interests-retriever
Patch Set: The access_token is obtained in the native code. 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_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 void Destroy(JNIEnv* env, jobject obj);
Bernhard Bauer 2015/09/29 14:04:05 I would group methods that are called from Java to
PEConn 2015/10/07 13:55:21 Done.
19
20 void GetInterests(JNIEnv* env,
21 jobject obj,
22 jobject j_callback);
23
24 static jobjectArray ConvertInterestsToJava(
25 const std::vector<InterestsFetcher::Interest>& interests);
26
27 static bool Register(JNIEnv* env);
28 virtual ~InterestsService();
Bernhard Bauer 2015/09/29 14:04:05 Destructors should come before other methods.
PEConn 2015/10/07 13:55:21 Done.
29
30 private:
31 void OnObtainedInterests(
32 InterestsFetcher* fetcher,
33 scoped_ptr<base::android::ScopedJavaGlobalRef<jobject>> j_callback,
34 const std::vector<InterestsFetcher::Interest>& interests);
35
36 Profile* profile_;
37
38 base::WeakPtrFactory<InterestsService> weak_ptr_factory_;
39
40 DISALLOW_COPY_AND_ASSIGN(InterestsService);
41 };
42
43 #endif // CHROME_BROWSER_ANDROID_INTERESTS_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698