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

Side by Side Diff: chrome/browser/ntp_snippets/content_suggestions_service_factory.cc

Issue 2702223004: [Remote suggestions] Move all decisions to fetch to the scheduler (Closed)
Patch Set: Fixing an embarassing bug :) Created 3 years, 9 months 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
« no previous file with comments | « no previous file | components/ntp_snippets/content_suggestions_service.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/browser/ntp_snippets/content_suggestions_service_factory.h" 5 #include "chrome/browser/ntp_snippets/content_suggestions_service_factory.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/feature_list.h" 9 #include "base/feature_list.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 base::MakeUnique<ImageDecoderImpl>(), 209 base::MakeUnique<ImageDecoderImpl>(),
210 base::MakeUnique<RemoteSuggestionsDatabase>(database_dir, task_runner), 210 base::MakeUnique<RemoteSuggestionsDatabase>(database_dir, task_runner),
211 base::MakeUnique<RemoteSuggestionsStatusService>(signin_manager, 211 base::MakeUnique<RemoteSuggestionsStatusService>(signin_manager,
212 pref_service)); 212 pref_service));
213 213
214 PersistentScheduler* scheduler = nullptr; 214 PersistentScheduler* scheduler = nullptr;
215 #if defined(OS_ANDROID) 215 #if defined(OS_ANDROID)
216 scheduler = NTPSnippetsLauncher::Get(); 216 scheduler = NTPSnippetsLauncher::Get();
217 #endif // OS_ANDROID 217 #endif // OS_ANDROID
218 218
219 RemoteSuggestionsProviderImpl* provider_raw = provider.get();
219 auto scheduling_provider = 220 auto scheduling_provider =
220 base::MakeUnique<SchedulingRemoteSuggestionsProvider>( 221 base::MakeUnique<SchedulingRemoteSuggestionsProvider>(
221 service, std::move(provider), scheduler, service->user_classifier(), 222 service, std::move(provider), scheduler, service->user_classifier(),
222 pref_service, base::MakeUnique<base::DefaultClock>()); 223 pref_service, base::MakeUnique<base::DefaultClock>());
224 provider_raw->SetRemoteSuggestionsScheduler(scheduling_provider.get());
223 service->set_remote_suggestions_provider(scheduling_provider.get()); 225 service->set_remote_suggestions_provider(scheduling_provider.get());
224 service->set_remote_suggestions_scheduler(scheduling_provider.get()); 226 service->set_remote_suggestions_scheduler(scheduling_provider.get());
225 service->RegisterProvider(std::move(scheduling_provider)); 227 service->RegisterProvider(std::move(scheduling_provider));
226 } 228 }
227 229
228 void RegisterForeignSessionsProvider(SyncService* sync_service, 230 void RegisterForeignSessionsProvider(SyncService* sync_service,
229 ContentSuggestionsService* service, 231 ContentSuggestionsService* service,
230 PrefService* pref_service) { 232 PrefService* pref_service) {
231 std::unique_ptr<TabDelegateSyncAdapter> sync_adapter = 233 std::unique_ptr<TabDelegateSyncAdapter> sync_adapter =
232 base::MakeUnique<TabDelegateSyncAdapter>(sync_service); 234 base::MakeUnique<TabDelegateSyncAdapter>(sync_service);
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 ntp_snippets::kForeignSessionsSuggestionsFeature)) { 360 ntp_snippets::kForeignSessionsSuggestionsFeature)) {
359 RegisterForeignSessionsProvider(sync_service, service, pref_service); 361 RegisterForeignSessionsProvider(sync_service, service, pref_service);
360 } 362 }
361 363
362 return service; 364 return service;
363 365
364 #else 366 #else
365 return nullptr; 367 return nullptr;
366 #endif // CONTENT_SUGGESTIONS_ENABLED 368 #endif // CONTENT_SUGGESTIONS_ENABLED
367 } 369 }
OLDNEW
« no previous file with comments | « no previous file | components/ntp_snippets/content_suggestions_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698