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

Unified Diff: chrome/browser/android/ntp/ntp_snippets_bridge.cc

Issue 2599743002: Trigger the Snippets Scheduler when Resuming Activities (Closed)
Patch Set: Rebase Created 3 years, 11 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/ntp_snippets_bridge.cc
diff --git a/chrome/browser/android/ntp/ntp_snippets_bridge.cc b/chrome/browser/android/ntp/ntp_snippets_bridge.cc
index 479b9c4932746705f24e1869161415f369e3fd06..97be38154d267c14948eaaffedf539a497bec5c2 100644
--- a/chrome/browser/android/ntp/ntp_snippets_bridge.cc
+++ b/chrome/browser/android/ntp/ntp_snippets_bridge.cc
@@ -408,6 +408,30 @@ void NTPSnippetsBridge::OnNTPInitialized(
scheduler->OnNTPOpened();
}
+void NTPSnippetsBridge::OnColdStart(
+ JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& obj) {
+ ntp_snippets::RemoteSuggestionsScheduler* scheduler =
+ GetRemoteSuggestionsScheduler();
+ // TODO(fhorschig): Remove guard when https://crbug.com/678556 is resolved.
+ if (!scheduler) {
+ return;
+ }
+ scheduler->OnBrowserColdStart();
+}
+
+void NTPSnippetsBridge::OnActivityWarmResumed(
+ JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& obj) {
+ ntp_snippets::RemoteSuggestionsScheduler* scheduler =
+ GetRemoteSuggestionsScheduler();
+ // TODO(fhorschig): Remove guard when https://crbug.com/678556 is resolved.
+ if (!scheduler) {
+ return;
+ }
+ scheduler->OnBrowserForegrounded();
+}
+
NTPSnippetsBridge::~NTPSnippetsBridge() {}
void NTPSnippetsBridge::OnNewSuggestions(Category category) {
« no previous file with comments | « chrome/browser/android/ntp/ntp_snippets_bridge.h ('k') | components/ntp_snippets/remote/remote_suggestions_scheduler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698