| OLD | NEW |
| 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 "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| 11 #include "chrome/browser/profiles/incognito_helpers.h" | 11 #include "chrome/browser/profiles/incognito_helpers.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" | |
| 14 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 13 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 15 #include "chrome/browser/signin/signin_manager_factory.h" | 14 #include "chrome/browser/signin/signin_manager_factory.h" |
| 16 #include "chrome/browser/sync/profile_sync_service_factory.h" | 15 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 17 #include "components/browser_sync/profile_sync_service.h" | 16 #include "components/browser_sync/profile_sync_service.h" |
| 17 #include "components/image_fetcher/content/image_decoder_impl.h" |
| 18 #include "components/image_fetcher/core/image_fetcher.h" | 18 #include "components/image_fetcher/core/image_fetcher.h" |
| 19 #include "components/image_fetcher/core/image_fetcher_impl.h" | 19 #include "components/image_fetcher/core/image_fetcher_impl.h" |
| 20 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 20 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 21 #include "components/leveldb_proto/proto_database.h" | 21 #include "components/leveldb_proto/proto_database.h" |
| 22 #include "components/leveldb_proto/proto_database_impl.h" | 22 #include "components/leveldb_proto/proto_database_impl.h" |
| 23 #include "components/pref_registry/pref_registry_syncable.h" | 23 #include "components/pref_registry/pref_registry_syncable.h" |
| 24 #include "components/prefs/pref_service.h" | 24 #include "components/prefs/pref_service.h" |
| 25 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 25 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
| 26 #include "components/signin/core/browser/signin_manager.h" | 26 #include "components/signin/core/browser/signin_manager.h" |
| 27 #include "components/suggestions/blacklist_store.h" | 27 #include "components/suggestions/blacklist_store.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 std::unique_ptr<BlacklistStore> blacklist_store( | 79 std::unique_ptr<BlacklistStore> blacklist_store( |
| 80 new BlacklistStore(profile->GetPrefs())); | 80 new BlacklistStore(profile->GetPrefs())); |
| 81 | 81 |
| 82 std::unique_ptr<leveldb_proto::ProtoDatabaseImpl<ImageData>> db( | 82 std::unique_ptr<leveldb_proto::ProtoDatabaseImpl<ImageData>> db( |
| 83 new leveldb_proto::ProtoDatabaseImpl<ImageData>(background_task_runner)); | 83 new leveldb_proto::ProtoDatabaseImpl<ImageData>(background_task_runner)); |
| 84 | 84 |
| 85 base::FilePath database_dir( | 85 base::FilePath database_dir( |
| 86 profile->GetPath().Append(FILE_PATH_LITERAL("Thumbnails"))); | 86 profile->GetPath().Append(FILE_PATH_LITERAL("Thumbnails"))); |
| 87 | 87 |
| 88 std::unique_ptr<ImageFetcherImpl> image_fetcher( | 88 std::unique_ptr<ImageFetcherImpl> image_fetcher( |
| 89 new ImageFetcherImpl( | 89 new ImageFetcherImpl(base::MakeUnique<image_fetcher::ImageDecoderImpl>(), |
| 90 base::MakeUnique<suggestions::ImageDecoderImpl>(), | 90 profile->GetRequestContext())); |
| 91 profile->GetRequestContext())); | |
| 92 std::unique_ptr<ImageManager> thumbnail_manager(new ImageManager( | 91 std::unique_ptr<ImageManager> thumbnail_manager(new ImageManager( |
| 93 std::move(image_fetcher), std::move(db), database_dir, | 92 std::move(image_fetcher), std::move(db), database_dir, |
| 94 BrowserThread::GetTaskRunnerForThread(BrowserThread::DB))); | 93 BrowserThread::GetTaskRunnerForThread(BrowserThread::DB))); |
| 95 return new SuggestionsServiceImpl( | 94 return new SuggestionsServiceImpl( |
| 96 signin_manager, token_service, sync_service, profile->GetRequestContext(), | 95 signin_manager, token_service, sync_service, profile->GetRequestContext(), |
| 97 std::move(suggestions_store), std::move(thumbnail_manager), | 96 std::move(suggestions_store), std::move(thumbnail_manager), |
| 98 std::move(blacklist_store)); | 97 std::move(blacklist_store)); |
| 99 } | 98 } |
| 100 | 99 |
| 101 void SuggestionsServiceFactory::RegisterProfilePrefs( | 100 void SuggestionsServiceFactory::RegisterProfilePrefs( |
| 102 user_prefs::PrefRegistrySyncable* registry) { | 101 user_prefs::PrefRegistrySyncable* registry) { |
| 103 SuggestionsServiceImpl::RegisterProfilePrefs(registry); | 102 SuggestionsServiceImpl::RegisterProfilePrefs(registry); |
| 104 } | 103 } |
| 105 | 104 |
| 106 } // namespace suggestions | 105 } // namespace suggestions |
| OLD | NEW |