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

Side by Side Diff: components/ntp_snippets/remote/scheduling_remote_suggestions_provider.cc

Issue 2597653002: [Remote suggestions] Interface for additional triggers for the scheduler (Closed)
Patch Set: Created 4 years 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 "components/ntp_snippets/features.h" 10 #include "components/ntp_snippets/features.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 StartScheduling(); 130 StartScheduling();
131 } 131 }
132 132
133 void SchedulingRemoteSuggestionsProvider::OnPersistentSchedulerWakeUp() { 133 void SchedulingRemoteSuggestionsProvider::OnPersistentSchedulerWakeUp() {
134 provider_->RefetchInTheBackground( 134 provider_->RefetchInTheBackground(
135 base::MakeUnique<RemoteSuggestionsProvider::FetchStatusCallback>( 135 base::MakeUnique<RemoteSuggestionsProvider::FetchStatusCallback>(
136 base::Bind(&SchedulingRemoteSuggestionsProvider::OnFetchCompleted, 136 base::Bind(&SchedulingRemoteSuggestionsProvider::OnFetchCompleted,
137 base::Unretained(this)))); 137 base::Unretained(this))));
138 } 138 }
139 139
140 bool SchedulingRemoteSuggestionsProvider::OnBrowserStartup() {
141 // TODO(jkrcal): Implement.
142 return false;
143 }
144
145 bool SchedulingRemoteSuggestionsProvider::OnNTPOpened() {
146 // TODO(jkrcal): Implement.
147 return false;
148 }
149
140 void SchedulingRemoteSuggestionsProvider::SetProviderStatusCallback( 150 void SchedulingRemoteSuggestionsProvider::SetProviderStatusCallback(
141 std::unique_ptr<ProviderStatusCallback> callback) { 151 std::unique_ptr<ProviderStatusCallback> callback) {
142 provider_->SetProviderStatusCallback(std::move(callback)); 152 provider_->SetProviderStatusCallback(std::move(callback));
143 } 153 }
144 154
145 void SchedulingRemoteSuggestionsProvider::RefetchInTheBackground( 155 void SchedulingRemoteSuggestionsProvider::RefetchInTheBackground(
146 std::unique_ptr<FetchStatusCallback> callback) { 156 std::unique_ptr<FetchStatusCallback> callback) {
147 provider_->RefetchInTheBackground(std::move(callback)); 157 provider_->RefetchInTheBackground(std::move(callback));
148 } 158 }
149 159
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 } 330 }
321 331
322 // Reschedule after a successful fetch. This resets all currently scheduled 332 // Reschedule after a successful fetch. This resets all currently scheduled
323 // fetches, to make sure the fallback interval triggers only if no wifi fetch 333 // fetches, to make sure the fallback interval triggers only if no wifi fetch
324 // succeeded, and also that we don't do a background fetch immediately after 334 // succeeded, and also that we don't do a background fetch immediately after
325 // a user-initiated one. 335 // a user-initiated one.
326 ApplyFetchingSchedule(GetLastFetchingSchedule()); 336 ApplyFetchingSchedule(GetLastFetchingSchedule());
327 } 337 }
328 338
329 } // namespace ntp_snippets 339 } // namespace ntp_snippets
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698