#include "components/offline_pages/core/model/store_visuals_task.h"
#include "base/functional/bind.h"
#include "base/memory/ptr_util.h"
#include "components/offline_pages/core/offline_clock.h"
#include "components/offline_pages/core/offline_page_metadata_store.h"
#include "sql/database.h"
#include "sql/statement.h"
#include "sql/transaction.h"
namespace offline_pages {
const base::TimeDelta kVisualsExpirationDelta = …;
namespace {
bool EnsureRowExistsSync(sql::Database* db,
int64_t offline_id,
base::Time expiration) { … }
bool StoreThumbnailSync(sql::Database* db,
int64_t offline_id,
base::Time expiration,
const std::string& thumbnail) { … }
bool StoreFaviconSync(sql::Database* db,
int64_t offline_id,
base::Time expiration,
const std::string& favicon) { … }
bool StoreVisualsSync(int64_t offline_id,
base::Time expiration,
const std::string& thumbnail,
const std::string& favicon,
sql::Database* db) { … }
}
std::unique_ptr<StoreVisualsTask> StoreVisualsTask::MakeStoreThumbnailTask(
OfflinePageMetadataStore* store,
int64_t offline_id,
std::string thumbnail,
CompleteCallback callback) { … }
std::unique_ptr<StoreVisualsTask> StoreVisualsTask::MakeStoreFaviconTask(
OfflinePageMetadataStore* store,
int64_t offline_id,
std::string favicon,
CompleteCallback callback) { … }
StoreVisualsTask::StoreVisualsTask(OfflinePageMetadataStore* store,
int64_t offline_id,
std::string thumbnail,
std::string favicon,
RowUpdatedCallback complete_callback)
: … { … }
StoreVisualsTask::~StoreVisualsTask() = default;
void StoreVisualsTask::Run() { … }
void StoreVisualsTask::Complete(bool success) { … }
}