Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: ios/chrome/browser/ntp_snippets/ios_chrome_content_suggestions_service_factory.cc

Issue 2805703002: Remove the bookmark provider from ContentSuggestions (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "ios/chrome/browser/ntp_snippets/ios_chrome_content_suggestions_service _factory.h" 5 #include "ios/chrome/browser/ntp_snippets/ios_chrome_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/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 chrome_browser_state); 147 chrome_browser_state);
148 std::unique_ptr<ntp_snippets::CategoryRanker> category_ranker = 148 std::unique_ptr<ntp_snippets::CategoryRanker> category_ranker =
149 ntp_snippets::BuildSelectedCategoryRanker( 149 ntp_snippets::BuildSelectedCategoryRanker(
150 prefs, base::MakeUnique<base::DefaultClock>()); 150 prefs, base::MakeUnique<base::DefaultClock>());
151 std::unique_ptr<ContentSuggestionsService> service = 151 std::unique_ptr<ContentSuggestionsService> service =
152 base::MakeUnique<ContentSuggestionsService>( 152 base::MakeUnique<ContentSuggestionsService>(
153 State::ENABLED, signin_manager, history_service, large_icon_service, 153 State::ENABLED, signin_manager, history_service, large_icon_service,
154 prefs, std::move(category_ranker), std::move(user_classifier), 154 prefs, std::move(category_ranker), std::move(user_classifier),
155 std::move(scheduler)); 155 std::move(scheduler));
156 156
157 // Create the BookmarkSuggestionsProvider.
158 if (base::FeatureList::IsEnabled(ntp_snippets::kBookmarkSuggestionsFeature)) {
159 BookmarkModel* bookmark_model =
160 BookmarkModelFactory::GetForBrowserState(chrome_browser_state);
161 std::unique_ptr<BookmarkSuggestionsProvider> bookmark_suggestions_provider =
162 base::MakeUnique<BookmarkSuggestionsProvider>(service.get(),
163 bookmark_model, prefs);
164 service->RegisterProvider(std::move(bookmark_suggestions_provider));
165 }
166
167 // Create the ReadingListSuggestionsProvider. 157 // Create the ReadingListSuggestionsProvider.
168 ReadingListModel* reading_list_model = 158 ReadingListModel* reading_list_model =
169 ReadingListModelFactory::GetForBrowserState(chrome_browser_state); 159 ReadingListModelFactory::GetForBrowserState(chrome_browser_state);
170 std::unique_ptr<ntp_snippets::ReadingListSuggestionsProvider> 160 std::unique_ptr<ntp_snippets::ReadingListSuggestionsProvider>
171 reading_list_suggestions_provider = 161 reading_list_suggestions_provider =
172 base::MakeUnique<ntp_snippets::ReadingListSuggestionsProvider>( 162 base::MakeUnique<ntp_snippets::ReadingListSuggestionsProvider>(
173 service.get(), reading_list_model); 163 service.get(), reading_list_model);
174 service->RegisterProvider(std::move(reading_list_suggestions_provider)); 164 service->RegisterProvider(std::move(reading_list_suggestions_provider));
175 165
176 if (base::FeatureList::IsEnabled(ntp_snippets::kArticleSuggestionsFeature)) { 166 if (base::FeatureList::IsEnabled(ntp_snippets::kArticleSuggestionsFeature)) {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 prefs)); 202 prefs));
213 203
214 service->remote_suggestions_scheduler()->SetProvider(provider.get()); 204 service->remote_suggestions_scheduler()->SetProvider(provider.get());
215 service->set_remote_suggestions_provider(provider.get()); 205 service->set_remote_suggestions_provider(provider.get());
216 service->RegisterProvider(std::move(provider)); 206 service->RegisterProvider(std::move(provider));
217 } 207 }
218 208
219 // TODO(crbug.com/703565): remove std::move() once Xcode 9.0+ is required. 209 // TODO(crbug.com/703565): remove std::move() once Xcode 9.0+ is required.
220 return std::move(service); 210 return std::move(service);
221 } 211 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698