#include "storage/browser/file_system/sandbox_origin_database.h"
#include <stdint.h>
#include <memory>
#include <set>
#include <utility>
#include "base/files/file_enumerator.h"
#include "base/files/file_util.h"
#include "base/format_macros.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/metrics/histogram_macros.h"
#include "base/not_fatal_until.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "storage/common/file_system/file_system_util.h"
#include "third_party/leveldatabase/env_chromium.h"
#include "third_party/leveldatabase/src/include/leveldb/db.h"
#include "third_party/leveldatabase/src/include/leveldb/write_batch.h"
namespace {
const base::FilePath::CharType kOriginDatabaseName[] = …);
const char kOriginKeyPrefix[] = …;
const char kSandboxOriginLastPathKey[] = …;
const int64_t kSandboxOriginMinimumReportIntervalHours = …;
const char kSandboxOriginInitStatusHistogramLabel[] = …;
const char kSandboxOriginDatabaseRepairHistogramLabel[] = …;
enum class InitSandboxOriginStatus { … };
enum class SandboxOriginRepairResult { … };
std::string OriginToOriginKey(const std::string& origin) { … }
const char* LastPathKey() { … }
}
namespace storage {
SandboxOriginDatabase::SandboxOriginDatabase(
const base::FilePath& file_system_directory,
leveldb::Env* env_override)
: … { … }
SandboxOriginDatabase::~SandboxOriginDatabase() = default;
bool SandboxOriginDatabase::Init(InitOption init_option,
RecoveryOption recovery_option) { … }
bool SandboxOriginDatabase::RepairDatabase(const std::string& db_path) { … }
void SandboxOriginDatabase::HandleError(const base::Location& from_here,
const leveldb::Status& status) { … }
void SandboxOriginDatabase::ReportInitStatus(const leveldb::Status& status) { … }
bool SandboxOriginDatabase::HasOriginPath(const std::string& origin) { … }
bool SandboxOriginDatabase::GetPathForOrigin(const std::string& origin,
base::FilePath* directory) { … }
bool SandboxOriginDatabase::RemovePathForOrigin(const std::string& origin) { … }
bool SandboxOriginDatabase::ListAllOrigins(std::vector<OriginRecord>* origins) { … }
void SandboxOriginDatabase::DropDatabase() { … }
void SandboxOriginDatabase::RewriteDatabase() { … }
base::FilePath SandboxOriginDatabase::GetDatabasePath() const { … }
void SandboxOriginDatabase::RemoveDatabase() { … }
bool SandboxOriginDatabase::GetLastPathNumber(int* number) { … }
}