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

Side by Side Diff: chrome/browser/search/suggestions/suggestions_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: Move image_fetcher_impl.* to components/image_fetcher 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/search/suggestions/suggestions_service_factory.h" 5 #include "chrome/browser/search/suggestions/suggestions_service_factory.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "chrome/browser/profiles/incognito_helpers.h" 10 #include "chrome/browser/profiles/incognito_helpers.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/search/suggestions/image_fetcher_impl.h" 12 #include "chrome/browser/search/suggestions/image_decoder_impl.h"
13 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 13 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
14 #include "chrome/browser/signin/signin_manager_factory.h" 14 #include "chrome/browser/signin/signin_manager_factory.h"
15 #include "chrome/browser/sync/profile_sync_service_factory.h" 15 #include "chrome/browser/sync/profile_sync_service_factory.h"
16 #include "components/browser_sync/browser/profile_sync_service.h" 16 #include "components/browser_sync/browser/profile_sync_service.h"
17 #include "components/image_fetcher/image_fetcher.h" 17 #include "components/image_fetcher/image_fetcher.h"
18 #include "components/image_fetcher/image_fetcher_impl.h"
18 #include "components/keyed_service/content/browser_context_dependency_manager.h" 19 #include "components/keyed_service/content/browser_context_dependency_manager.h"
19 #include "components/leveldb_proto/proto_database.h" 20 #include "components/leveldb_proto/proto_database.h"
20 #include "components/leveldb_proto/proto_database_impl.h" 21 #include "components/leveldb_proto/proto_database_impl.h"
21 #include "components/pref_registry/pref_registry_syncable.h" 22 #include "components/pref_registry/pref_registry_syncable.h"
22 #include "components/prefs/pref_service.h" 23 #include "components/prefs/pref_service.h"
23 #include "components/signin/core/browser/profile_oauth2_token_service.h" 24 #include "components/signin/core/browser/profile_oauth2_token_service.h"
24 #include "components/signin/core/browser/signin_manager.h" 25 #include "components/signin/core/browser/signin_manager.h"
25 #include "components/suggestions/blacklist_store.h" 26 #include "components/suggestions/blacklist_store.h"
26 #include "components/suggestions/image_manager.h" 27 #include "components/suggestions/image_manager.h"
27 #include "components/suggestions/proto/suggestions.pb.h" 28 #include "components/suggestions/proto/suggestions.pb.h"
28 #include "components/suggestions/suggestions_service.h" 29 #include "components/suggestions/suggestions_service.h"
29 #include "components/suggestions/suggestions_store.h" 30 #include "components/suggestions/suggestions_store.h"
30 #include "content/public/browser/browser_context.h" 31 #include "content/public/browser/browser_context.h"
31 #include "content/public/browser/browser_thread.h" 32 #include "content/public/browser/browser_thread.h"
32 33
33 using content::BrowserThread; 34 using content::BrowserThread;
35 using image_fetcher::ImageFetcherImpl;
34 36
35 namespace suggestions { 37 namespace suggestions {
36 38
37 // static 39 // static
38 SuggestionsService* SuggestionsServiceFactory::GetForProfile(Profile* profile) { 40 SuggestionsService* SuggestionsServiceFactory::GetForProfile(Profile* profile) {
39 return static_cast<SuggestionsService*>( 41 return static_cast<SuggestionsService*>(
40 GetInstance()->GetServiceForBrowserContext(profile, true)); 42 GetInstance()->GetServiceForBrowserContext(profile, true));
41 } 43 }
42 44
43 // static 45 // static
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 std::unique_ptr<BlacklistStore> blacklist_store( 78 std::unique_ptr<BlacklistStore> blacklist_store(
77 new BlacklistStore(profile->GetPrefs())); 79 new BlacklistStore(profile->GetPrefs()));
78 80
79 std::unique_ptr<leveldb_proto::ProtoDatabaseImpl<ImageData>> db( 81 std::unique_ptr<leveldb_proto::ProtoDatabaseImpl<ImageData>> db(
80 new leveldb_proto::ProtoDatabaseImpl<ImageData>(background_task_runner)); 82 new leveldb_proto::ProtoDatabaseImpl<ImageData>(background_task_runner));
81 83
82 base::FilePath database_dir( 84 base::FilePath database_dir(
83 profile->GetPath().Append(FILE_PATH_LITERAL("Thumbnails"))); 85 profile->GetPath().Append(FILE_PATH_LITERAL("Thumbnails")));
84 86
85 std::unique_ptr<ImageFetcherImpl> image_fetcher( 87 std::unique_ptr<ImageFetcherImpl> image_fetcher(
86 new ImageFetcherImpl(profile->GetRequestContext())); 88 new ImageFetcherImpl(
89 new suggestions::ImageDecoderImpl(),
90 profile->GetRequestContext()));
87 std::unique_ptr<ImageManager> thumbnail_manager(new ImageManager( 91 std::unique_ptr<ImageManager> thumbnail_manager(new ImageManager(
88 std::move(image_fetcher), std::move(db), database_dir, 92 std::move(image_fetcher), std::move(db), database_dir,
89 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB))); 93 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB)));
90 return new SuggestionsService( 94 return new SuggestionsService(
91 signin_manager, token_service, sync_service, profile->GetRequestContext(), 95 signin_manager, token_service, sync_service, profile->GetRequestContext(),
92 std::move(suggestions_store), std::move(thumbnail_manager), 96 std::move(suggestions_store), std::move(thumbnail_manager),
93 std::move(blacklist_store)); 97 std::move(blacklist_store));
94 } 98 }
95 99
96 void SuggestionsServiceFactory::RegisterProfilePrefs( 100 void SuggestionsServiceFactory::RegisterProfilePrefs(
97 user_prefs::PrefRegistrySyncable* registry) { 101 user_prefs::PrefRegistrySyncable* registry) {
98 SuggestionsService::RegisterProfilePrefs(registry); 102 SuggestionsService::RegisterProfilePrefs(registry);
99 } 103 }
100 104
101 } // namespace suggestions 105 } // namespace suggestions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698