| 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 <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 Loading... |
| 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 void SchedulingRemoteSuggestionsProvider::OnBrowserStartup() { |
| 141 // TODO(jkrcal): Implement. |
| 142 } |
| 143 |
| 144 void SchedulingRemoteSuggestionsProvider::OnNTPOpened() { |
| 145 // TODO(jkrcal): Implement. |
| 146 } |
| 147 |
| 140 void SchedulingRemoteSuggestionsProvider::SetProviderStatusCallback( | 148 void SchedulingRemoteSuggestionsProvider::SetProviderStatusCallback( |
| 141 std::unique_ptr<ProviderStatusCallback> callback) { | 149 std::unique_ptr<ProviderStatusCallback> callback) { |
| 142 provider_->SetProviderStatusCallback(std::move(callback)); | 150 provider_->SetProviderStatusCallback(std::move(callback)); |
| 143 } | 151 } |
| 144 | 152 |
| 145 void SchedulingRemoteSuggestionsProvider::RefetchInTheBackground( | 153 void SchedulingRemoteSuggestionsProvider::RefetchInTheBackground( |
| 146 std::unique_ptr<FetchStatusCallback> callback) { | 154 std::unique_ptr<FetchStatusCallback> callback) { |
| 147 provider_->RefetchInTheBackground(std::move(callback)); | 155 provider_->RefetchInTheBackground(std::move(callback)); |
| 148 } | 156 } |
| 149 | 157 |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 } | 328 } |
| 321 | 329 |
| 322 // Reschedule after a successful fetch. This resets all currently scheduled | 330 // Reschedule after a successful fetch. This resets all currently scheduled |
| 323 // fetches, to make sure the fallback interval triggers only if no wifi fetch | 331 // 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 | 332 // succeeded, and also that we don't do a background fetch immediately after |
| 325 // a user-initiated one. | 333 // a user-initiated one. |
| 326 ApplyFetchingSchedule(GetLastFetchingSchedule()); | 334 ApplyFetchingSchedule(GetLastFetchingSchedule()); |
| 327 } | 335 } |
| 328 | 336 |
| 329 } // namespace ntp_snippets | 337 } // namespace ntp_snippets |
| OLD | NEW |