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

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

Issue 2074153002: Pass the ImageDecoder to the ImageFetcher at creation time. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments round2 treib@ & added missing imports *sigh* Created 4 years, 5 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 | « no previous file | chrome/browser/search/suggestions/image_fetcher_impl.h » ('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 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"
11 #include "chrome/browser/browser_process.h" 11 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/search/suggestions/image_decoder_impl.h" 13 #include "chrome/browser/search/suggestions/image_decoder_impl.h"
14 #include "chrome/browser/search/suggestions/image_fetcher_impl.h"
15 #include "chrome/browser/search/suggestions/suggestions_service_factory.h" 14 #include "chrome/browser/search/suggestions/suggestions_service_factory.h"
16 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 15 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
17 #include "chrome/browser/signin/signin_manager_factory.h" 16 #include "chrome/browser/signin/signin_manager_factory.h"
18 #include "chrome/browser/sync/profile_sync_service_factory.h" 17 #include "chrome/browser/sync/profile_sync_service_factory.h"
19 #include "chrome/common/channel_info.h" 18 #include "chrome/common/channel_info.h"
20 #include "chrome/common/pref_names.h" 19 #include "chrome/common/pref_names.h"
21 #include "components/browser_sync/browser/profile_sync_service.h" 20 #include "components/browser_sync/browser/profile_sync_service.h"
22 #include "components/image_fetcher/image_decoder.h" 21 #include "components/image_fetcher/image_decoder.h"
23 #include "components/image_fetcher/image_fetcher.h" 22 #include "components/image_fetcher/image_fetcher.h"
23 #include "components/image_fetcher/image_fetcher_impl.h"
24 #include "components/keyed_service/content/browser_context_dependency_manager.h" 24 #include "components/keyed_service/content/browser_context_dependency_manager.h"
25 #include "components/ntp_snippets/ntp_snippets_constants.h" 25 #include "components/ntp_snippets/ntp_snippets_constants.h"
26 #include "components/ntp_snippets/ntp_snippets_database.h" 26 #include "components/ntp_snippets/ntp_snippets_database.h"
27 #include "components/ntp_snippets/ntp_snippets_fetcher.h" 27 #include "components/ntp_snippets/ntp_snippets_fetcher.h"
28 #include "components/ntp_snippets/ntp_snippets_scheduler.h" 28 #include "components/ntp_snippets/ntp_snippets_scheduler.h"
29 #include "components/ntp_snippets/ntp_snippets_service.h" 29 #include "components/ntp_snippets/ntp_snippets_service.h"
30 #include "components/ntp_snippets/ntp_snippets_status_service.h" 30 #include "components/ntp_snippets/ntp_snippets_status_service.h"
31 #include "components/prefs/pref_service.h" 31 #include "components/prefs/pref_service.h"
32 #include "components/safe_json/safe_json_parser.h" 32 #include "components/safe_json/safe_json_parser.h"
33 #include "components/signin/core/browser/profile_oauth2_token_service.h" 33 #include "components/signin/core/browser/profile_oauth2_token_service.h"
34 #include "components/signin/core/browser/signin_manager.h" 34 #include "components/signin/core/browser/signin_manager.h"
35 #include "components/version_info/version_info.h" 35 #include "components/version_info/version_info.h"
36 #include "content/public/browser/browser_context.h" 36 #include "content/public/browser/browser_context.h"
37 #include "content/public/browser/browser_thread.h" 37 #include "content/public/browser/browser_thread.h"
38 #include "content/public/browser/storage_partition.h" 38 #include "content/public/browser/storage_partition.h"
39 #include "net/url_request/url_request_context_getter.h" 39 #include "net/url_request/url_request_context_getter.h"
40 40
41 #if defined(OS_ANDROID) 41 #if defined(OS_ANDROID)
42 #include "chrome/browser/android/chrome_feature_list.h" 42 #include "chrome/browser/android/chrome_feature_list.h"
43 #include "chrome/browser/android/ntp/ntp_snippets_launcher.h" 43 #include "chrome/browser/android/ntp/ntp_snippets_launcher.h"
44 #endif // OS_ANDROID 44 #endif // OS_ANDROID
45 45
46 using content::BrowserThread; 46 using content::BrowserThread;
47 using image_fetcher::ImageFetcherImpl;
47 using suggestions::ImageDecoderImpl; 48 using suggestions::ImageDecoderImpl;
48 using suggestions::ImageFetcherImpl;
49 using suggestions::SuggestionsService; 49 using suggestions::SuggestionsService;
50 using suggestions::SuggestionsServiceFactory; 50 using suggestions::SuggestionsServiceFactory;
51 51
52 // static 52 // static
53 NTPSnippetsServiceFactory* NTPSnippetsServiceFactory::GetInstance() { 53 NTPSnippetsServiceFactory* NTPSnippetsServiceFactory::GetInstance() {
54 return base::Singleton<NTPSnippetsServiceFactory>::get(); 54 return base::Singleton<NTPSnippetsServiceFactory>::get();
55 } 55 }
56 56
57 // static 57 // static
58 ntp_snippets::NTPSnippetsService* NTPSnippetsServiceFactory::GetForProfile( 58 ntp_snippets::NTPSnippetsService* NTPSnippetsServiceFactory::GetForProfile(
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 base::SequencedWorkerPool::GetSequenceToken(), 111 base::SequencedWorkerPool::GetSequenceToken(),
112 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN); 112 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN);
113 113
114 return new ntp_snippets::NTPSnippetsService( 114 return new ntp_snippets::NTPSnippetsService(
115 enabled, profile->GetPrefs(), suggestions_service, 115 enabled, profile->GetPrefs(), suggestions_service,
116 g_browser_process->GetApplicationLocale(), scheduler, 116 g_browser_process->GetApplicationLocale(), scheduler,
117 base::MakeUnique<ntp_snippets::NTPSnippetsFetcher>( 117 base::MakeUnique<ntp_snippets::NTPSnippetsFetcher>(
118 signin_manager, token_service, request_context, 118 signin_manager, token_service, request_context,
119 base::Bind(&safe_json::SafeJsonParser::Parse), 119 base::Bind(&safe_json::SafeJsonParser::Parse),
120 chrome::GetChannel() == version_info::Channel::STABLE), 120 chrome::GetChannel() == version_info::Channel::STABLE),
121 base::MakeUnique<ImageFetcherImpl>(request_context.get()), 121 base::MakeUnique<ImageFetcherImpl>(
122 base::MakeUnique<ImageDecoderImpl>(), request_context.get()),
122 base::MakeUnique<ImageDecoderImpl>(), 123 base::MakeUnique<ImageDecoderImpl>(),
123 base::MakeUnique<ntp_snippets::NTPSnippetsDatabase>(database_dir, 124 base::MakeUnique<ntp_snippets::NTPSnippetsDatabase>(database_dir,
124 task_runner), 125 task_runner),
125 base::MakeUnique<ntp_snippets::NTPSnippetsStatusService>(signin_manager, 126 base::MakeUnique<ntp_snippets::NTPSnippetsStatusService>(signin_manager,
126 sync_service)); 127 sync_service));
127 } 128 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/search/suggestions/image_fetcher_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698