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

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

Issue 2245583002: Split OfflinePageSuggestions into two categories (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@offlinedismissed
Patch Set: Remove more-button for Recent Tabs Created 4 years, 4 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 | « chrome/browser/about_flags.cc ('k') | 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 "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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 ContentSuggestionsService* service = new ContentSuggestionsService(state); 119 ContentSuggestionsService* service = new ContentSuggestionsService(state);
120 if (state == State::DISABLED) { 120 if (state == State::DISABLED) {
121 // Since we won't initialise the services, they won't get a chance to 121 // Since we won't initialise the services, they won't get a chance to
122 // unschedule their tasks. We do it explicitly here instead. 122 // unschedule their tasks. We do it explicitly here instead.
123 ClearScheduledTasks(); 123 ClearScheduledTasks();
124 return service; 124 return service;
125 } 125 }
126 126
127 #if defined(OS_ANDROID) 127 #if defined(OS_ANDROID)
128 // Create the OfflinePageSuggestionsProvider. 128 // Create the OfflinePageSuggestionsProvider.
129 if (base::FeatureList::IsEnabled( 129 bool recent_tabs_enabled = base::FeatureList::IsEnabled(
130 ntp_snippets::kOfflinePageSuggestionsFeature)) { 130 ntp_snippets::kRecentOfflineTabSuggestionsFeature);
131 bool downloads_enabled =
132 base::FeatureList::IsEnabled(ntp_snippets::kDownloadSuggestionsFeature);
133 bool download_manager_ui_enabled =
134 base::FeatureList::IsEnabled(chrome::android::kDownloadsUiFeature);
135 if (recent_tabs_enabled || downloads_enabled) {
131 OfflinePageModel* offline_page_model = 136 OfflinePageModel* offline_page_model =
132 OfflinePageModelFactory::GetForBrowserContext(profile); 137 OfflinePageModelFactory::GetForBrowserContext(profile);
133 138
134 std::unique_ptr<OfflinePageSuggestionsProvider> 139 std::unique_ptr<OfflinePageSuggestionsProvider>
135 offline_page_suggestions_provider = 140 offline_page_suggestions_provider =
136 base::MakeUnique<OfflinePageSuggestionsProvider>( 141 base::MakeUnique<OfflinePageSuggestionsProvider>(
137 service, service->category_factory(), offline_page_model, 142 recent_tabs_enabled, downloads_enabled,
143 download_manager_ui_enabled, service,
144 service->category_factory(), offline_page_model,
138 profile->GetPrefs()); 145 profile->GetPrefs());
139 service->RegisterProvider(std::move(offline_page_suggestions_provider)); 146 service->RegisterProvider(std::move(offline_page_suggestions_provider));
140 } 147 }
141 #endif // OS_ANDROID 148 #endif // OS_ANDROID
142 149
143 // Create the BookmarkSuggestionsProvider. 150 // Create the BookmarkSuggestionsProvider.
144 if (base::FeatureList::IsEnabled( 151 if (base::FeatureList::IsEnabled(
145 ntp_snippets::kBookmarkSuggestionsFeature)) { 152 ntp_snippets::kBookmarkSuggestionsFeature)) {
146 BookmarkModel* bookmark_model = 153 BookmarkModel* bookmark_model =
147 BookmarkModelFactory::GetForBrowserContext(profile); 154 BookmarkModelFactory::GetForBrowserContext(profile);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 base::MakeUnique<ImageDecoderImpl>(), 196 base::MakeUnique<ImageDecoderImpl>(),
190 base::MakeUnique<NTPSnippetsDatabase>(database_dir, task_runner), 197 base::MakeUnique<NTPSnippetsDatabase>(database_dir, task_runner),
191 base::MakeUnique<NTPSnippetsStatusService>(signin_manager, 198 base::MakeUnique<NTPSnippetsStatusService>(signin_manager,
192 profile->GetPrefs())); 199 profile->GetPrefs()));
193 service->set_ntp_snippets_service(ntp_snippets_service.get()); 200 service->set_ntp_snippets_service(ntp_snippets_service.get());
194 service->RegisterProvider(std::move(ntp_snippets_service)); 201 service->RegisterProvider(std::move(ntp_snippets_service));
195 } 202 }
196 203
197 return service; 204 return service;
198 } 205 }
OLDNEW
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | chrome/browser/resources/snippets_internals.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698