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

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

Issue 2519053002: 📰 Let the backend trigger sign in related refreshes (Closed)
Patch Set: Fix iOS build Created 4 years 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
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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 content::BrowserContext* context) const { 233 content::BrowserContext* context) const {
234 using State = ContentSuggestionsService::State; 234 using State = ContentSuggestionsService::State;
235 Profile* profile = Profile::FromBrowserContext(context); 235 Profile* profile = Profile::FromBrowserContext(context);
236 DCHECK(!profile->IsOffTheRecord()); 236 DCHECK(!profile->IsOffTheRecord());
237 237
238 // Create the ContentSuggestionsService. 238 // Create the ContentSuggestionsService.
239 State state = 239 State state =
240 base::FeatureList::IsEnabled(ntp_snippets::kContentSuggestionsFeature) 240 base::FeatureList::IsEnabled(ntp_snippets::kContentSuggestionsFeature)
241 ? State::ENABLED 241 ? State::ENABLED
242 : State::DISABLED; 242 : State::DISABLED;
243 SigninManagerBase* signin_manager =
244 SigninManagerFactory::GetForProfile(profile);
243 HistoryService* history_service = HistoryServiceFactory::GetForProfile( 245 HistoryService* history_service = HistoryServiceFactory::GetForProfile(
244 profile, ServiceAccessType::EXPLICIT_ACCESS); 246 profile, ServiceAccessType::EXPLICIT_ACCESS);
245 PrefService* pref_service = profile->GetPrefs(); 247 PrefService* pref_service = profile->GetPrefs();
246 ContentSuggestionsService* service = 248 ContentSuggestionsService* service = new ContentSuggestionsService(
247 new ContentSuggestionsService(state, history_service, pref_service); 249 state, signin_manager, history_service, pref_service);
248 if (state == State::DISABLED) { 250 if (state == State::DISABLED) {
249 // Since we won't initialise the services, they won't get a chance to 251 // Since we won't initialise the services, they won't get a chance to
250 // unschedule their tasks. We do it explicitly here instead. 252 // unschedule their tasks. We do it explicitly here instead.
251 ClearScheduledTasks(); 253 ClearScheduledTasks();
252 return service; 254 return service;
253 } 255 }
254 256
255 CategoryFactory* category_factory = service->category_factory(); 257 CategoryFactory* category_factory = service->category_factory();
256 #if defined(OS_ANDROID) 258 #if defined(OS_ANDROID)
257 OfflinePageModel* offline_page_model = 259 OfflinePageModel* offline_page_model =
258 OfflinePageModelFactory::GetForBrowserContext(profile); 260 OfflinePageModelFactory::GetForBrowserContext(profile);
259 DownloadManager* download_manager = 261 DownloadManager* download_manager =
260 content::BrowserContext::GetDownloadManager(profile); 262 content::BrowserContext::GetDownloadManager(profile);
261 #endif // OS_ANDROID 263 #endif // OS_ANDROID
262 BookmarkModel* bookmark_model = 264 BookmarkModel* bookmark_model =
263 BookmarkModelFactory::GetForBrowserContext(profile); 265 BookmarkModelFactory::GetForBrowserContext(profile);
264 SigninManagerBase* signin_manager =
265 SigninManagerFactory::GetForProfile(profile);
266 OAuth2TokenService* token_service = 266 OAuth2TokenService* token_service =
267 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); 267 ProfileOAuth2TokenServiceFactory::GetForProfile(profile);
268 SyncService* sync_service = 268 SyncService* sync_service =
269 ProfileSyncServiceFactory::GetSyncServiceForBrowserContext(profile); 269 ProfileSyncServiceFactory::GetSyncServiceForBrowserContext(profile);
270 LanguageModel* language_model = 270 LanguageModel* language_model =
271 LanguageModelFactory::GetInstance()->GetForBrowserContext(profile); 271 LanguageModelFactory::GetInstance()->GetForBrowserContext(profile);
272 272
273 #if defined(OS_ANDROID) 273 #if defined(OS_ANDROID)
274 if (base::FeatureList::IsEnabled( 274 if (base::FeatureList::IsEnabled(
275 ntp_snippets::kRecentOfflineTabSuggestionsFeature)) { 275 ntp_snippets::kRecentOfflineTabSuggestionsFeature)) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 } 310 }
311 311
312 if (base::FeatureList::IsEnabled( 312 if (base::FeatureList::IsEnabled(
313 ntp_snippets::kForeignSessionsSuggestionsFeature)) { 313 ntp_snippets::kForeignSessionsSuggestionsFeature)) {
314 RegisterForeignSessionsProvider(sync_service, service, category_factory, 314 RegisterForeignSessionsProvider(sync_service, service, category_factory,
315 pref_service); 315 pref_service);
316 } 316 }
317 317
318 return service; 318 return service;
319 } 319 }
OLDNEW
« no previous file with comments | « chrome/browser/android/ntp/ntp_snippets_bridge.cc ('k') | chrome/browser/ui/webui/snippets_internals_message_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698