#include "chrome/browser/image_fetcher/image_fetcher_service_factory.h"
#include <memory>
#include <utility>
#include "base/files/file_path.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/thread_pool.h"
#include "base/time/default_clock.h"
#include "build/build_config.h"
#include "chrome/browser/image_fetcher/image_decoder_impl.h"
#include "chrome/browser/net/system_network_context_manager.h"
#include "chrome/browser/profiles/profile_key.h"
#include "chrome/common/chrome_paths_internal.h"
#include "components/image_fetcher/core/cache/image_cache.h"
#include "components/image_fetcher/core/cache/image_data_store_disk.h"
#include "components/image_fetcher/core/cache/image_metadata_store_leveldb.h"
#include "components/image_fetcher/core/image_fetcher_service.h"
#include "components/keyed_service/core/simple_dependency_manager.h"
#include "components/keyed_service/core/simple_factory_key.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/storage_partition.h"
#if BUILDFLAG(IS_ANDROID)
#include "components/image_fetcher/image_fetcher_service_provider.h"
#endif
namespace {
const base::FilePath::CharType kImageCacheSubdir[] = …);
base::FilePath GetCachePath(SimpleFactoryKey* key) { … }
#if BUILDFLAG(IS_ANDROID)
image_fetcher::ImageFetcherService* GetImageFetcherService(
SimpleFactoryKey* key) {
return ImageFetcherServiceFactory::GetForKey(key);
}
std::string GetCachePathForJava(SimpleFactoryKey* key, std::string path) {
base::FilePath cache_path;
chrome::GetUserCacheDirectory(key->GetPath(), &cache_path);
return cache_path.Append(kImageCacheSubdir).Append(path).MaybeAsASCII();
}
#endif
}
image_fetcher::ImageFetcherService* ImageFetcherServiceFactory::GetForKey(
SimpleFactoryKey* key) { … }
ImageFetcherServiceFactory* ImageFetcherServiceFactory::GetInstance() { … }
ImageFetcherServiceFactory::ImageFetcherServiceFactory()
: … { … }
ImageFetcherServiceFactory::~ImageFetcherServiceFactory() = default;
std::unique_ptr<KeyedService>
ImageFetcherServiceFactory::BuildServiceInstanceFor(
SimpleFactoryKey* key) const { … }
SimpleFactoryKey* ImageFetcherServiceFactory::GetKeyToUse(
SimpleFactoryKey* key) const { … }