chromium/chrome/browser/downgrade/snapshot_manager.cc

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

#include "chrome/browser/downgrade/snapshot_manager.h"

#include <utility>

#include "base/files/file_enumerator.h"
#include "base/files/file_util.h"
#include "base/metrics/histogram_functions.h"
#include "base/numerics/safe_conversions.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/trace_event/trace_event.h"
#include "chrome/browser/browsing_data/chrome_browsing_data_remover_constants.h"
#include "chrome/browser/downgrade/downgrade_utils.h"
#include "chrome/browser/downgrade/snapshot_file_collector.h"
#include "chrome/browser/downgrade/user_data_downgrade.h"
#include "chrome/common/chrome_constants.h"

namespace downgrade {

namespace {

constexpr base::FilePath::StringPieceType kSQLiteJournalSuffix(
    FILE_PATH_LITERAL("-journal"));
constexpr base::FilePath::StringPieceType kSQLiteWalSuffix(
    FILE_PATH_LITERAL("-wal"));
constexpr base::FilePath::StringPieceType kSQLiteShmSuffix(
    FILE_PATH_LITERAL("-shm"));

// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
enum class SnapshotOperationResult {};

// Copies the item at |user_data_dir|/|relative_path| to
// |snapshot_dir|/|relative_path| if the item exists. This also copies all files
// related to items that are SQLite databases. Returns |true| if the item was
// found at the source and successfully copied. Returns |false| if the item was
// found at the source but not successfully copied. Returns no value if the file
// was not at the source.
std::optional<bool> CopyItemToSnapshotDirectory(
    const base::FilePath& relative_path,
    const base::FilePath& user_data_dir,
    const base::FilePath& snapshot_dir,
    bool is_directory) {}

// Returns true if |base_name| matches a user profile directory's format. This
// function will ignore the "System Profile" directory.
bool IsProfileDir(const base::FilePath& base_name) {}

// Returns a list of profile directory base names under |user_data_dir|.
std::vector<base::FilePath> GetUserProfileDirectories(
    const base::FilePath& user_data_dir) {}

// Moves the |source| directory to |target| to be deleted later. If the move
// initially fails, move the contents of the directory.
void MoveFolderForLaterDeletion(const base::FilePath& source,
                                const base::FilePath& target) {}

}  // namespace

SnapshotManager::SnapshotManager(const base::FilePath& user_data_dir)
    :{}

SnapshotManager::~SnapshotManager() = default;

void SnapshotManager::TakeSnapshot(const base::Version& version) {}

void SnapshotManager::RestoreSnapshot(const base::Version& version) {}

void SnapshotManager::PurgeInvalidAndOldSnapshots(
    int max_number_of_snapshots,
    std::optional<uint32_t> milestone) const {}

void SnapshotManager::DeleteSnapshotDataForProfile(
    base::Time delete_begin,
    const base::FilePath& profile_base_name,
    uint64_t remove_mask) {}

std::vector<SnapshotItemDetails>
SnapshotManager::GetProfileSnapshotItemDetails() const {}

std::vector<SnapshotItemDetails> SnapshotManager::GetUserSnapshotItemDetails()
    const {}

}  // namespace downgrade