#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"));
enum class SnapshotOperationResult { … };
std::optional<bool> CopyItemToSnapshotDirectory(
const base::FilePath& relative_path,
const base::FilePath& user_data_dir,
const base::FilePath& snapshot_dir,
bool is_directory) { … }
bool IsProfileDir(const base::FilePath& base_name) { … }
std::vector<base::FilePath> GetUserProfileDirectories(
const base::FilePath& user_data_dir) { … }
void MoveFolderForLaterDeletion(const base::FilePath& source,
const base::FilePath& target) { … }
}
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 { … }
}