chromium/content/browser/file_system_access/file_system_access_watcher_manager.cc

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

#include "content/browser/file_system_access/file_system_access_watcher_manager.h"

#include <algorithm>
#include <list>
#include <memory>

#include "base/check.h"
#include "base/files/file_path.h"
#include "base/functional/bind.h"
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
#include "base/ranges/algorithm.h"
#include "base/sequence_checker.h"
#include "base/types/pass_key.h"
#include "build/buildflag.h"
#include "components/services/storage/public/cpp/buckets/bucket_locator.h"
#include "content/browser/file_system_access/file_system_access_bucket_path_watcher.h"
#include "content/browser/file_system_access/file_system_access_change_source.h"
#include "content/browser/file_system_access/file_system_access_error.h"
#include "content/browser/file_system_access/file_system_access_manager_impl.h"
#include "content/browser/file_system_access/file_system_access_observer_host.h"
#include "content/browser/file_system_access/file_system_access_observer_observation.h"
#include "content/browser/file_system_access/file_system_access_watch_scope.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "storage/browser/file_system/file_system_url.h"
#include "storage/common/file_system/file_system_types.h"
#include "third_party/blink/public/mojom/file_system_access/file_system_access_error.mojom-shared.h"
#include "third_party/blink/public/mojom/file_system_access/file_system_access_observer.mojom.h"

#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS) && !BUILDFLAG(IS_FUCHSIA)
#include "content/browser/file_system_access/file_system_access_local_path_watcher.h"
#endif  // !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS) &&
        // !BUILDFLAG(IS_FUCHSIA)

namespace content {

WatchType;

namespace {

storage::FileSystemURL ToFileSystemURL(storage::FileSystemContext& context,
                                       const storage::FileSystemURL& base_url,
                                       const base::FilePath& absolute_path) {}

}  // namespace

FileSystemAccessWatcherManager::Observation::Change::Change(
    storage::FileSystemURL url,
    FileSystemAccessChangeSource::ChangeInfo change_info)
    :{}
FileSystemAccessWatcherManager::Observation::Change::~Change() = default;

FileSystemAccessWatcherManager::Observation::Change::Change(
    const FileSystemAccessWatcherManager::Observation::Change& other)
    :{}
FileSystemAccessWatcherManager::Observation::Change::Change(
    FileSystemAccessWatcherManager::Observation::Change&&) noexcept = default;

FileSystemAccessWatcherManager::Observation::Change&
FileSystemAccessWatcherManager::Observation::Change::operator=(
    const FileSystemAccessWatcherManager::Observation::Change&) = default;
FileSystemAccessWatcherManager::Observation::Change&
FileSystemAccessWatcherManager::Observation::Change::operator=(
    FileSystemAccessWatcherManager::Observation::Change&&) noexcept = default;

FileSystemAccessWatcherManager::Observation::Observation(
    FileSystemAccessWatcherManager* watcher_manager,
    FileSystemAccessWatchScope scope,
    base::PassKey<FileSystemAccessWatcherManager> /*pass_key*/)
    :{}
FileSystemAccessWatcherManager::Observation::~Observation() = default;

void FileSystemAccessWatcherManager::Observation::SetCallback(
    OnChangesCallback on_change_callback) {}

void FileSystemAccessWatcherManager::Observation::NotifyOfChanges(
    const std::optional<std::list<Change>>& changes_or_error,
    base::PassKey<FileSystemAccessWatcherManager> pass_key) {}

FileSystemAccessWatcherManager::FileSystemAccessWatcherManager(
    FileSystemAccessManagerImpl* manager,
    base::PassKey<FileSystemAccessManagerImpl> /*pass_key*/)
    :{}

FileSystemAccessWatcherManager::~FileSystemAccessWatcherManager() = default;

void FileSystemAccessWatcherManager::BindObserverHost(
    const BindingContext& binding_context,
    mojo::PendingReceiver<blink::mojom::FileSystemAccessObserverHost>
        host_receiver) {}

void FileSystemAccessWatcherManager::RemoveObserverHost(
    FileSystemAccessObserverHost* host) {}

void FileSystemAccessWatcherManager::GetFileObservation(
    const storage::FileSystemURL& file_url,
    GetObservationCallback get_observation_callback) {}

void FileSystemAccessWatcherManager::GetDirectoryObservation(
    const storage::FileSystemURL& directory_url,
    bool is_recursive,
    GetObservationCallback get_observation_callback) {}

void FileSystemAccessWatcherManager::OnRawChange(
    const storage::FileSystemURL& changed_url,
    bool error,
    const FileSystemAccessChangeSource::ChangeInfo& raw_change_info,
    const FileSystemAccessWatchScope& scope) {}

void FileSystemAccessWatcherManager::OnSourceBeingDestroyed(
    FileSystemAccessChangeSource* source) {}

void FileSystemAccessWatcherManager::RegisterSource(
    FileSystemAccessChangeSource* source) {}

void FileSystemAccessWatcherManager::AddObserver(Observation* observation) {}

void FileSystemAccessWatcherManager::RemoveObserver(Observation* observation) {}

bool FileSystemAccessWatcherManager::HasSourceContainingScopeForTesting(
    const FileSystemAccessWatchScope& scope) const {}

void FileSystemAccessWatcherManager::EnsureSourceIsInitializedForScope(
    FileSystemAccessWatchScope scope,
    base::OnceCallback<void(blink::mojom::FileSystemAccessErrorPtr)>
        on_source_initialized) {}

void FileSystemAccessWatcherManager::DidInitializeSource(
    base::WeakPtr<FileSystemAccessChangeSource> source,
    base::OnceCallback<void(blink::mojom::FileSystemAccessErrorPtr)>
        on_source_initialized,
    blink::mojom::FileSystemAccessErrorPtr result) {}

void FileSystemAccessWatcherManager::PrepareObservationForScope(
    FileSystemAccessWatchScope scope,
    GetObservationCallback get_observation_callback,
    blink::mojom::FileSystemAccessErrorPtr source_initialization_result) {}

std::unique_ptr<FileSystemAccessChangeSource>
FileSystemAccessWatcherManager::CreateOwnedSourceForScope(
    FileSystemAccessWatchScope scope) {}

}  // namespace content