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

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

Issue 2187233002: Add ContentSuggestionsCategoryFactory; Store categories as ints (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Document remote categories order 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
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 "chrome/browser/ntp_snippets/ntp_snippets_service_factory.h" 5 #include "chrome/browser/ntp_snippets/ntp_snippets_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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 profile->GetPath().Append(ntp_snippets::kDatabaseFolder)); 114 profile->GetPath().Append(ntp_snippets::kDatabaseFolder));
115 scoped_refptr<base::SequencedTaskRunner> task_runner = 115 scoped_refptr<base::SequencedTaskRunner> task_runner =
116 BrowserThread::GetBlockingPool() 116 BrowserThread::GetBlockingPool()
117 ->GetSequencedTaskRunnerWithShutdownBehavior( 117 ->GetSequencedTaskRunnerWithShutdownBehavior(
118 base::SequencedWorkerPool::GetSequenceToken(), 118 base::SequencedWorkerPool::GetSequenceToken(),
119 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN); 119 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN);
120 120
121 ntp_snippets::NTPSnippetsService* ntp_snippets_service = 121 ntp_snippets::NTPSnippetsService* ntp_snippets_service =
122 new ntp_snippets::NTPSnippetsService( 122 new ntp_snippets::NTPSnippetsService(
123 enabled, profile->GetPrefs(), suggestions_service, 123 enabled, profile->GetPrefs(), suggestions_service,
124 content_suggestions_service->category_factory(),
124 g_browser_process->GetApplicationLocale(), scheduler, 125 g_browser_process->GetApplicationLocale(), scheduler,
125 base::MakeUnique<ntp_snippets::NTPSnippetsFetcher>( 126 base::MakeUnique<ntp_snippets::NTPSnippetsFetcher>(
126 signin_manager, token_service, request_context, 127 signin_manager, token_service, request_context,
127 profile->GetPrefs(), 128 profile->GetPrefs(),
128 base::Bind(&safe_json::SafeJsonParser::Parse), 129 base::Bind(&safe_json::SafeJsonParser::Parse),
129 chrome::GetChannel() == version_info::Channel::STABLE), 130 chrome::GetChannel() == version_info::Channel::STABLE),
130 base::MakeUnique<ImageFetcherImpl>( 131 base::MakeUnique<ImageFetcherImpl>(
131 base::MakeUnique<ImageDecoderImpl>(), request_context.get()), 132 base::MakeUnique<ImageDecoderImpl>(), request_context.get()),
132 base::MakeUnique<ImageDecoderImpl>(), 133 base::MakeUnique<ImageDecoderImpl>(),
133 base::MakeUnique<ntp_snippets::NTPSnippetsDatabase>(database_dir, 134 base::MakeUnique<ntp_snippets::NTPSnippetsDatabase>(database_dir,
134 task_runner), 135 task_runner),
135 base::MakeUnique<ntp_snippets::NTPSnippetsStatusService>( 136 base::MakeUnique<ntp_snippets::NTPSnippetsStatusService>(
136 signin_manager, sync_service, profile->GetPrefs())); 137 signin_manager, sync_service, profile->GetPrefs()));
137 138
138 if (content_suggestions_service->state() == 139 if (content_suggestions_service->state() ==
139 ContentSuggestionsService::State::ENABLED) { 140 ContentSuggestionsService::State::ENABLED) {
140 content_suggestions_service->RegisterProvider(ntp_snippets_service); 141 content_suggestions_service->RegisterProvider(ntp_snippets_service);
141 } 142 }
142 return ntp_snippets_service; 143 return ntp_snippets_service;
143 } 144 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698