Chromium Code Reviews| 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 #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 Loading... | |
| 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(fhorschig|jkrcal): Consider that this is called whenever we open or | |
|
Bernhard Bauer
2017/01/05 16:32:54
This syntax doesn't lend itself very well to grepp
fhorschig
2017/01/05 17:11:13
Changed. Thank you for explaining, I didn't know t
| |
| 185 // return to an 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 Loading... | |
| 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 |
| OLD | NEW |