| 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" |
| 11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "base/memory/singleton.h" | 12 #include "base/memory/singleton.h" |
| 13 #include "base/sequenced_task_runner.h" | 13 #include "base/sequenced_task_runner.h" |
| 14 #include "base/task_scheduler/post_task.h" | 14 #include "base/task_scheduler/post_task.h" |
| 15 #include "base/time/default_clock.h" | 15 #include "base/time/default_clock.h" |
| 16 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 16 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 17 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
| 18 #include "chrome/browser/favicon/large_icon_service_factory.h" | 18 #include "chrome/browser/favicon/large_icon_service_factory.h" |
| 19 #include "chrome/browser/gcm/gcm_profile_service_factory.h" |
| 20 #include "chrome/browser/gcm/instance_id/instance_id_profile_service.h" |
| 21 #include "chrome/browser/gcm/instance_id/instance_id_profile_service_factory.h" |
| 19 #include "chrome/browser/history/history_service_factory.h" | 22 #include "chrome/browser/history/history_service_factory.h" |
| 20 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
| 21 #include "chrome/browser/search/suggestions/image_decoder_impl.h" | 24 #include "chrome/browser/search/suggestions/image_decoder_impl.h" |
| 22 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 25 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 23 #include "chrome/browser/signin/signin_manager_factory.h" | 26 #include "chrome/browser/signin/signin_manager_factory.h" |
| 24 #include "chrome/browser/sync/profile_sync_service_factory.h" | 27 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 25 #include "chrome/browser/translate/language_model_factory.h" | 28 #include "chrome/browser/translate/language_model_factory.h" |
| 26 #include "chrome/common/channel_info.h" | 29 #include "chrome/common/channel_info.h" |
| 27 #include "chrome/common/chrome_features.h" | 30 #include "chrome/common/chrome_features.h" |
| 28 #include "chrome/common/pref_names.h" | 31 #include "chrome/common/pref_names.h" |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 DependsOn(BookmarkModelFactory::GetInstance()); | 302 DependsOn(BookmarkModelFactory::GetInstance()); |
| 300 DependsOn(HistoryServiceFactory::GetInstance()); | 303 DependsOn(HistoryServiceFactory::GetInstance()); |
| 301 DependsOn(LargeIconServiceFactory::GetInstance()); | 304 DependsOn(LargeIconServiceFactory::GetInstance()); |
| 302 #if BUILDFLAG(ENABLE_OFFLINE_PAGES) | 305 #if BUILDFLAG(ENABLE_OFFLINE_PAGES) |
| 303 DependsOn(OfflinePageModelFactory::GetInstance()); | 306 DependsOn(OfflinePageModelFactory::GetInstance()); |
| 304 DependsOn(offline_pages::PrefetchServiceFactory::GetInstance()); | 307 DependsOn(offline_pages::PrefetchServiceFactory::GetInstance()); |
| 305 #endif // BUILDFLAG(ENABLE_OFFLINE_PAGES) | 308 #endif // BUILDFLAG(ENABLE_OFFLINE_PAGES) |
| 306 DependsOn(ProfileOAuth2TokenServiceFactory::GetInstance()); | 309 DependsOn(ProfileOAuth2TokenServiceFactory::GetInstance()); |
| 307 DependsOn(ProfileSyncServiceFactory::GetInstance()); | 310 DependsOn(ProfileSyncServiceFactory::GetInstance()); |
| 308 DependsOn(SigninManagerFactory::GetInstance()); | 311 DependsOn(SigninManagerFactory::GetInstance()); |
| 312 #if defined(OS_ANDROID) |
| 313 DependsOn(gcm::GCMProfileServiceFactory::GetInstance()); |
| 314 DependsOn(instance_id::InstanceIDProfileServiceFactory::GetInstance()); |
| 315 #endif // defined(OS_ANDROID) |
| 309 } | 316 } |
| 310 | 317 |
| 311 ContentSuggestionsServiceFactory::~ContentSuggestionsServiceFactory() = default; | 318 ContentSuggestionsServiceFactory::~ContentSuggestionsServiceFactory() = default; |
| 312 | 319 |
| 313 KeyedService* ContentSuggestionsServiceFactory::BuildServiceInstanceFor( | 320 KeyedService* ContentSuggestionsServiceFactory::BuildServiceInstanceFor( |
| 314 content::BrowserContext* context) const { | 321 content::BrowserContext* context) const { |
| 315 #if CONTENT_SUGGESTIONS_ENABLED | 322 #if CONTENT_SUGGESTIONS_ENABLED |
| 316 | 323 |
| 317 using State = ContentSuggestionsService::State; | 324 using State = ContentSuggestionsService::State; |
| 318 Profile* profile = Profile::FromBrowserContext(context); | 325 Profile* profile = Profile::FromBrowserContext(context); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 ProfileSyncServiceFactory::GetSyncServiceForBrowserContext(profile); | 424 ProfileSyncServiceFactory::GetSyncServiceForBrowserContext(profile); |
| 418 RegisterForeignSessionsProvider(sync_service, service, pref_service); | 425 RegisterForeignSessionsProvider(sync_service, service, pref_service); |
| 419 } | 426 } |
| 420 | 427 |
| 421 return service; | 428 return service; |
| 422 | 429 |
| 423 #else | 430 #else |
| 424 return nullptr; | 431 return nullptr; |
| 425 #endif // CONTENT_SUGGESTIONS_ENABLED | 432 #endif // CONTENT_SUGGESTIONS_ENABLED |
| 426 } | 433 } |
| OLD | NEW |