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 "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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::OnBrowserResumed() { |
| 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. |
142 // TODO(jkrcal): Implement. | 144 // TODO(jkrcal): Implement. |
143 } | 145 } |
144 | 146 |
145 void SchedulingRemoteSuggestionsProvider::OnNTPOpened() { | 147 void SchedulingRemoteSuggestionsProvider::OnNTPOpened() { |
| 148 // TODO(fhorschig|jkrcal): Consider that this may be called on cold starts, |
| 149 // so keep the work light for this case. |
146 // TODO(jkrcal): Implement. | 150 // TODO(jkrcal): Implement. |
147 } | 151 } |
148 | 152 |
149 void SchedulingRemoteSuggestionsProvider::SetProviderStatusCallback( | 153 void SchedulingRemoteSuggestionsProvider::SetProviderStatusCallback( |
150 std::unique_ptr<ProviderStatusCallback> callback) { | 154 std::unique_ptr<ProviderStatusCallback> callback) { |
151 provider_->SetProviderStatusCallback(std::move(callback)); | 155 provider_->SetProviderStatusCallback(std::move(callback)); |
152 } | 156 } |
153 | 157 |
154 void SchedulingRemoteSuggestionsProvider::RefetchInTheBackground( | 158 void SchedulingRemoteSuggestionsProvider::RefetchInTheBackground( |
155 std::unique_ptr<FetchStatusCallback> callback) { | 159 std::unique_ptr<FetchStatusCallback> callback) { |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 } | 333 } |
330 | 334 |
331 // Reschedule after a successful fetch. This resets all currently scheduled | 335 // Reschedule after a successful fetch. This resets all currently scheduled |
332 // fetches, to make sure the fallback interval triggers only if no wifi fetch | 336 // 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 | 337 // succeeded, and also that we don't do a background fetch immediately after |
334 // a user-initiated one. | 338 // a user-initiated one. |
335 ApplyFetchingSchedule(GetLastFetchingSchedule()); | 339 ApplyFetchingSchedule(GetLastFetchingSchedule()); |
336 } | 340 } |
337 | 341 |
338 } // namespace ntp_snippets | 342 } // namespace ntp_snippets |
OLD | NEW |