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

Side by Side Diff: components/ntp_snippets/remote/scheduling_remote_suggestions_provider.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 unified diff | Download patch
« no previous file with comments | « components/ntp_snippets/remote/scheduling_remote_suggestions_provider.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "components/ntp_snippets/remote/scheduling_remote_suggestions_provider. h" 5 #include "components/ntp_snippets/remote/scheduling_remote_suggestions_provider. h"
6 6
7 #include <random> 7 #include <random>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 } 173 }
174 174
175 void SchedulingRemoteSuggestionsProvider::OnPersistentSchedulerWakeUp() { 175 void SchedulingRemoteSuggestionsProvider::OnPersistentSchedulerWakeUp() {
176 if (BackgroundFetchesDisabled()) { 176 if (BackgroundFetchesDisabled()) {
177 return; 177 return;
178 } 178 }
179 179
180 RefetchInTheBackground(/*callback=*/nullptr); 180 RefetchInTheBackground(/*callback=*/nullptr);
181 } 181 }
182 182
183 void SchedulingRemoteSuggestionsProvider::OnBrowserStartup() { 183 void SchedulingRemoteSuggestionsProvider::OnBrowserForegrounded() {
184 // TODO(jkrcal): Consider that this is called whenever we open or return to an
185 // Activity. Therefore, keep work light for fast start up calls.
184 // TODO(jkrcal): Implement. 186 // TODO(jkrcal): Implement.
185 } 187 }
186 188
189 void SchedulingRemoteSuggestionsProvider::OnBrowserColdStart() {
190 // TODO(fhorschig|jkrcal): Consider that work here must be kept light for fast
191 // cold start ups.
192 // TODO(jkrcal): Implement.
193 }
194
187 void SchedulingRemoteSuggestionsProvider::OnNTPOpened() { 195 void SchedulingRemoteSuggestionsProvider::OnNTPOpened() {
188 if (BackgroundFetchesDisabled() || !ShouldRefetchInTheBackgroundNow()) { 196 if (BackgroundFetchesDisabled() || !ShouldRefetchInTheBackgroundNow()) {
189 return; 197 return;
190 } 198 }
191 199
192 RefetchInTheBackground(/*callback=*/nullptr); 200 RefetchInTheBackground(/*callback=*/nullptr);
193 } 201 }
194 202
195 void SchedulingRemoteSuggestionsProvider::SetProviderStatusCallback( 203 void SchedulingRemoteSuggestionsProvider::SetProviderStatusCallback(
196 std::unique_ptr<ProviderStatusCallback> callback) { 204 std::unique_ptr<ProviderStatusCallback> callback) {
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 // successful fetch. After a failed fetch, we want to keep the previous 417 // successful fetch. After a failed fetch, we want to keep the previous
410 // persistent schedule intact so that we eventually get a persistent 418 // persistent schedule intact so that we eventually get a persistent
411 // fallback fetch (if the wifi persistent fetches keep failing). 419 // fallback fetch (if the wifi persistent fetches keep failing).
412 if (fetch_status.code != StatusCode::SUCCESS) { 420 if (fetch_status.code != StatusCode::SUCCESS) {
413 return; 421 return;
414 } 422 }
415 ApplyPersistentFetchingSchedule(); 423 ApplyPersistentFetchingSchedule();
416 } 424 }
417 425
418 } // namespace ntp_snippets 426 } // namespace ntp_snippets
OLDNEW
« no previous file with comments | « components/ntp_snippets/remote/scheduling_remote_suggestions_provider.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698