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

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: Two separate signals instead of boolean value. 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
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 <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 StartScheduling(); 131 StartScheduling();
132 } 132 }
133 133
134 void SchedulingRemoteSuggestionsProvider::OnPersistentSchedulerWakeUp() { 134 void SchedulingRemoteSuggestionsProvider::OnPersistentSchedulerWakeUp() {
135 provider_->RefetchInTheBackground( 135 provider_->RefetchInTheBackground(
136 base::MakeUnique<RemoteSuggestionsProvider::FetchStatusCallback>( 136 base::MakeUnique<RemoteSuggestionsProvider::FetchStatusCallback>(
137 base::Bind(&SchedulingRemoteSuggestionsProvider::OnFetchCompleted, 137 base::Bind(&SchedulingRemoteSuggestionsProvider::OnFetchCompleted,
138 base::Unretained(this)))); 138 base::Unretained(this))));
139 } 139 }
140 140
141 void SchedulingRemoteSuggestionsProvider::OnBrowserStartup() { 141 void SchedulingRemoteSuggestionsProvider::OnBrowserForegrounded() {
142 // TODO(fhorschig|jkrcal): Consider that this is called whenever we open or
143 // return to an Activity. Therefore, keep work light for fast start up calls.
144 // TODO(jkrcal): Implement.
145 }
146
147 void SchedulingRemoteSuggestionsProvider::OnBrowserColdStart() {
148 // TODO(fhorschig|jkrcal): Consider that work here must be kept light for fast
149 // cold start ups.
142 // TODO(jkrcal): Implement. 150 // TODO(jkrcal): Implement.
143 } 151 }
144 152
145 void SchedulingRemoteSuggestionsProvider::OnNTPOpened() { 153 void SchedulingRemoteSuggestionsProvider::OnNTPOpened() {
154 // TODO(fhorschig|jkrcal): Consider that this may be called on cold starts,
155 // so keep the work light for this case.
146 // TODO(jkrcal): Implement. 156 // TODO(jkrcal): Implement.
147 } 157 }
148 158
149 void SchedulingRemoteSuggestionsProvider::SetProviderStatusCallback( 159 void SchedulingRemoteSuggestionsProvider::SetProviderStatusCallback(
150 std::unique_ptr<ProviderStatusCallback> callback) { 160 std::unique_ptr<ProviderStatusCallback> callback) {
151 provider_->SetProviderStatusCallback(std::move(callback)); 161 provider_->SetProviderStatusCallback(std::move(callback));
152 } 162 }
153 163
154 void SchedulingRemoteSuggestionsProvider::RefetchInTheBackground( 164 void SchedulingRemoteSuggestionsProvider::RefetchInTheBackground(
155 std::unique_ptr<FetchStatusCallback> callback) { 165 std::unique_ptr<FetchStatusCallback> callback) {
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 } 339 }
330 340
331 // Reschedule after a successful fetch. This resets all currently scheduled 341 // Reschedule after a successful fetch. This resets all currently scheduled
332 // fetches, to make sure the fallback interval triggers only if no wifi fetch 342 // fetches, to make sure the fallback interval triggers only if no wifi fetch
333 // succeeded, and also that we don't do a background fetch immediately after 343 // succeeded, and also that we don't do a background fetch immediately after
334 // a user-initiated one. 344 // a user-initiated one.
335 ApplyFetchingSchedule(GetLastFetchingSchedule()); 345 ApplyFetchingSchedule(GetLastFetchingSchedule());
336 } 346 }
337 347
338 } // namespace ntp_snippets 348 } // namespace ntp_snippets
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698