#include "components/image_fetcher/core/cache/image_data_store_disk.h"
#include <utility>
#include <vector>
#include "base/files/file_enumerator.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/logging.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/sequenced_task_runner.h"
#include "build/build_config.h"
File;
FileEnumerator;
FilePath;
namespace image_fetcher {
namespace {
constexpr char kNeedsTranscodingPrefix[] = …;
const FilePath::CharType kPathPostfix[] = …);
InitializationStatus InitializeImpl(FilePath storage_path) { … }
base::FilePath BuildFilePath(const FilePath& storage_path,
const std::string& key,
bool needs_transcoding) { … }
void SaveImageImpl(FilePath storage_path,
const std::string& key,
std::string data,
bool needs_transcoding) { … }
std::string LoadImageImpl(FilePath storage_path,
const std::string& key,
bool needs_transcoding) { … }
void DeleteImageImpl(FilePath storage_path, const std::string& key) { … }
std::vector<std::string> GetAllKeysImpl(FilePath storage_path) { … }
}
ImageDataStoreDisk::ImageDataStoreDisk(
FilePath generic_storage_path,
scoped_refptr<base::SequencedTaskRunner> task_runner)
: … { … }
ImageDataStoreDisk::~ImageDataStoreDisk() = default;
void ImageDataStoreDisk::Initialize(base::OnceClosure callback) { … }
bool ImageDataStoreDisk::IsInitialized() { … }
void ImageDataStoreDisk::SaveImage(const std::string& key,
std::string image_data,
bool needs_transcoding) { … }
void ImageDataStoreDisk::LoadImage(const std::string& key,
bool needs_transcoding,
ImageDataCallback callback) { … }
void ImageDataStoreDisk::DeleteImage(const std::string& key) { … }
void ImageDataStoreDisk::GetAllKeys(KeysCallback callback) { … }
void ImageDataStoreDisk::OnInitializationComplete(
base::OnceClosure callback,
InitializationStatus initialization_status) { … }
void ImageDataStoreDisk::OnImageLoaded(bool needs_transcoding,
ImageDataCallback callback,
std::string data) { … }
}