#include "chrome/browser/sync_file_system/drive_backend/remote_to_local_syncer.h"
#include <stdint.h>
#include <limits>
#include <memory>
#include <utility>
#include "base/check_op.h"
#include "base/files/file_util.h"
#include "base/format_macros.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/location.h"
#include "base/memory/ptr_util.h"
#include "base/notreached.h"
#include "base/strings/stringprintf.h"
#include "chrome/browser/sync_file_system/drive_backend/callback_helper.h"
#include "chrome/browser/sync_file_system/drive_backend/drive_backend_util.h"
#include "chrome/browser/sync_file_system/drive_backend/metadata_database.h"
#include "chrome/browser/sync_file_system/drive_backend/sync_engine_context.h"
#include "chrome/browser/sync_file_system/drive_backend/sync_task_manager.h"
#include "chrome/browser/sync_file_system/drive_backend/sync_task_token.h"
#include "chrome/browser/sync_file_system/drive_backend/task_dependency_manager.h"
#include "chrome/browser/sync_file_system/logger.h"
#include "chrome/browser/sync_file_system/syncable_file_system_util.h"
#include "components/drive/drive_api_util.h"
#include "components/drive/service/drive_service_interface.h"
#include "extensions/common/extension.h"
#include "google_apis/drive/drive_api_parser.h"
#include "storage/common/file_system/file_system_util.h"
namespace sync_file_system {
namespace drive_backend {
namespace {
bool BuildFileSystemURL(MetadataDatabase* metadata_database,
const FileTracker& tracker,
storage::FileSystemURL* url) { … }
bool HasFolderAsParent(const FileDetails& details,
const std::string& folder_id) { … }
bool HasDisabledAppRoot(MetadataDatabase* database,
const FileTracker& tracker) { … }
std::unique_ptr<FileMetadata> GetFileMetadata(MetadataDatabase* database,
const std::string& file_id) { … }
storage::ScopedFile CreateTemporaryFile(
const scoped_refptr<base::TaskRunner>& file_task_runner) { … }
}
RemoteToLocalSyncer::RemoteToLocalSyncer(SyncEngineContext* sync_context)
: … { … }
RemoteToLocalSyncer::~RemoteToLocalSyncer() { … }
void RemoteToLocalSyncer::RunPreflight(std::unique_ptr<SyncTaskToken> token) { … }
void RemoteToLocalSyncer::ResolveRemoteChange(
std::unique_ptr<SyncTaskToken> token) { … }
void RemoteToLocalSyncer::MoveToBackground(std::unique_ptr<SyncTaskToken> token,
Continuation continuation) { … }
void RemoteToLocalSyncer::ContinueAsBackgroundTask(
Continuation continuation,
std::unique_ptr<SyncTaskToken> token) { … }
void RemoteToLocalSyncer::HandleMissingRemoteMetadata(
std::unique_ptr<SyncTaskToken> token) { … }
void RemoteToLocalSyncer::DidGetRemoteMetadata(
std::unique_ptr<SyncTaskToken> token,
google_apis::ApiErrorCode error,
std::unique_ptr<google_apis::FileResource> entry) { … }
void RemoteToLocalSyncer::DidPrepareForAddOrUpdateFile(
std::unique_ptr<SyncTaskToken> token,
SyncStatusCode status) { … }
void RemoteToLocalSyncer::HandleFolderUpdate(
std::unique_ptr<SyncTaskToken> token) { … }
void RemoteToLocalSyncer::DidPrepareForFolderUpdate(
std::unique_ptr<SyncTaskToken> token,
SyncStatusCode status) { … }
void RemoteToLocalSyncer::HandleDeletion(std::unique_ptr<SyncTaskToken> token) { … }
void RemoteToLocalSyncer::HandleFileMove(std::unique_ptr<SyncTaskToken> token) { … }
void RemoteToLocalSyncer::DidPrepareForDeletion(
std::unique_ptr<SyncTaskToken> token,
SyncStatusCode status) { … }
void RemoteToLocalSyncer::HandleContentUpdate(
std::unique_ptr<SyncTaskToken> token) { … }
void RemoteToLocalSyncer::ListFolderContent(
std::unique_ptr<SyncTaskToken> token) { … }
void RemoteToLocalSyncer::DidListFolderContent(
std::unique_ptr<SyncTaskToken> token,
std::unique_ptr<FileIDList> children,
google_apis::ApiErrorCode error,
std::unique_ptr<google_apis::FileList> file_list) { … }
void RemoteToLocalSyncer::SyncCompleted(std::unique_ptr<SyncTaskToken> token,
SyncStatusCode status) { … }
void RemoteToLocalSyncer::FinalizeSync(std::unique_ptr<SyncTaskToken> token,
SyncStatusCode status) { … }
void RemoteToLocalSyncer::Prepare(SyncStatusCallback callback) { … }
void RemoteToLocalSyncer::DidPrepare(SyncStatusCallback callback,
SyncStatusCode status,
const SyncFileMetadata& local_metadata,
const FileChangeList& local_changes) { … }
void RemoteToLocalSyncer::DeleteLocalFile(
std::unique_ptr<SyncTaskToken> token) { … }
void RemoteToLocalSyncer::DownloadFile(std::unique_ptr<SyncTaskToken> token) { … }
void RemoteToLocalSyncer::DidDownloadFile(std::unique_ptr<SyncTaskToken> token,
storage::ScopedFile file,
google_apis::ApiErrorCode error,
const base::FilePath&) { … }
void RemoteToLocalSyncer::DidApplyDownload(std::unique_ptr<SyncTaskToken> token,
storage::ScopedFile,
SyncStatusCode status) { … }
void RemoteToLocalSyncer::CreateFolder(std::unique_ptr<SyncTaskToken> token) { … }
drive::DriveServiceInterface* RemoteToLocalSyncer::drive_service() { … }
MetadataDatabase* RemoteToLocalSyncer::metadata_database() { … }
RemoteChangeProcessor* RemoteToLocalSyncer::remote_change_processor() { … }
SyncStatusCallback RemoteToLocalSyncer::SyncCompletedCallback(
std::unique_ptr<SyncTaskToken> token) { … }
}
}