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

Unified Diff: chrome/browser/ntp_snippets/content_suggestions_service_factory.cc

Issue 2671453003: [NTP::Cleanup] Avoid nested complex function calls (Closed)
Patch Set: tschumann@ & treib@ comments. Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ios/chrome/browser/ntp_snippets/ios_chrome_content_suggestions_service_factory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ntp_snippets/content_suggestions_service_factory.cc
diff --git a/chrome/browser/ntp_snippets/content_suggestions_service_factory.cc b/chrome/browser/ntp_snippets/content_suggestions_service_factory.cc
index b3befc0d38ee143688df8522e50c1136b7af90f5..380dedb114f6d7bfd44ba91fa2d628f54290bc6c 100644
--- a/chrome/browser/ntp_snippets/content_suggestions_service_factory.cc
+++ b/chrome/browser/ntp_snippets/content_suggestions_service_factory.cc
@@ -169,23 +169,29 @@ void RegisterArticleProvider(SigninManagerBase* signin_manager,
->GetSequencedTaskRunnerWithShutdownBehavior(
base::SequencedWorkerPool::GetSequenceToken(),
base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN);
- bool is_stable_channel =
- chrome::GetChannel() == version_info::Channel::STABLE;
- auto provider = base::MakeUnique<RemoteSuggestionsProviderImpl>(
- service, pref_service, g_browser_process->GetApplicationLocale(),
- service->category_ranker(),
- base::MakeUnique<RemoteSuggestionsFetcher>(
- signin_manager, token_service, request_context, pref_service,
- language_model, base::Bind(&safe_json::SafeJsonParser::Parse),
- is_stable_channel ? google_apis::GetAPIKey()
- : google_apis::GetNonStableAPIKey(),
- service->user_classifier()),
- base::MakeUnique<ImageFetcherImpl>(base::MakeUnique<ImageDecoderImpl>(),
- request_context.get()),
- base::MakeUnique<ImageDecoderImpl>(),
- base::MakeUnique<RemoteSuggestionsDatabase>(database_dir, task_runner),
- base::MakeUnique<RemoteSuggestionsStatusService>(signin_manager,
- pref_service));
+
+ std::unique_ptr<RemoteSuggestionsProviderImpl> provider;
+ {
tschumann 2017/02/01 15:07:59 sorry for the late response. I'm not a fan of such
+ bool is_stable_channel =
+ chrome::GetChannel() == version_info::Channel::STABLE;
+ auto suggestions_fetcher = base::MakeUnique<RemoteSuggestionsFetcher>(
+ signin_manager, token_service, request_context, pref_service,
+ language_model, base::Bind(&safe_json::SafeJsonParser::Parse),
+ is_stable_channel ? google_apis::GetAPIKey()
+ : google_apis::GetNonStableAPIKey(),
+ service->user_classifier());
+ auto image_fetcher = base::MakeUnique<ImageFetcherImpl>(
+ base::MakeUnique<ImageDecoderImpl>(), request_context.get());
+ auto database =
+ base::MakeUnique<RemoteSuggestionsDatabase>(database_dir, task_runner);
+ auto status_service = base::MakeUnique<RemoteSuggestionsStatusService>(
+ signin_manager, pref_service);
+ provider = base::MakeUnique<RemoteSuggestionsProviderImpl>(
+ service, pref_service, g_browser_process->GetApplicationLocale(),
+ service->category_ranker(), std::move(suggestions_fetcher),
+ std::move(image_fetcher), base::MakeUnique<ImageDecoderImpl>(),
+ std::move(database), std::move(status_service));
+ }
PersistentScheduler* scheduler = nullptr;
#if defined(OS_ANDROID)
« no previous file with comments | « no previous file | ios/chrome/browser/ntp_snippets/ios_chrome_content_suggestions_service_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698