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

Unified Diff: chrome/browser/android/ntp_snippets_launcher.h

Issue 1699143002: [NTP Snippets] Schedule periodic fetching (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@snippets_feature
Patch Set: fix bots 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
« no previous file with comments | « chrome/browser/android/chrome_jni_registrar.cc ('k') | chrome/browser/android/ntp_snippets_launcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/ntp_snippets_launcher.h
diff --git a/chrome/browser/android/ntp_snippets_launcher.h b/chrome/browser/android/ntp_snippets_launcher.h
new file mode 100644
index 0000000000000000000000000000000000000000..c2f4ef61b3b88b885dfc4d6535bb7adea0a129eb
--- /dev/null
+++ b/chrome/browser/android/ntp_snippets_launcher.h
@@ -0,0 +1,38 @@
+// 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.
+
+#ifndef CHROME_BROWSER_ANDROID_NTP_SNIPPETS_LAUNCHER_H_
+#define CHROME_BROWSER_ANDROID_NTP_SNIPPETS_LAUNCHER_H_
+
+#include "base/android/jni_android.h"
+#include "base/lazy_instance.h"
+#include "base/macros.h"
+#include "components/ntp_snippets/ntp_snippets_scheduler.h"
+
+// Android implementation of ntp_snippets::NTPSnippetsScheduler.
+// The NTPSnippetsLauncher singleton owns the Java SnippetsLauncher object, and
+// is used to schedule the fetching of snippets. Runs on the UI thread.
+class NTPSnippetsLauncher : public ntp_snippets::NTPSnippetsScheduler {
+ public:
+ static NTPSnippetsLauncher* Get();
+
+ static bool Register(JNIEnv* env);
+
+ // ntp_snippets::NTPSnippetsScheduler implementation.
+ bool Schedule(int period_seconds) override;
+ bool Unschedule() override;
+
+ private:
+ friend struct base::DefaultLazyInstanceTraits<NTPSnippetsLauncher>;
+
+ // Constructor and destructor marked private to enforce singleton.
+ NTPSnippetsLauncher();
+ virtual ~NTPSnippetsLauncher();
+
+ base::android::ScopedJavaGlobalRef<jobject> java_launcher_;
+
+ DISALLOW_COPY_AND_ASSIGN(NTPSnippetsLauncher);
+};
+
+#endif // CHROME_BROWSER_ANDROID_NTP_SNIPPETS_LAUNCHER_H_
« no previous file with comments | « chrome/browser/android/chrome_jni_registrar.cc ('k') | chrome/browser/android/ntp_snippets_launcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698