Chromium Code Reviews| Index: chrome/browser/android/ntp/ntp_snippets_bridge.cc |
| diff --git a/chrome/browser/android/ntp/ntp_snippets_bridge.cc b/chrome/browser/android/ntp/ntp_snippets_bridge.cc |
| index 1674d00ad9ba3b2e66c6bf13b4463ead1ec16829..cd4cdf57a93daf80f8322dcfdc004639efa53de4 100644 |
| --- a/chrome/browser/android/ntp/ntp_snippets_bridge.cc |
| +++ b/chrome/browser/android/ntp/ntp_snippets_bridge.cc |
| @@ -102,7 +102,7 @@ ntp_snippets::RemoteSuggestionsProvider* GetRemoteSuggestionsProvider() { |
| if (!content_suggestions_service) { |
| return nullptr; |
| } |
| - return content_suggestions_service->ntp_snippets_service(); |
| + return content_suggestions_service->remote_suggestions_provider(); |
| } |
| } // namespace |
| @@ -123,6 +123,7 @@ static void FetchRemoteSuggestions(JNIEnv* env, |
| if (!remote_suggestions_provider) { |
| return; |
| } |
| + |
| remote_suggestions_provider->FetchSnippetsForAllCategories(); |
| } |
| @@ -136,35 +137,24 @@ static void FetchRemoteSuggestionsInTheBackground( |
| if (!remote_suggestions_provider) { |
| return; |
| } |
| - remote_suggestions_provider->FetchSnippetsInTheBackground(); |
| + |
| + remote_suggestions_provider->scheduler()->PerformHardUpdate(); |
|
tschumann
2016/12/09 17:27:28
this is a smell. If this is a funtionality this pr
jkrcal
2016/12/14 09:42:09
Done.
|
| } |
| // Reschedules the fetching of snippets. If tasks are already scheduled, they |
| // will be rescheduled anyway, so all running intervals will be reset. |
| static void RescheduleFetching(JNIEnv* env, |
| const JavaParamRef<jclass>& caller) { |
| - Profile* profile = ProfileManager::GetLastUsedProfile(); |
| - // Temporary check while investigating crbug.com/647920. |
| - CHECK(profile); |
| - |
| - ntp_snippets::ContentSuggestionsService* content_suggestions_service = |
| - ContentSuggestionsServiceFactory::GetForProfile(profile); |
| - |
| - // Can maybe be null in some cases? (Incognito profile?) crbug.com/647920 |
| - if (!content_suggestions_service) { |
| - return; |
| - } |
| - |
| - ntp_snippets::RemoteSuggestionsProvider* service = |
| - content_suggestions_service->ntp_snippets_service(); |
| - |
| + ntp_snippets::RemoteSuggestionsProvider* remote_suggestions_provider = |
| + GetRemoteSuggestionsProvider(); |
| // Can be null if the feature has been disabled but the scheduler has not been |
| // unregistered yet. The next start should unregister it. |
| - if (!service) { |
| + if (!remote_suggestions_provider) { |
| return; |
| } |
| - service->RescheduleFetching(/*force=*/true); |
| + remote_suggestions_provider->scheduler()->Unschedule(); |
|
tschumann
2016/12/09 17:27:28
same here: just add a single Reschedule() function
jkrcal
2016/12/14 09:42:09
Done.
|
| + remote_suggestions_provider->scheduler()->Schedule(); |
| } |
| static void OnSuggestionTargetVisited(JNIEnv* env, |