| Index: chrome/browser/sync_file_system/drive_backend/remote_to_local_syncer.h
|
| diff --git a/chrome/browser/sync_file_system/drive_backend/remote_to_local_syncer.h b/chrome/browser/sync_file_system/drive_backend/remote_to_local_syncer.h
|
| index 9666375025598a2918ef5c987e9e5b89edebf9fb..06c7b83b4e288dce4d19296a840a3f80d78090bf 100644
|
| --- a/chrome/browser/sync_file_system/drive_backend/remote_to_local_syncer.h
|
| +++ b/chrome/browser/sync_file_system/drive_backend/remote_to_local_syncer.h
|
| @@ -41,37 +41,110 @@ class RemoteToLocalSyncer : public SyncTask {
|
| RemoteToLocalSyncer(SyncEngineContext* sync_context,
|
| int priorities);
|
| virtual ~RemoteToLocalSyncer();
|
| +
|
| virtual void Run(const SyncStatusCallback& callback) OVERRIDE;
|
|
|
| private:
|
| - void AnalyzeCurrentDirtyTracker();
|
| -
|
| + // Dispatches remote change to handlers or to SyncCompleted() directly.
|
| + // This function uses information only in MetadataDatabase.
|
| + //
|
| + // If the tracker doesn't have remote metadata:
|
| + // # The file is listed in a folder right before this operation.
|
| + // - Dispatch to HandleMissingRemoteMetadata to fetch remote metadata.
|
| + // Else, if the tracker is not active or the dominating app-root is disabled:
|
| + // # Assume the file has remote metadata.
|
| + // - Dispatch to HandleInactiveTracker() to resolve offline solvable
|
| + // dirtiness.
|
| + // Else, if the tracker doesn't have synced metadata:
|
| + // # Assume the tracker has remote metadata and the tracker is active.
|
| + // # The tracker is not yet synced ever.
|
| + // - If the file is remotely deleted, do nothing to local file and dispatch
|
| + // directly to SyncCompleted().
|
| + // - Else, if the file is a regular file, dispatch to HandleNewFile().
|
| + // - Else, if the file is a folder, dispatch to HandleNewFolder().
|
| + // - Else, the file should be an unsupported active file. This should not
|
| + // happen.
|
| + // Else, if the remote metadata is marked as deleted:
|
| + // # Most of the remote metadata is missing including title, kind and md5.
|
| + // - Dispatch to HandleDeletion().
|
| + // Else, if the tracker has different titles between its synced metadata and
|
| + // remote metadata:
|
| + // # Assume the tracker is active and has remote metetadata and synced
|
| + // metadata.
|
| + // # The file is remotely renamed.
|
| + // # Maybe, this can be decomposed to delete and update.
|
| + // - Dispatch to HandleRemoteRename().
|
| + // Else, if the tracker's parent is not a parent of the remote metadata:
|
| + // # The file has reorganized.
|
| + // # Maybe, this can be decomposed to delete and update.
|
| + // - Dispatch to HandreReorganize().
|
| + // Else, if the folder is a regular file and the md5 in remote metadata does
|
| + // not match the md5 in synced metadata:
|
| + // # The file is modified remotely.
|
| + // - Dispatch to HandleContentUpdate().
|
| + // Else, if the tracker is a folder and it has needs_folder_listing flag:
|
| + // - Dispatch to HandleFolderContentListing()
|
| + // Else, there should be no change to sync.
|
| + // - Dispatch to HandleOfflineSolvable()
|
| void ResolveRemoteChange(const SyncStatusCallback& callback);
|
|
|
| - void GetRemoteResource(const SyncStatusCallback& callback);
|
| - void DidGetRemoteResource(const SyncStatusCallback& callback,
|
| + // Handles missing remote metadata case.
|
| + // Fetches remote metadata and updates MetadataDatabase by that. The sync
|
| + // operation itself will be deferred to the next sync round.
|
| + // Note: if the file is not found, it should be handled as if deleted.
|
| + void HandleMissingRemoteMetadata(const SyncStatusCallback& callback);
|
| + void DidGetRemoteMetadata(const SyncStatusCallback& callback,
|
| int64 change_id,
|
| google_apis::GDataErrorCode error,
|
| scoped_ptr<google_apis::ResourceEntry> entry);
|
| + void DidUpdateDatabaseForRemoteMetadata(const SyncStatusCallback& callback,
|
| + SyncStatusCode status);
|
|
|
| - void HandleDeletion(const SyncStatusCallback& callback);
|
| - void DidPrepareForDeletion(const SyncStatusCallback& callback,
|
| - SyncStatusCode status);
|
| + // Handles modification to inactive or disabled-app tracker.
|
| + // TODO(tzik): Write details and implement this.
|
| + void HandleInactiveTracker(const SyncStatusCallback& callback);
|
|
|
| + // Handles remotely added file. Needs Prepare() call.
|
| + // TODO(tzik): Write details and implement this.
|
| void HandleNewFile(const SyncStatusCallback& callback);
|
| void DidPrepareForNewFile(const SyncStatusCallback& callback,
|
| SyncStatusCode status);
|
|
|
| + // Handles remotely added folder. Needs Prepare() call.
|
| + // TODO(tzik): Write details and implement this.
|
| + void HandleNewFolder(const SyncStatusCallback& callback);
|
| +
|
| + // Handles deleted remote file. Needs Prepare() call.
|
| + // If the deleted tracker is the sync-root:
|
| + // - TODO(tzik): Needs special handling.
|
| + // Else, if the deleted tracker is a app-root:
|
| + // - TODO(tzik): Needs special handling.
|
| + // Else, if the local file is already deleted:
|
| + // - Do nothing anymore to the local, call SyncCompleted().
|
| + // Else, if the local file is modified:
|
| + // - Do nothing to the local file, call SyncCompleted().
|
| + // Else, if the local file is not modified:
|
| + // - Delete local file.
|
| + // # Note: if the local file is a folder, delete recursively.
|
| + void HandleDeletion(const SyncStatusCallback& callback);
|
| + void DidPrepareForDeletion(const SyncStatusCallback& callback,
|
| + SyncStatusCode status);
|
| +
|
| + // TODO(tzik): Write details and implement this.
|
| + void HandleRename(const SyncStatusCallback& callback);
|
| +
|
| + // TODO(tzik): Write details and implement this.
|
| + void HandleReorganize(const SyncStatusCallback& callback);
|
| +
|
| + // Handles new file. Needs Prepare() call.
|
| void HandleContentUpdate(const SyncStatusCallback& callback);
|
| void DidPrepareForContentUpdate(const SyncStatusCallback& callback,
|
| SyncStatusCode status);
|
|
|
| - void ListFolderContent(const SyncStatusCallback& callback);
|
| + void HandleFolderContentListing(const SyncStatusCallback& callback);
|
| void DidPrepareForFolderListing(const SyncStatusCallback& callback,
|
| SyncStatusCode status);
|
|
|
| - void HandleRename(const SyncStatusCallback& callback);
|
| - void HandleReorganize(const SyncStatusCallback& callback);
|
| void HandleOfflineSolvable(const SyncStatusCallback& callback);
|
|
|
| void SyncCompleted(const SyncStatusCallback& callback);
|
| @@ -93,20 +166,8 @@ class RemoteToLocalSyncer : public SyncTask {
|
| SyncEngineContext* sync_context_; // Not owned.
|
|
|
| int priorities_;
|
| - FileTracker dirty_tracker_;
|
| - FileTracker parent_tracker_;
|
| - FileMetadata remote_metadata_;
|
| -
|
| - bool missing_remote_details_;
|
| - bool missing_synced_details_;
|
| - bool deleted_remote_details_;
|
| - bool deleted_synced_details_;
|
| - bool title_changed_;
|
| - bool content_changed_;
|
| - bool needs_folder_listing_;
|
| - bool missing_parent_;
|
| -
|
| - bool sync_root_modification_;
|
| + scoped_ptr<FileTracker> dirty_tracker_;
|
| + scoped_ptr<FileMetadata> remote_metadata_;
|
|
|
| fileapi::FileSystemURL url_;
|
|
|
|
|