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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 g_browser_process->GetApplicationLocale(), scheduler, | 124 g_browser_process->GetApplicationLocale(), scheduler, |
125 base::MakeUnique<ntp_snippets::NTPSnippetsFetcher>( | 125 base::MakeUnique<ntp_snippets::NTPSnippetsFetcher>( |
126 signin_manager, token_service, request_context, | 126 signin_manager, token_service, request_context, |
| 127 profile->GetPrefs(), |
127 base::Bind(&safe_json::SafeJsonParser::Parse), | 128 base::Bind(&safe_json::SafeJsonParser::Parse), |
128 chrome::GetChannel() == version_info::Channel::STABLE), | 129 chrome::GetChannel() == version_info::Channel::STABLE), |
129 base::MakeUnique<ImageFetcherImpl>( | 130 base::MakeUnique<ImageFetcherImpl>( |
130 base::MakeUnique<ImageDecoderImpl>(), request_context.get()), | 131 base::MakeUnique<ImageDecoderImpl>(), request_context.get()), |
131 base::MakeUnique<ImageDecoderImpl>(), | 132 base::MakeUnique<ImageDecoderImpl>(), |
132 base::MakeUnique<ntp_snippets::NTPSnippetsDatabase>(database_dir, | 133 base::MakeUnique<ntp_snippets::NTPSnippetsDatabase>(database_dir, |
133 task_runner), | 134 task_runner), |
134 base::MakeUnique<ntp_snippets::NTPSnippetsStatusService>( | 135 base::MakeUnique<ntp_snippets::NTPSnippetsStatusService>( |
135 signin_manager, sync_service, profile->GetPrefs())); | 136 signin_manager, sync_service, profile->GetPrefs())); |
136 | 137 |
137 if (content_suggestions_service->state() == | 138 if (content_suggestions_service->state() == |
138 ContentSuggestionsService::State::ENABLED) { | 139 ContentSuggestionsService::State::ENABLED) { |
139 content_suggestions_service->RegisterProvider(ntp_snippets_service); | 140 content_suggestions_service->RegisterProvider(ntp_snippets_service); |
140 } | 141 } |
141 return ntp_snippets_service; | 142 return ntp_snippets_service; |
142 } | 143 } |
OLD | NEW |