OLD | NEW |
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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 profile->GetPath().Append(ntp_snippets::kDatabaseFolder)); | 109 profile->GetPath().Append(ntp_snippets::kDatabaseFolder)); |
110 scoped_refptr<base::SequencedTaskRunner> task_runner = | 110 scoped_refptr<base::SequencedTaskRunner> task_runner = |
111 BrowserThread::GetBlockingPool() | 111 BrowserThread::GetBlockingPool() |
112 ->GetSequencedTaskRunnerWithShutdownBehavior( | 112 ->GetSequencedTaskRunnerWithShutdownBehavior( |
113 base::SequencedWorkerPool::GetSequenceToken(), | 113 base::SequencedWorkerPool::GetSequenceToken(), |
114 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN); | 114 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN); |
115 | 115 |
116 ntp_snippets::NTPSnippetsService* ntp_snippets_service = | 116 ntp_snippets::NTPSnippetsService* ntp_snippets_service = |
117 new ntp_snippets::NTPSnippetsService( | 117 new ntp_snippets::NTPSnippetsService( |
118 enabled, profile->GetPrefs(), suggestions_service, | 118 enabled, profile->GetPrefs(), suggestions_service, |
| 119 content_suggestions_service->category_factory(), |
119 g_browser_process->GetApplicationLocale(), scheduler, | 120 g_browser_process->GetApplicationLocale(), scheduler, |
120 base::MakeUnique<ntp_snippets::NTPSnippetsFetcher>( | 121 base::MakeUnique<ntp_snippets::NTPSnippetsFetcher>( |
121 signin_manager, token_service, request_context, | 122 signin_manager, token_service, request_context, |
122 profile->GetPrefs(), | 123 profile->GetPrefs(), |
123 base::Bind(&safe_json::SafeJsonParser::Parse), | 124 base::Bind(&safe_json::SafeJsonParser::Parse), |
124 chrome::GetChannel() == version_info::Channel::STABLE), | 125 chrome::GetChannel() == version_info::Channel::STABLE), |
125 base::MakeUnique<ImageFetcherImpl>( | 126 base::MakeUnique<ImageFetcherImpl>( |
126 base::MakeUnique<ImageDecoderImpl>(), request_context.get()), | 127 base::MakeUnique<ImageDecoderImpl>(), request_context.get()), |
127 base::MakeUnique<ImageDecoderImpl>(), | 128 base::MakeUnique<ImageDecoderImpl>(), |
128 base::MakeUnique<ntp_snippets::NTPSnippetsDatabase>(database_dir, | 129 base::MakeUnique<ntp_snippets::NTPSnippetsDatabase>(database_dir, |
129 task_runner), | 130 task_runner), |
130 base::MakeUnique<ntp_snippets::NTPSnippetsStatusService>( | 131 base::MakeUnique<ntp_snippets::NTPSnippetsStatusService>( |
131 signin_manager, profile->GetPrefs())); | 132 signin_manager, profile->GetPrefs())); |
132 | 133 |
133 if (content_suggestions_service->state() == | 134 if (content_suggestions_service->state() == |
134 ContentSuggestionsService::State::ENABLED) { | 135 ContentSuggestionsService::State::ENABLED) { |
135 content_suggestions_service->RegisterProvider(ntp_snippets_service); | 136 content_suggestions_service->RegisterProvider(ntp_snippets_service); |
136 } | 137 } |
137 return ntp_snippets_service; | 138 return ntp_snippets_service; |
138 } | 139 } |
OLD | NEW |