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

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

Issue 2671453003: [NTP::Cleanup] Avoid nested complex function calls (Closed)
Patch Set: clean rebase. Created 3 years, 10 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 | ios/chrome/browser/ntp_snippets/ios_chrome_content_suggestions_service_factory.cc » ('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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 164
165 base::FilePath database_dir( 165 base::FilePath database_dir(
166 profile->GetPath().Append(ntp_snippets::kDatabaseFolder)); 166 profile->GetPath().Append(ntp_snippets::kDatabaseFolder));
167 scoped_refptr<base::SequencedTaskRunner> task_runner = 167 scoped_refptr<base::SequencedTaskRunner> task_runner =
168 BrowserThread::GetBlockingPool() 168 BrowserThread::GetBlockingPool()
169 ->GetSequencedTaskRunnerWithShutdownBehavior( 169 ->GetSequencedTaskRunnerWithShutdownBehavior(
170 base::SequencedWorkerPool::GetSequenceToken(), 170 base::SequencedWorkerPool::GetSequenceToken(),
171 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN); 171 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN);
172 bool is_stable_channel = 172 bool is_stable_channel =
173 chrome::GetChannel() == version_info::Channel::STABLE; 173 chrome::GetChannel() == version_info::Channel::STABLE;
174 auto suggestions_fetcher = base::MakeUnique<RemoteSuggestionsFetcher>(
175 signin_manager, token_service, request_context, pref_service,
176 language_model, base::Bind(&safe_json::SafeJsonParser::Parse),
177 is_stable_channel ? google_apis::GetAPIKey()
178 : google_apis::GetNonStableAPIKey(),
179 service->user_classifier());
174 auto provider = base::MakeUnique<RemoteSuggestionsProviderImpl>( 180 auto provider = base::MakeUnique<RemoteSuggestionsProviderImpl>(
175 service, pref_service, g_browser_process->GetApplicationLocale(), 181 service, pref_service, g_browser_process->GetApplicationLocale(),
176 service->category_ranker(), 182 service->category_ranker(), std::move(suggestions_fetcher),
177 base::MakeUnique<RemoteSuggestionsFetcher>(
178 signin_manager, token_service, request_context, pref_service,
179 language_model, base::Bind(&safe_json::SafeJsonParser::Parse),
180 is_stable_channel ? google_apis::GetAPIKey()
181 : google_apis::GetNonStableAPIKey(),
182 service->user_classifier()),
183 base::MakeUnique<ImageFetcherImpl>(base::MakeUnique<ImageDecoderImpl>(), 183 base::MakeUnique<ImageFetcherImpl>(base::MakeUnique<ImageDecoderImpl>(),
184 request_context.get()), 184 request_context.get()),
185 base::MakeUnique<ImageDecoderImpl>(), 185 base::MakeUnique<ImageDecoderImpl>(),
186 base::MakeUnique<RemoteSuggestionsDatabase>(database_dir, task_runner), 186 base::MakeUnique<RemoteSuggestionsDatabase>(database_dir, task_runner),
187 base::MakeUnique<RemoteSuggestionsStatusService>(signin_manager, 187 base::MakeUnique<RemoteSuggestionsStatusService>(signin_manager,
188 pref_service)); 188 pref_service));
189 189
190 PersistentScheduler* scheduler = nullptr; 190 PersistentScheduler* scheduler = nullptr;
191 #if defined(OS_ANDROID) 191 #if defined(OS_ANDROID)
192 scheduler = NTPSnippetsLauncher::Get(); 192 scheduler = NTPSnippetsLauncher::Get();
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 language_model, pref_service, profile); 323 language_model, pref_service, profile);
324 } 324 }
325 325
326 if (base::FeatureList::IsEnabled( 326 if (base::FeatureList::IsEnabled(
327 ntp_snippets::kForeignSessionsSuggestionsFeature)) { 327 ntp_snippets::kForeignSessionsSuggestionsFeature)) {
328 RegisterForeignSessionsProvider(sync_service, service, pref_service); 328 RegisterForeignSessionsProvider(sync_service, service, pref_service);
329 } 329 }
330 330
331 return service; 331 return service;
332 } 332 }
OLDNEW
« 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