 Chromium Code Reviews
 Chromium Code Reviews 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
    
  
    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| Index: chrome/browser/android/interests_service.h | 
| diff --git a/chrome/browser/android/interests_service.h b/chrome/browser/android/interests_service.h | 
| new file mode 100644 | 
| index 0000000000000000000000000000000000000000..68c2d6934fcd84e49e8f3ed07341947867ca5e03 | 
| --- /dev/null | 
| +++ b/chrome/browser/android/interests_service.h | 
| @@ -0,0 +1,46 @@ | 
| +// 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_ANDROID_INTERESTS_SERVICE_H_ | 
| +#define CHROME_BROWSER_ANDROID_INTERESTS_SERVICE_H_ | 
| + | 
| +#include <jni.h> | 
| + | 
| +#include "base/android/scoped_java_ref.h" | 
| +#include "chrome/browser/interests/interests_fetcher.h" | 
| +#include "chrome/browser/profiles/profile.h" | 
| + | 
| +// Provides a list of user interests to Java | 
| +class InterestsService { | 
| + public: | 
| + explicit InterestsService(Profile *profile); | 
| 
Marc Treib
2015/09/11 14:54:25
* goes with the type, also in a few other places
 
tache
2015/09/11 15:45:09
Done.
 | 
| + void Destroy(JNIEnv* env, jobject obj); | 
| + void OnLoadingComplete(JNIEnv *env, jobject obj); | 
| 
Marc Treib
2015/09/11 14:54:25
This method doesn't actually exist, please remove
 
tache
2015/09/11 15:45:09
Done.
 | 
| + | 
| + void GetInterests(JNIEnv* env, | 
| + jobject obj, | 
| + jstring token, | 
| + jobject j_callback); | 
| + | 
| + static jobjectArray ConvertInterestsToJava( | 
| + const std::vector<InterestsFetcher::Interest>& interests); | 
| + | 
| + static bool Register(JNIEnv* env); | 
| + virtual ~InterestsService(); | 
| + | 
| + private: | 
| + DISALLOW_COPY_AND_ASSIGN(InterestsService); | 
| 
Marc Treib
2015/09/11 14:54:25
By convention, this goes right at the end of the c
 
tache
2015/09/11 15:45:09
Done.
 | 
| + | 
| + void OnObtainedInterests( | 
| + InterestsFetcher* fetcher, | 
| + scoped_ptr<base::android::ScopedJavaGlobalRef<jobject>> j_callback, | 
| + const std::vector<InterestsFetcher::Interest>& interests); | 
| + | 
| + | 
| + Profile *profile_; | 
| + | 
| + base::WeakPtrFactory<InterestsService> weak_ptr_factory_; | 
| +}; | 
| + | 
| +#endif // CHROME_BROWSER_ANDROID_INTERESTS_SERVICE_H_ |