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 "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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 #endif // OS_ANDROID | 83 #endif // OS_ANDROID |
84 | 84 |
85 using bookmarks::BookmarkModel; | 85 using bookmarks::BookmarkModel; |
86 using content::BrowserThread; | 86 using content::BrowserThread; |
87 using history::HistoryService; | 87 using history::HistoryService; |
88 using image_fetcher::ImageFetcherImpl; | 88 using image_fetcher::ImageFetcherImpl; |
89 using ntp_snippets::BookmarkSuggestionsProvider; | 89 using ntp_snippets::BookmarkSuggestionsProvider; |
90 using ntp_snippets::CategoryRanker; | 90 using ntp_snippets::CategoryRanker; |
91 using ntp_snippets::ContentSuggestionsService; | 91 using ntp_snippets::ContentSuggestionsService; |
92 using ntp_snippets::ForeignSessionsSuggestionsProvider; | 92 using ntp_snippets::ForeignSessionsSuggestionsProvider; |
| 93 using ntp_snippets::GetFetchEndpoint; |
93 using ntp_snippets::PersistentScheduler; | 94 using ntp_snippets::PersistentScheduler; |
94 using ntp_snippets::RemoteSuggestionsDatabase; | 95 using ntp_snippets::RemoteSuggestionsDatabase; |
95 using ntp_snippets::RemoteSuggestionsFetcher; | 96 using ntp_snippets::RemoteSuggestionsFetcher; |
96 using ntp_snippets::RemoteSuggestionsProviderImpl; | 97 using ntp_snippets::RemoteSuggestionsProviderImpl; |
97 using ntp_snippets::RemoteSuggestionsStatusService; | 98 using ntp_snippets::RemoteSuggestionsStatusService; |
98 using ntp_snippets::SchedulingRemoteSuggestionsProvider; | 99 using ntp_snippets::SchedulingRemoteSuggestionsProvider; |
99 using ntp_snippets::TabDelegateSyncAdapter; | 100 using ntp_snippets::TabDelegateSyncAdapter; |
100 using suggestions::ImageDecoderImpl; | 101 using suggestions::ImageDecoderImpl; |
101 using syncer::SyncService; | 102 using syncer::SyncService; |
102 using translate::LanguageModel; | 103 using translate::LanguageModel; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 scoped_refptr<base::SequencedTaskRunner> task_runner = | 192 scoped_refptr<base::SequencedTaskRunner> task_runner = |
192 BrowserThread::GetBlockingPool() | 193 BrowserThread::GetBlockingPool() |
193 ->GetSequencedTaskRunnerWithShutdownBehavior( | 194 ->GetSequencedTaskRunnerWithShutdownBehavior( |
194 base::SequencedWorkerPool::GetSequenceToken(), | 195 base::SequencedWorkerPool::GetSequenceToken(), |
195 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN); | 196 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN); |
196 bool is_stable_channel = | 197 bool is_stable_channel = |
197 chrome::GetChannel() == version_info::Channel::STABLE; | 198 chrome::GetChannel() == version_info::Channel::STABLE; |
198 auto suggestions_fetcher = base::MakeUnique<RemoteSuggestionsFetcher>( | 199 auto suggestions_fetcher = base::MakeUnique<RemoteSuggestionsFetcher>( |
199 signin_manager, token_service, request_context, pref_service, | 200 signin_manager, token_service, request_context, pref_service, |
200 language_model, base::Bind(&safe_json::SafeJsonParser::Parse), | 201 language_model, base::Bind(&safe_json::SafeJsonParser::Parse), |
| 202 GetFetchEndpoint(chrome::GetChannel()), |
201 is_stable_channel ? google_apis::GetAPIKey() | 203 is_stable_channel ? google_apis::GetAPIKey() |
202 : google_apis::GetNonStableAPIKey(), | 204 : google_apis::GetNonStableAPIKey(), |
203 service->user_classifier()); | 205 service->user_classifier()); |
204 auto provider = base::MakeUnique<RemoteSuggestionsProviderImpl>( | 206 auto provider = base::MakeUnique<RemoteSuggestionsProviderImpl>( |
205 service, pref_service, g_browser_process->GetApplicationLocale(), | 207 service, pref_service, g_browser_process->GetApplicationLocale(), |
206 service->category_ranker(), std::move(suggestions_fetcher), | 208 service->category_ranker(), std::move(suggestions_fetcher), |
207 base::MakeUnique<ImageFetcherImpl>(base::MakeUnique<ImageDecoderImpl>(), | 209 base::MakeUnique<ImageFetcherImpl>(base::MakeUnique<ImageDecoderImpl>(), |
208 request_context.get()), | 210 request_context.get()), |
209 base::MakeUnique<ImageDecoderImpl>(), | 211 base::MakeUnique<ImageDecoderImpl>(), |
210 base::MakeUnique<RemoteSuggestionsDatabase>(database_dir, task_runner), | 212 base::MakeUnique<RemoteSuggestionsDatabase>(database_dir, task_runner), |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 ntp_snippets::kForeignSessionsSuggestionsFeature)) { | 362 ntp_snippets::kForeignSessionsSuggestionsFeature)) { |
361 RegisterForeignSessionsProvider(sync_service, service, pref_service); | 363 RegisterForeignSessionsProvider(sync_service, service, pref_service); |
362 } | 364 } |
363 | 365 |
364 return service; | 366 return service; |
365 | 367 |
366 #else | 368 #else |
367 return nullptr; | 369 return nullptr; |
368 #endif // CONTENT_SUGGESTIONS_ENABLED | 370 #endif // CONTENT_SUGGESTIONS_ENABLED |
369 } | 371 } |
OLD | NEW |