chromium/components/offline_pages/core/model/delete_page_task.cc

// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#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 {

// Deletes pages. This will return a DeletePageTaskResult which contains the
// deleted pages (which are successfully deleted from the disk and the store)
// and a DeletePageResult. For each page to be deleted, the deletion will delete
// the archive file first, then database entry, in order to avoid the potential
// issue of leaving archive files behind (and they may be imported later).
// Since the database entry will only be deleted while the associated archive
// file is deleted successfully, there will be no such issue.
DeletePageTaskResult DeletePagesSync(
    sql::Database* db,
    std::vector<OfflinePageItem> pages_to_delete) {}

DeletePageTaskResult DeletePagesWithCriteria(
    const PageCriteria& criteria,
    sql::Database* db) {}

// Deletes all but |limit| pages that match |criteria|, in the order specified
// by |criteria|.
DeletePageTaskResult DeletePagesForPageLimit(
    const PageCriteria& criteria,
    size_t limit,
    sql::Database* db) {}

}  // namespace

// static
std::unique_ptr<DeletePageTask> DeletePageTask::CreateTaskWithCriteria(
    OfflinePageMetadataStore* store,
    const PageCriteria& criteria,
    DeletePageTask::DeletePageTaskCallback callback) {}

// static
std::unique_ptr<DeletePageTask>
DeletePageTask::CreateTaskMatchingUrlPredicateForCachedPages(
    OfflinePageMetadataStore* store,
    DeletePageTask::DeletePageTaskCallback callback,
    const UrlPredicate& predicate) {}

// static
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) {}

// static
bool DeletePageTask::DeletePageFromDbSync(int64_t offline_id,
                                          sql::Database* db) {}

bool DeletePageTask::DeletePagesFromDbSync(
    const std::vector<int64_t>& offline_ids,
    sql::Database* db) {}

}  // namespace offline_pages