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

Unified Diff: chrome/browser/android/ntp_snippets_controller.cc

Issue 1677073002: Fetch snippets from ChromeReader and show them on the NTP (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/android/ntp_snippets_controller.cc
diff --git a/chrome/browser/android/ntp_snippets_controller.cc b/chrome/browser/android/ntp_snippets_controller.cc
new file mode 100644
index 0000000000000000000000000000000000000000..a252d52d1c50b2199726775a7bb12d674dd4a4dd
--- /dev/null
+++ b/chrome/browser/android/ntp_snippets_controller.cc
@@ -0,0 +1,34 @@
+// Copyright 2016 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.
+
+#include "chrome/browser/android/ntp_snippets_controller.h"
+
+#include <jni.h>
+
+#include "base/android/jni_android.h"
+#include "base/android/scoped_java_ref.h"
+#include "chrome/browser/ntp_snippets/ntp_snippets_service_factory.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/profiles/profile_android.h"
+#include "components/ntp_snippets/ntp_snippets_service.h"
+#include "jni/SnippetsController_jni.h"
+
+using base::android::JavaParamRef;
+
+static void FetchSnippets(JNIEnv* env,
+ const JavaParamRef<jobject>& obj,
+ const JavaParamRef<jobject>& jprofile,
+ jboolean overwrite) {
+ Profile* profile = ProfileAndroid::FromProfileAndroid(jprofile);
+ if (profile) {
+ ntp_snippets::NTPSnippetsService* ntp_snippets_service =
+ NTPSnippetsServiceFactory::GetForProfile(profile);
+ ntp_snippets_service->FetchSnippets(overwrite);
+ }
+}
+
+// static
+bool NTPSnippetsController::Register(JNIEnv* env) {
+ return RegisterNativesImpl(env);
+}
« no previous file with comments | « chrome/browser/android/ntp_snippets_controller.h ('k') | chrome/browser/ntp_snippets/ntp_snippets_service_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698