#include "content/browser/file_system_access/file_system_access_observer_host.h"
#include <memory>
#include "base/ranges/algorithm.h"
#include "content/browser/file_system_access/file_system_access_directory_handle_impl.h"
#include "content/browser/file_system_access/file_system_access_error.h"
#include "content/browser/file_system_access/file_system_access_file_handle_impl.h"
#include "content/browser/file_system_access/file_system_access_manager_impl.h"
#include "content/browser/file_system_access/file_system_access_observer_observation.h"
#include "content/browser/file_system_access/file_system_access_transfer_token_impl.h"
#include "content/browser/file_system_access/file_system_access_watcher_manager.h"
#include "content/public/browser/file_system_access_permission_context.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "storage/browser/file_system/file_system_operation_runner.h"
#include "storage/browser/file_system/file_system_url.h"
#include "third_party/blink/public/mojom/file_system_access/file_system_access_observer.mojom.h"
#include "third_party/blink/public/mojom/permissions/permission_status.mojom-shared.h"
namespace content {
HandleType;
FileSystemAccessObserverHost::FileSystemAccessObserverHost(
FileSystemAccessManagerImpl* manager,
FileSystemAccessWatcherManager* watcher_manager,
const BindingContext& binding_context,
mojo::PendingReceiver<blink::mojom::FileSystemAccessObserverHost>
host_receiver)
: … { … }
FileSystemAccessObserverHost::~FileSystemAccessObserverHost() { … }
void FileSystemAccessObserverHost::Observe(
mojo::PendingRemote<blink::mojom::FileSystemAccessTransferToken> token,
bool is_recursive,
ObserveCallback callback) { … }
void FileSystemAccessObserverHost::DidResolveTransferTokenToObserve(
bool is_recursive,
ObserveCallback callback,
FileSystemAccessTransferTokenImpl* resolved_token) { … }
void FileSystemAccessObserverHost::DidCheckItemExists(
absl::variant<std::unique_ptr<FileSystemAccessDirectoryHandleImpl>,
std::unique_ptr<FileSystemAccessFileHandleImpl>> handle,
ObserveCallback callback,
storage::FileSystemURL url,
bool is_recursive,
base::File::Error result) { … }
void FileSystemAccessObserverHost::Unobserve(
mojo::PendingRemote<blink::mojom::FileSystemAccessTransferToken> token) { … }
void FileSystemAccessObserverHost::DidResolveTransferTokenToUnobserve(
FileSystemAccessTransferTokenImpl* resolved_token) { … }
void FileSystemAccessObserverHost::GotObservation(
absl::variant<std::unique_ptr<FileSystemAccessDirectoryHandleImpl>,
std::unique_ptr<FileSystemAccessFileHandleImpl>> handle,
ObserveCallback callback,
base::expected<std::unique_ptr<FileSystemAccessWatcherManager::Observation>,
blink::mojom::FileSystemAccessErrorPtr>
observation_or_error) { … }
void FileSystemAccessObserverHost::RemoveObservation(
FileSystemAccessObserverObservation* observation) { … }
void FileSystemAccessObserverHost::OnHostReceiverDisconnect() { … }
}