chromium/apps/saved_files_service.cc

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

#include "apps/saved_files_service.h"

#include <stdint.h>

#include <algorithm>
#include <map>
#include <memory>
#include <optional>
#include <unordered_map>
#include <utility>

#include "apps/saved_files_service_factory.h"
#include "base/json/values_util.h"
#include "base/memory/raw_ptr.h"
#include "base/not_fatal_until.h"
#include "build/chromeos_buildflags.h"
#include "content/public/browser/browser_context.h"
#include "extensions/browser/api/file_system/saved_file_entry.h"
#include "extensions/browser/extension_host.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_system.h"
#include "extensions/common/extension_id.h"
#include "extensions/common/permissions/api_permission.h"
#include "extensions/common/permissions/permission_set.h"
#include "extensions/common/permissions/permissions_data.h"

namespace apps {

APIPermission;
Extension;
ExtensionHost;
ExtensionPrefs;
SavedFileEntry;

namespace {

// Preference keys

// The file entries that the app has permission to access.
const char kFileEntries[] =;

// The path to a file entry that the app had permission to access.
const char kFileEntryPath[] =;

// Whether or not the the entry refers to a directory.
const char kFileEntryIsDirectory[] =;

// The sequence number in the LRU of the file entry.
const char kFileEntrySequenceNumber[] =;

const size_t kMaxSavedFileEntries =;
const int kMaxSequenceNumber =;

// These might be different to the constant values in tests.
size_t g_max_saved_file_entries =;
int g_max_sequence_number =;

// Persists a SavedFileEntry in ExtensionPrefs.
void AddSavedFileEntry(ExtensionPrefs* prefs,
                       const extensions::ExtensionId& extension_id,
                       const SavedFileEntry& file_entry) {}

// Updates the sequence_number of a SavedFileEntry persisted in ExtensionPrefs.
void UpdateSavedFileEntry(ExtensionPrefs* prefs,
                          const extensions::ExtensionId& extension_id,
                          const SavedFileEntry& file_entry) {}

// Removes a SavedFileEntry from ExtensionPrefs.
void RemoveSavedFileEntry(ExtensionPrefs* prefs,
                          const extensions::ExtensionId& extension_id,
                          const std::string& file_entry_id) {}

// Clears all SavedFileEntry for the app from ExtensionPrefs.
void ClearSavedFileEntries(ExtensionPrefs* prefs,
                           const extensions::ExtensionId& extension_id) {}

// Returns all SavedFileEntries for the app.
std::vector<SavedFileEntry> GetSavedFileEntries(
    ExtensionPrefs* prefs,
    const extensions::ExtensionId& extension_id) {}

}  // namespace

class SavedFilesService::SavedFiles {};

// static
SavedFilesService* SavedFilesService::Get(content::BrowserContext* context) {}

SavedFilesService::SavedFilesService(content::BrowserContext* context)
    :{}

SavedFilesService::~SavedFilesService() = default;

void SavedFilesService::OnExtensionHostDestroyed(
    content::BrowserContext* browser_context,
    extensions::ExtensionHost* host) {}

void SavedFilesService::RegisterFileEntry(
    const extensions::ExtensionId& extension_id,
    const std::string& id,
    const base::FilePath& file_path,
    bool is_directory) {}

void SavedFilesService::EnqueueFileEntry(
    const extensions::ExtensionId& extension_id,
    const std::string& id) {}

std::vector<SavedFileEntry> SavedFilesService::GetAllFileEntries(
    const extensions::ExtensionId& extension_id) {}

bool SavedFilesService::IsRegistered(
    const extensions::ExtensionId& extension_id,
    const std::string& id) {}

const SavedFileEntry* SavedFilesService::GetFileEntry(
    const extensions::ExtensionId& extension_id,
    const std::string& id) {}

void SavedFilesService::ClearQueueIfNoRetainPermission(
    const Extension* extension) {}

void SavedFilesService::ClearQueue(const extensions::Extension* extension) {}

void SavedFilesService::OnApplicationTerminating() {}

SavedFilesService::SavedFiles* SavedFilesService::Get(
    const extensions::ExtensionId& extension_id) const {}

SavedFilesService::SavedFiles* SavedFilesService::GetOrInsert(
    const extensions::ExtensionId& extension_id) {}

void SavedFilesService::Clear(const extensions::ExtensionId& extension_id) {}

SavedFilesService::SavedFiles::SavedFiles(
    content::BrowserContext* context,
    const extensions::ExtensionId& extension_id)
    :{}

SavedFilesService::SavedFiles::~SavedFiles() = default;

void SavedFilesService::SavedFiles::RegisterFileEntry(
    const std::string& id,
    const base::FilePath& file_path,
    bool is_directory) {}

void SavedFilesService::SavedFiles::EnqueueFileEntry(const std::string& id) {}

bool SavedFilesService::SavedFiles::IsRegistered(const std::string& id) const {}

const SavedFileEntry* SavedFilesService::SavedFiles::GetFileEntry(
    const std::string& id) const {}

std::vector<SavedFileEntry> SavedFilesService::SavedFiles::GetAllFileEntries()
    const {}

void SavedFilesService::SavedFiles::MaybeCompactSequenceNumbers() {}

void SavedFilesService::SavedFiles::LoadSavedFileEntriesFromPreferences() {}

// static
void SavedFilesService::SetMaxSequenceNumberForTest(int max_value) {}

// static
void SavedFilesService::ClearMaxSequenceNumberForTest() {}

// static
void SavedFilesService::SetLruSizeForTest(int size) {}

// static
void SavedFilesService::ClearLruSizeForTest() {}

}  // namespace apps