| 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 "base/feature_list.h" | 7 #include "base/feature_list.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 base::FeatureList::IsEnabled(ntp_snippets::kContentSuggestionsFeature) | 105 base::FeatureList::IsEnabled(ntp_snippets::kContentSuggestionsFeature) |
| 106 ? State::ENABLED | 106 ? State::ENABLED |
| 107 : State::DISABLED; | 107 : State::DISABLED; |
| 108 ContentSuggestionsService* service = new ContentSuggestionsService(state); | 108 ContentSuggestionsService* service = new ContentSuggestionsService(state); |
| 109 if (state == State::DISABLED) | 109 if (state == State::DISABLED) |
| 110 return service; | 110 return service; |
| 111 | 111 |
| 112 #if defined(OS_ANDROID) | 112 #if defined(OS_ANDROID) |
| 113 // Create the OfflinePageSuggestionsProvider. | 113 // Create the OfflinePageSuggestionsProvider. |
| 114 if (base::FeatureList::IsEnabled( | 114 if (base::FeatureList::IsEnabled( |
| 115 chrome::android::kNTPOfflinePageSuggestionsFeature)) { | 115 ntp_snippets::kOfflinePageSuggestionsFeature)) { |
| 116 OfflinePageModel* offline_page_model = | 116 OfflinePageModel* offline_page_model = |
| 117 OfflinePageModelFactory::GetForBrowserContext(profile); | 117 OfflinePageModelFactory::GetForBrowserContext(profile); |
| 118 | 118 |
| 119 std::unique_ptr<OfflinePageSuggestionsProvider> | 119 std::unique_ptr<OfflinePageSuggestionsProvider> |
| 120 offline_page_suggestions_provider = | 120 offline_page_suggestions_provider = |
| 121 base::MakeUnique<OfflinePageSuggestionsProvider>( | 121 base::MakeUnique<OfflinePageSuggestionsProvider>( |
| 122 service, service->category_factory(), offline_page_model); | 122 service, service->category_factory(), offline_page_model); |
| 123 service->RegisterProvider(std::move(offline_page_suggestions_provider)); | 123 service->RegisterProvider(std::move(offline_page_suggestions_provider)); |
| 124 } | 124 } |
| 125 #endif // OS_ANDROID | 125 #endif // OS_ANDROID |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 base::MakeUnique<ImageDecoderImpl>(), | 174 base::MakeUnique<ImageDecoderImpl>(), |
| 175 base::MakeUnique<NTPSnippetsDatabase>(database_dir, task_runner), | 175 base::MakeUnique<NTPSnippetsDatabase>(database_dir, task_runner), |
| 176 base::MakeUnique<NTPSnippetsStatusService>(signin_manager, | 176 base::MakeUnique<NTPSnippetsStatusService>(signin_manager, |
| 177 profile->GetPrefs())); | 177 profile->GetPrefs())); |
| 178 service->set_ntp_snippets_service(ntp_snippets_service.get()); | 178 service->set_ntp_snippets_service(ntp_snippets_service.get()); |
| 179 service->RegisterProvider(std::move(ntp_snippets_service)); | 179 service->RegisterProvider(std::move(ntp_snippets_service)); |
| 180 } | 180 } |
| 181 | 181 |
| 182 return service; | 182 return service; |
| 183 } | 183 } |
| OLD | NEW |