chromium/chrome/browser/sync_file_system/local/local_file_sync_context.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 "chrome/browser/sync_file_system/local/local_file_sync_context.h"

#include <memory>
#include <utility>

#include "base/containers/contains.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/location.h"
#include "base/observer_list.h"
#include "base/task/single_thread_task_runner.h"
#include "chrome/browser/sync_file_system/file_change.h"
#include "chrome/browser/sync_file_system/local/local_file_change_tracker.h"
#include "chrome/browser/sync_file_system/local/local_origin_change_observer.h"
#include "chrome/browser/sync_file_system/local/root_delete_helper.h"
#include "chrome/browser/sync_file_system/local/sync_file_system_backend.h"
#include "chrome/browser/sync_file_system/local/syncable_file_operation_runner.h"
#include "chrome/browser/sync_file_system/logger.h"
#include "chrome/browser/sync_file_system/sync_file_metadata.h"
#include "chrome/browser/sync_file_system/syncable_file_system_util.h"
#include "storage/browser/blob/scoped_file.h"
#include "storage/browser/file_system/file_system_context.h"
#include "storage/browser/file_system/file_system_file_util.h"
#include "storage/browser/file_system/file_system_operation_context.h"
#include "storage/browser/file_system/file_system_operation_runner.h"
#include "storage/browser/file_system/file_system_url.h"
#include "storage/common/file_system/file_system_types.h"
#include "storage/common/file_system/file_system_util.h"
#include "third_party/blink/public/common/storage_key/storage_key.h"
#include "url/origin.h"

FileSystemContext;
FileSystemFileUtil;
FileSystemOperation;
FileSystemOperationContext;
FileSystemURL;

namespace sync_file_system {

namespace {

const int kMaxConcurrentSyncableOperation =;
const int kNotifyChangesDurationInSec =;
const int kMaxURLsToFetchForLocalSync =;

const base::FilePath::CharType kSnapshotDir[] =);

}  // namespace

LocalFileSyncContext::LocalFileSyncContext(
    const base::FilePath& base_path,
    leveldb::Env* env_override,
    base::SingleThreadTaskRunner* ui_task_runner,
    base::SingleThreadTaskRunner* io_task_runner)
    :{}

void LocalFileSyncContext::MaybeInitializeFileSystemContext(
    const GURL& source_url,
    FileSystemContext* file_system_context,
    SyncStatusCallback callback) {}

void LocalFileSyncContext::ShutdownOnUIThread() {}

void LocalFileSyncContext::GetFileForLocalSync(
    FileSystemContext* file_system_context,
    LocalFileSyncInfoCallback callback) {}

void LocalFileSyncContext::ClearChangesForURL(
    FileSystemContext* file_system_context,
    const FileSystemURL& url,
    base::OnceClosure done_callback) {}

void LocalFileSyncContext::FinalizeSnapshotSync(
    storage::FileSystemContext* file_system_context,
    const storage::FileSystemURL& url,
    SyncStatusCode sync_finish_status,
    base::OnceClosure done_callback) {}

void LocalFileSyncContext::FinalizeExclusiveSync(
    storage::FileSystemContext* file_system_context,
    const storage::FileSystemURL& url,
    bool clear_local_changes,
    base::OnceClosure done_callback) {}

void LocalFileSyncContext::PrepareForSync(
    FileSystemContext* file_system_context,
    const FileSystemURL& url,
    SyncMode sync_mode,
    LocalFileSyncInfoCallback callback) {}

void LocalFileSyncContext::RegisterURLForWaitingSync(
    const FileSystemURL& url,
    base::OnceClosure on_syncable_callback) {}

void LocalFileSyncContext::ApplyRemoteChange(
    FileSystemContext* file_system_context,
    const FileChange& change,
    const base::FilePath& local_path,
    const FileSystemURL& url,
    SyncStatusCallback callback) {}

void LocalFileSyncContext::HandleRemoteDelete(
    FileSystemContext* file_system_context,
    const FileSystemURL& url,
    SyncStatusCallback callback) {}

void LocalFileSyncContext::HandleRemoteAddOrUpdate(
    FileSystemContext* file_system_context,
    const FileChange& change,
    const base::FilePath& local_path,
    const FileSystemURL& url,
    SyncStatusCallback callback) {}

void LocalFileSyncContext::DidRemoveExistingEntryForRemoteAddOrUpdate(
    FileSystemContext* file_system_context,
    const FileChange& change,
    const base::FilePath& local_path,
    const FileSystemURL& url,
    SyncStatusCallback callback,
    base::File::Error error) {}

void LocalFileSyncContext::RecordFakeLocalChange(
    FileSystemContext* file_system_context,
    const FileSystemURL& url,
    const FileChange& change,
    SyncStatusCallback callback) {}

void LocalFileSyncContext::GetFileMetadata(
    FileSystemContext* file_system_context,
    const FileSystemURL& url,
    SyncFileMetadataCallback callback) {}

void LocalFileSyncContext::HasPendingLocalChanges(
    FileSystemContext* file_system_context,
    const FileSystemURL& url,
    HasPendingLocalChangeCallback callback) {}

void LocalFileSyncContext::PromoteDemotedChanges(
    const GURL& origin,
    storage::FileSystemContext* file_system_context,
    base::OnceClosure callback) {}

void LocalFileSyncContext::UpdateChangesForOrigin(const GURL& origin,
                                                  base::OnceClosure callback) {}

void LocalFileSyncContext::AddOriginChangeObserver(
    LocalOriginChangeObserver* observer) {}

void LocalFileSyncContext::RemoveOriginChangeObserver(
    LocalOriginChangeObserver* observer) {}

base::WeakPtr<SyncableFileOperationRunner>
LocalFileSyncContext::operation_runner() const {}

LocalFileSyncStatus* LocalFileSyncContext::sync_status() const {}

void LocalFileSyncContext::OnSyncEnabled(const FileSystemURL& url) {}

void LocalFileSyncContext::OnWriteEnabled(const FileSystemURL& url) {}

LocalFileSyncContext::~LocalFileSyncContext() {}

void LocalFileSyncContext::ScheduleNotifyChangesUpdatedOnIOThread(
    base::OnceClosure callback) {}

void LocalFileSyncContext::NotifyAvailableChangesOnIOThread() {}

void LocalFileSyncContext::NotifyAvailableChanges(
    const std::set<GURL>& origins,
    std::vector<base::OnceClosure> callbacks) {}

void LocalFileSyncContext::ShutdownOnIOThread() {}

void LocalFileSyncContext::InitializeFileSystemContextOnIOThread(
    const GURL& source_url,
    FileSystemContext* file_system_context,
    const GURL& /* root */,
    const std::string& /* name */,
    base::File::Error error) {}

SyncStatusCode LocalFileSyncContext::InitializeChangeTrackerOnFileThread(
    std::unique_ptr<LocalFileChangeTracker>* tracker_ptr,
    FileSystemContext* file_system_context,
    std::set<GURL>* origins_with_changes) {}

void LocalFileSyncContext::DidInitializeChangeTrackerOnIOThread(
    std::unique_ptr<LocalFileChangeTracker>* tracker_ptr,
    const GURL& source_url,
    FileSystemContext* file_system_context,
    std::set<GURL>* origins_with_changes,
    SyncStatusCode status) {}

void LocalFileSyncContext::DidInitialize(
    const GURL& source_url,
    FileSystemContext* file_system_context,
    SyncStatusCode status) {}

std::unique_ptr<LocalFileSyncContext::FileSystemURLQueue>
LocalFileSyncContext::GetNextURLsForSyncOnFileThread(
    FileSystemContext* file_system_context) {}

void LocalFileSyncContext::TryPrepareForLocalSync(
    FileSystemContext* file_system_context,
    LocalFileSyncInfoCallback callback,
    std::unique_ptr<FileSystemURLQueue> urls) {}

void LocalFileSyncContext::DidTryPrepareForLocalSync(
    FileSystemContext* file_system_context,
    std::unique_ptr<FileSystemURLQueue> remaining_urls,
    LocalFileSyncInfoCallback callback,
    SyncStatusCode status,
    const LocalFileSyncInfo& sync_file_info,
    storage::ScopedFile snapshot) {}

void LocalFileSyncContext::PromoteDemotedChangesForURL(
    FileSystemContext* file_system_context,
    const FileSystemURL& url) {}

void LocalFileSyncContext::PromoteDemotedChangesForURLs(
    FileSystemContext* file_system_context,
    std::unique_ptr<FileSystemURLQueue> urls) {}

void LocalFileSyncContext::DidGetWritingStatusForSync(
    FileSystemContext* file_system_context,
    SyncStatusCode status,
    const FileSystemURL& url,
    SyncMode sync_mode,
    LocalFileSyncInfoCallback callback) {}

void LocalFileSyncContext::ClearSyncFlagOnIOThread(
    const FileSystemURL& url,
    bool for_snapshot_sync) {}

void LocalFileSyncContext::FinalizeSnapshotSyncOnIOThread(
    const FileSystemURL& url) {}

void LocalFileSyncContext::DidApplyRemoteChange(
    const FileSystemURL& url,
    SyncStatusCallback callback_on_ui,
    base::File::Error file_error) {}

void LocalFileSyncContext::DidGetFileMetadata(
    SyncFileMetadataCallback callback,
    base::File::Error file_error,
    const base::File::Info& file_info) {}

base::TimeDelta LocalFileSyncContext::NotifyChangesDuration() {}

void LocalFileSyncContext::DidCreateDirectoryForCopyIn(
    FileSystemContext* file_system_context,
    const base::FilePath& local_path,
    const FileSystemURL& dest_url,
    StatusCallback callback,
    base::File::Error error) {}

}  // namespace sync_file_system