OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_ANDROID_NTP_NTP_SNIPPETS_LAUNCHER_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_NTP_NTP_SNIPPETS_LAUNCHER_H_ |
6 #define CHROME_BROWSER_ANDROID_NTP_NTP_SNIPPETS_LAUNCHER_H_ | 6 #define CHROME_BROWSER_ANDROID_NTP_NTP_SNIPPETS_LAUNCHER_H_ |
7 | 7 |
8 #include "base/android/jni_android.h" | 8 #include "base/android/jni_android.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
12 #include "components/ntp_snippets/ntp_snippets_scheduler.h" | 12 #include "components/ntp_snippets/ntp_snippets_scheduler.h" |
13 | 13 |
14 // Android implementation of ntp_snippets::NTPSnippetsScheduler. | 14 // Android implementation of ntp_snippets::NTPSnippetsScheduler. |
15 // The NTPSnippetsLauncher singleton owns the Java SnippetsLauncher object, and | 15 // The NTPSnippetsLauncher singleton owns the Java SnippetsLauncher object, and |
16 // is used to schedule the fetching of snippets. Runs on the UI thread. | 16 // is used to schedule the fetching of snippets. Runs on the UI thread. |
17 class NTPSnippetsLauncher : public ntp_snippets::NTPSnippetsScheduler { | 17 class NTPSnippetsLauncher : public ntp_snippets::NTPSnippetsScheduler { |
18 public: | 18 public: |
19 static NTPSnippetsLauncher* Get(); | 19 static NTPSnippetsLauncher* Get(); |
20 | 20 |
21 static bool Register(JNIEnv* env); | 21 static bool Register(JNIEnv* env); |
22 | 22 |
23 // ntp_snippets::NTPSnippetsScheduler implementation. | 23 // ntp_snippets::NTPSnippetsScheduler implementation. |
24 bool Schedule(base::TimeDelta period_wifi_charging, | 24 bool Schedule(base::TimeDelta period_wifi_charging, |
25 base::TimeDelta period_wifi, | 25 base::TimeDelta period_wifi, |
26 base::TimeDelta period_fallback) override; | 26 base::TimeDelta period_fallback, |
| 27 base::Time reschedule_time) override; |
27 bool Unschedule() override; | 28 bool Unschedule() override; |
28 | 29 |
29 private: | 30 private: |
30 friend struct base::DefaultLazyInstanceTraits<NTPSnippetsLauncher>; | 31 friend struct base::DefaultLazyInstanceTraits<NTPSnippetsLauncher>; |
31 | 32 |
32 // Constructor and destructor marked private to enforce singleton. | 33 // Constructor and destructor marked private to enforce singleton. |
33 NTPSnippetsLauncher(); | 34 NTPSnippetsLauncher(); |
34 virtual ~NTPSnippetsLauncher(); | 35 virtual ~NTPSnippetsLauncher(); |
35 | 36 |
36 base::android::ScopedJavaGlobalRef<jobject> java_launcher_; | 37 base::android::ScopedJavaGlobalRef<jobject> java_launcher_; |
37 | 38 |
38 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsLauncher); | 39 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsLauncher); |
39 }; | 40 }; |
40 | 41 |
41 #endif // CHROME_BROWSER_ANDROID_NTP_NTP_SNIPPETS_LAUNCHER_H_ | 42 #endif // CHROME_BROWSER_ANDROID_NTP_NTP_SNIPPETS_LAUNCHER_H_ |
OLD | NEW |