#ifndef EXTENSIONS_BROWSER_API_FILE_SYSTEM_FILE_SYSTEM_API_H_
#define EXTENSIONS_BROWSER_API_FILE_SYSTEM_FILE_SYSTEM_API_H_
#include <memory>
#include <string>
#include <vector>
#include "base/auto_reset.h"
#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/memory/raw_ptr.h"
#include "base/values.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "extensions/browser/extension_function.h"
#include "extensions/common/api/file_system.h"
#include "extensions/common/extension_id.h"
#include "ui/shell_dialogs/select_file_dialog.h"
#if BUILDFLAG(IS_CHROMEOS)
#include "extensions/browser/api/file_system/consent_provider.h"
#endif
namespace extensions {
class ExtensionPrefs;
namespace file_system_api {
base::FilePath GetLastChooseEntryDirectory(const ExtensionPrefs* prefs,
const ExtensionId& extension_id);
void SetLastChooseEntryDirectory(ExtensionPrefs* prefs,
const ExtensionId& extension_id,
const base::FilePath& path);
}
class FileSystemGetDisplayPathFunction : public ExtensionFunction { … };
class FileSystemEntryFunction : public ExtensionFunction { … };
class FileSystemGetWritableEntryFunction : public FileSystemEntryFunction { … };
class FileSystemIsWritableEntryFunction : public ExtensionFunction { … };
class FileSystemChooseEntryFunction : public FileSystemEntryFunction { … };
class FileSystemRetainEntryFunction : public ExtensionFunction { … };
class FileSystemIsRestorableFunction : public ExtensionFunction { … };
class FileSystemRestoreEntryFunction : public FileSystemEntryFunction { … };
#if BUILDFLAG(IS_CHROMEOS)
class FileSystemRequestFileSystemFunction : public ExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("fileSystem.requestFileSystem",
FILESYSTEM_REQUESTFILESYSTEM)
FileSystemRequestFileSystemFunction();
protected:
~FileSystemRequestFileSystemFunction() override;
ExtensionFunction::ResponseAction Run() override;
private:
void OnGotFileSystem(const std::string& id, const std::string& path);
void OnError(const std::string& error);
std::unique_ptr<ConsentProvider> consent_provider_;
};
class FileSystemGetVolumeListFunction : public ExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("fileSystem.getVolumeList",
FILESYSTEM_GETVOLUMELIST)
FileSystemGetVolumeListFunction();
protected:
~FileSystemGetVolumeListFunction() override;
ExtensionFunction::ResponseAction Run() override;
private:
void OnGotVolumeList(const std::vector<api::file_system::Volume>& volumes);
void OnError(const std::string& error);
std::unique_ptr<ConsentProvider> consent_provider_;
};
#else
class FileSystemRequestFileSystemFunction : public ExtensionFunction { … };
class FileSystemGetVolumeListFunction : public ExtensionFunction { … };
#endif
}
#endif