#include "components/offline_pages/core/model/delete_page_task.h"
#include <iterator>
#include <string>
#include <utility>
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "components/offline_pages/core/model/get_pages_task.h"
#include "components/offline_pages/core/model/offline_page_model_utils.h"
#include "components/offline_pages/core/offline_page_client_policy.h"
#include "components/offline_pages/core/offline_page_metadata_store.h"
#include "components/offline_pages/core/offline_page_model.h"
#include "components/offline_pages/core/offline_page_types.h"
#include "sql/database.h"
#include "sql/statement.h"
#include "sql/transaction.h"
namespace offline_pages {
struct DeletePageTask::DeletePageTaskResult { … };
DeletePageTaskResult;
namespace {
DeletePageTaskResult DeletePagesSync(
sql::Database* db,
std::vector<OfflinePageItem> pages_to_delete) { … }
DeletePageTaskResult DeletePagesWithCriteria(
const PageCriteria& criteria,
sql::Database* db) { … }
DeletePageTaskResult DeletePagesForPageLimit(
const PageCriteria& criteria,
size_t limit,
sql::Database* db) { … }
}
std::unique_ptr<DeletePageTask> DeletePageTask::CreateTaskWithCriteria(
OfflinePageMetadataStore* store,
const PageCriteria& criteria,
DeletePageTask::DeletePageTaskCallback callback) { … }
std::unique_ptr<DeletePageTask>
DeletePageTask::CreateTaskMatchingUrlPredicateForCachedPages(
OfflinePageMetadataStore* store,
DeletePageTask::DeletePageTaskCallback callback,
const UrlPredicate& predicate) { … }
std::unique_ptr<DeletePageTask> DeletePageTask::CreateTaskDeletingForPageLimit(
OfflinePageMetadataStore* store,
DeletePageTask::DeletePageTaskCallback callback,
const OfflinePageItem& page) { … }
DeletePageTask::DeletePageTask(OfflinePageMetadataStore* store,
DeleteFunction func,
DeletePageTaskCallback callback)
: … { … }
DeletePageTask::~DeletePageTask() = default;
void DeletePageTask::Run() { … }
void DeletePageTask::OnDeletePageDone(DeletePageTaskResult result) { … }
bool DeletePageTask::DeletePageFromDbSync(int64_t offline_id,
sql::Database* db) { … }
bool DeletePageTask::DeletePagesFromDbSync(
const std::vector<int64_t>& offline_ids,
sql::Database* db) { … }
}