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

Side by Side Diff: chrome/browser/ntp_snippets/content_suggestions_service_factory.cc

Issue 2614733002: [NTP::PhysicalWeb] Enable by default and depend on physical web flag. (Closed)
Patch Set: clean rebase. Created 3 years, 11 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 | chrome/browser/resources/snippets_internals.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 133
134 void RegisterBookmarkProvider(BookmarkModel* bookmark_model, 134 void RegisterBookmarkProvider(BookmarkModel* bookmark_model,
135 ContentSuggestionsService* service, 135 ContentSuggestionsService* service,
136 PrefService* pref_service) { 136 PrefService* pref_service) {
137 auto provider = base::MakeUnique<BookmarkSuggestionsProvider>( 137 auto provider = base::MakeUnique<BookmarkSuggestionsProvider>(
138 service, bookmark_model, pref_service); 138 service, bookmark_model, pref_service);
139 service->RegisterProvider(std::move(provider)); 139 service->RegisterProvider(std::move(provider));
140 } 140 }
141 141
142 #if defined(OS_ANDROID) 142 #if defined(OS_ANDROID)
143
144 bool IsPhysicalWebPageProviderEnabled() {
145 return base::FeatureList::IsEnabled(
146 ntp_snippets::kPhysicalWebPageSuggestionsFeature) &&
147 base::FeatureList::IsEnabled(chrome::android::kPhysicalWebFeature);
148 }
149
143 void RegisterPhysicalWebPageProvider( 150 void RegisterPhysicalWebPageProvider(
144 ContentSuggestionsService* service, 151 ContentSuggestionsService* service,
145 PhysicalWebDataSource* physical_web_data_source, 152 PhysicalWebDataSource* physical_web_data_source,
146 PrefService* pref_service) { 153 PrefService* pref_service) {
147 auto provider = base::MakeUnique<PhysicalWebPageSuggestionsProvider>( 154 auto provider = base::MakeUnique<PhysicalWebPageSuggestionsProvider>(
148 service, physical_web_data_source, pref_service); 155 service, physical_web_data_source, pref_service);
149 service->RegisterProvider(std::move(provider)); 156 service->RegisterProvider(std::move(provider));
150 } 157 }
151 #endif // OS_ANDROID 158 #endif // OS_ANDROID
152 159
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 } 317 }
311 #endif // OS_ANDROID 318 #endif // OS_ANDROID
312 319
313 // |bookmark_model| can be null in tests. 320 // |bookmark_model| can be null in tests.
314 if (base::FeatureList::IsEnabled(ntp_snippets::kBookmarkSuggestionsFeature) && 321 if (base::FeatureList::IsEnabled(ntp_snippets::kBookmarkSuggestionsFeature) &&
315 bookmark_model) { 322 bookmark_model) {
316 RegisterBookmarkProvider(bookmark_model, service, pref_service); 323 RegisterBookmarkProvider(bookmark_model, service, pref_service);
317 } 324 }
318 325
319 #if defined(OS_ANDROID) 326 #if defined(OS_ANDROID)
320 if (base::FeatureList::IsEnabled( 327 if (IsPhysicalWebPageProviderEnabled()) {
321 ntp_snippets::kPhysicalWebPageSuggestionsFeature)) {
322 RegisterPhysicalWebPageProvider(service, physical_web_data_source, 328 RegisterPhysicalWebPageProvider(service, physical_web_data_source,
323 pref_service); 329 pref_service);
324 } 330 }
325 #endif // OS_ANDROID 331 #endif // OS_ANDROID
326 332
327 if (base::FeatureList::IsEnabled(ntp_snippets::kArticleSuggestionsFeature)) { 333 if (base::FeatureList::IsEnabled(ntp_snippets::kArticleSuggestionsFeature)) {
328 RegisterArticleProvider(signin_manager, token_service, service, 334 RegisterArticleProvider(signin_manager, token_service, service,
329 language_model, pref_service, profile); 335 language_model, pref_service, profile);
330 } 336 }
331 337
332 if (base::FeatureList::IsEnabled( 338 if (base::FeatureList::IsEnabled(
333 ntp_snippets::kForeignSessionsSuggestionsFeature)) { 339 ntp_snippets::kForeignSessionsSuggestionsFeature)) {
334 RegisterForeignSessionsProvider(sync_service, service, pref_service); 340 RegisterForeignSessionsProvider(sync_service, service, pref_service);
335 } 341 }
336 342
337 return service; 343 return service;
338 } 344 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/snippets_internals.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698