OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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 #include "chrome/browser/android/ntp_snippets_controller.h" |
| 6 |
| 7 #include <jni.h> |
| 8 |
| 9 #include "base/android/jni_android.h" |
| 10 #include "base/android/scoped_java_ref.h" |
| 11 #include "chrome/browser/ntp_snippets/ntp_snippets_service_factory.h" |
| 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/profiles/profile_android.h" |
| 14 #include "components/ntp_snippets/ntp_snippets_service.h" |
| 15 #include "jni/SnippetsController_jni.h" |
| 16 |
| 17 using base::android::JavaParamRef; |
| 18 |
| 19 static void FetchSnippets(JNIEnv* env, |
| 20 const JavaParamRef<jobject>& obj, |
| 21 const JavaParamRef<jobject>& jprofile, |
| 22 jboolean overwrite) { |
| 23 Profile* profile = ProfileAndroid::FromProfileAndroid(jprofile); |
| 24 if (profile) { |
| 25 ntp_snippets::NTPSnippetsService* ntp_snippets_service = |
| 26 NTPSnippetsServiceFactory::GetForProfile(profile); |
| 27 ntp_snippets_service->FetchSnippets(overwrite); |
| 28 } |
| 29 } |
| 30 |
| 31 // static |
| 32 bool NTPSnippetsController::Register(JNIEnv* env) { |
| 33 return RegisterNativesImpl(env); |
| 34 } |
OLD | NEW |