| 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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 DependsOn(BookmarkModelFactory::GetInstance()); | 390 DependsOn(BookmarkModelFactory::GetInstance()); |
| 388 DependsOn(HistoryServiceFactory::GetInstance()); | 391 DependsOn(HistoryServiceFactory::GetInstance()); |
| 389 DependsOn(LargeIconServiceFactory::GetInstance()); | 392 DependsOn(LargeIconServiceFactory::GetInstance()); |
| 390 #if BUILDFLAG(ENABLE_OFFLINE_PAGES) | 393 #if BUILDFLAG(ENABLE_OFFLINE_PAGES) |
| 391 DependsOn(OfflinePageModelFactory::GetInstance()); | 394 DependsOn(OfflinePageModelFactory::GetInstance()); |
| 392 DependsOn(offline_pages::PrefetchServiceFactory::GetInstance()); | 395 DependsOn(offline_pages::PrefetchServiceFactory::GetInstance()); |
| 393 #endif // BUILDFLAG(ENABLE_OFFLINE_PAGES) | 396 #endif // BUILDFLAG(ENABLE_OFFLINE_PAGES) |
| 394 DependsOn(ProfileOAuth2TokenServiceFactory::GetInstance()); | 397 DependsOn(ProfileOAuth2TokenServiceFactory::GetInstance()); |
| 395 DependsOn(ProfileSyncServiceFactory::GetInstance()); | 398 DependsOn(ProfileSyncServiceFactory::GetInstance()); |
| 396 DependsOn(SigninManagerFactory::GetInstance()); | 399 DependsOn(SigninManagerFactory::GetInstance()); |
| 400 #if defined(OS_ANDROID) |
| 401 DependsOn(gcm::GCMProfileServiceFactory::GetInstance()); |
| 402 DependsOn(instance_id::InstanceIDProfileServiceFactory::GetInstance()); |
| 403 #endif // defined(OS_ANDROID) |
| 397 } | 404 } |
| 398 | 405 |
| 399 ContentSuggestionsServiceFactory::~ContentSuggestionsServiceFactory() = default; | 406 ContentSuggestionsServiceFactory::~ContentSuggestionsServiceFactory() = default; |
| 400 | 407 |
| 401 KeyedService* ContentSuggestionsServiceFactory::BuildServiceInstanceFor( | 408 KeyedService* ContentSuggestionsServiceFactory::BuildServiceInstanceFor( |
| 402 content::BrowserContext* context) const { | 409 content::BrowserContext* context) const { |
| 403 #if CONTENT_SUGGESTIONS_ENABLED | 410 #if CONTENT_SUGGESTIONS_ENABLED |
| 404 | 411 |
| 405 using State = ContentSuggestionsService::State; | 412 using State = ContentSuggestionsService::State; |
| 406 Profile* profile = Profile::FromBrowserContext(context); | 413 Profile* profile = Profile::FromBrowserContext(context); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 observer->SetContentSuggestionsServiceAndObserve(service); | 469 observer->SetContentSuggestionsServiceAndObserve(service); |
| 463 } | 470 } |
| 464 #endif | 471 #endif |
| 465 | 472 |
| 466 return service; | 473 return service; |
| 467 | 474 |
| 468 #else | 475 #else |
| 469 return nullptr; | 476 return nullptr; |
| 470 #endif // CONTENT_SUGGESTIONS_ENABLED | 477 #endif // CONTENT_SUGGESTIONS_ENABLED |
| 471 } | 478 } |
| OLD | NEW |