| 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/threading/sequenced_worker_pool.h" | 13 #include "base/threading/sequenced_worker_pool.h" |
| 14 #include "base/time/default_clock.h" | 14 #include "base/time/default_clock.h" |
| 15 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 15 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 16 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
| 17 #include "chrome/browser/history/history_service_factory.h" | 17 #include "chrome/browser/history/history_service_factory.h" |
| 18 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
| 19 #include "chrome/browser/search/suggestions/image_decoder_impl.h" | |
| 20 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 19 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 21 #include "chrome/browser/signin/signin_manager_factory.h" | 20 #include "chrome/browser/signin/signin_manager_factory.h" |
| 22 #include "chrome/browser/sync/profile_sync_service_factory.h" | 21 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 23 #include "chrome/browser/translate/language_model_factory.h" | 22 #include "chrome/browser/translate/language_model_factory.h" |
| 24 #include "chrome/common/channel_info.h" | 23 #include "chrome/common/channel_info.h" |
| 25 #include "chrome/common/chrome_features.h" | 24 #include "chrome/common/chrome_features.h" |
| 26 #include "components/bookmarks/browser/bookmark_model.h" | 25 #include "components/bookmarks/browser/bookmark_model.h" |
| 27 #include "components/browser_sync/profile_sync_service.h" | 26 #include "components/browser_sync/profile_sync_service.h" |
| 27 #include "components/image_fetcher/content/image_decoder_impl.h" |
| 28 #include "components/image_fetcher/core/image_decoder.h" | 28 #include "components/image_fetcher/core/image_decoder.h" |
| 29 #include "components/image_fetcher/core/image_fetcher.h" | 29 #include "components/image_fetcher/core/image_fetcher.h" |
| 30 #include "components/image_fetcher/core/image_fetcher_impl.h" | 30 #include "components/image_fetcher/core/image_fetcher_impl.h" |
| 31 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 31 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 32 #include "components/keyed_service/core/service_access_type.h" | 32 #include "components/keyed_service/core/service_access_type.h" |
| 33 #include "components/ntp_snippets/bookmarks/bookmark_suggestions_provider.h" | 33 #include "components/ntp_snippets/bookmarks/bookmark_suggestions_provider.h" |
| 34 #include "components/ntp_snippets/category_rankers/category_ranker.h" | 34 #include "components/ntp_snippets/category_rankers/category_ranker.h" |
| 35 #include "components/ntp_snippets/content_suggestions_service.h" | 35 #include "components/ntp_snippets/content_suggestions_service.h" |
| 36 #include "components/ntp_snippets/features.h" | 36 #include "components/ntp_snippets/features.h" |
| 37 #include "components/ntp_snippets/ntp_snippets_constants.h" | 37 #include "components/ntp_snippets/ntp_snippets_constants.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 using offline_pages::OfflinePageModel; | 78 using offline_pages::OfflinePageModel; |
| 79 using offline_pages::RequestCoordinator; | 79 using offline_pages::RequestCoordinator; |
| 80 using offline_pages::OfflinePageModelFactory; | 80 using offline_pages::OfflinePageModelFactory; |
| 81 using offline_pages::RequestCoordinatorFactory; | 81 using offline_pages::RequestCoordinatorFactory; |
| 82 using physical_web::PhysicalWebDataSource; | 82 using physical_web::PhysicalWebDataSource; |
| 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::ImageDecoderImpl; |
| 88 using image_fetcher::ImageFetcherImpl; | 89 using image_fetcher::ImageFetcherImpl; |
| 89 using ntp_snippets::BookmarkSuggestionsProvider; | 90 using ntp_snippets::BookmarkSuggestionsProvider; |
| 90 using ntp_snippets::CategoryRanker; | 91 using ntp_snippets::CategoryRanker; |
| 91 using ntp_snippets::ContentSuggestionsService; | 92 using ntp_snippets::ContentSuggestionsService; |
| 92 using ntp_snippets::ForeignSessionsSuggestionsProvider; | 93 using ntp_snippets::ForeignSessionsSuggestionsProvider; |
| 93 using ntp_snippets::GetFetchEndpoint; | 94 using ntp_snippets::GetFetchEndpoint; |
| 94 using ntp_snippets::PersistentScheduler; | 95 using ntp_snippets::PersistentScheduler; |
| 95 using ntp_snippets::RemoteSuggestionsDatabase; | 96 using ntp_snippets::RemoteSuggestionsDatabase; |
| 96 using ntp_snippets::RemoteSuggestionsFetcher; | 97 using ntp_snippets::RemoteSuggestionsFetcher; |
| 97 using ntp_snippets::RemoteSuggestionsProviderImpl; | 98 using ntp_snippets::RemoteSuggestionsProviderImpl; |
| 98 using ntp_snippets::RemoteSuggestionsStatusService; | 99 using ntp_snippets::RemoteSuggestionsStatusService; |
| 99 using ntp_snippets::SchedulingRemoteSuggestionsProvider; | 100 using ntp_snippets::SchedulingRemoteSuggestionsProvider; |
| 100 using ntp_snippets::TabDelegateSyncAdapter; | 101 using ntp_snippets::TabDelegateSyncAdapter; |
| 101 using suggestions::ImageDecoderImpl; | |
| 102 using syncer::SyncService; | 102 using syncer::SyncService; |
| 103 using translate::LanguageModel; | 103 using translate::LanguageModel; |
| 104 | 104 |
| 105 // For now, ContentSuggestionsService must only be instantiated on Android. | 105 // For now, ContentSuggestionsService must only be instantiated on Android. |
| 106 // See also crbug.com/688366. | 106 // See also crbug.com/688366. |
| 107 #if defined(OS_ANDROID) | 107 #if defined(OS_ANDROID) |
| 108 #define CONTENT_SUGGESTIONS_ENABLED 1 | 108 #define CONTENT_SUGGESTIONS_ENABLED 1 |
| 109 #else | 109 #else |
| 110 #define CONTENT_SUGGESTIONS_ENABLED 0 | 110 #define CONTENT_SUGGESTIONS_ENABLED 0 |
| 111 #endif // OS_ANDROID | 111 #endif // OS_ANDROID |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 ntp_snippets::kForeignSessionsSuggestionsFeature)) { | 365 ntp_snippets::kForeignSessionsSuggestionsFeature)) { |
| 366 RegisterForeignSessionsProvider(sync_service, service, pref_service); | 366 RegisterForeignSessionsProvider(sync_service, service, pref_service); |
| 367 } | 367 } |
| 368 | 368 |
| 369 return service; | 369 return service; |
| 370 | 370 |
| 371 #else | 371 #else |
| 372 return nullptr; | 372 return nullptr; |
| 373 #endif // CONTENT_SUGGESTIONS_ENABLED | 373 #endif // CONTENT_SUGGESTIONS_ENABLED |
| 374 } | 374 } |
| OLD | NEW |