1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_OPERATION_DELEGATE_H_
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_OPERATION_DELEGATE_H_
8 #include "chrome/browser/chromeos/drive/file_errors.h"
19 namespace file_system
{
21 // Error type of sync client.
22 // Keep it synced with "DriveSyncErrorType" in file_manager_private.idl.
23 enum DriveSyncErrorType
{
24 // Request to delete a file without permission.
25 DRIVE_SYNC_ERROR_DELETE_WITHOUT_PERMISSION
,
26 // Google Drive is temporary unavailable.
27 DRIVE_SYNC_ERROR_SERVICE_UNAVAILABLE
,
28 // Errors other than above ones. No fallback is provided for the error.
29 DRIVE_SYNC_ERROR_MISC
,
32 // Passes notifications from Drive operations back to the file system.
33 class OperationDelegate
{
35 // Sent when a content of a directory has been changed.
36 // |directory_path| is a virtual directory path representing the
38 virtual void OnFileChangedByOperation(const FileChange
& changed_files
) {}
40 // Sent when an entry is updated and sync is needed. The passed |context| is
42 virtual void OnEntryUpdatedByOperation(const ClientContext
& context
,
43 const std::string
& local_id
) {}
45 // Sent when a specific drive sync error occurred.
46 // |local_id| is the local ID of the resource entry.
47 virtual void OnDriveSyncError(DriveSyncErrorType type
,
48 const std::string
& local_id
) {}
50 // Waits for the sync task to complete and runs the callback.
51 // Returns false if no task is found for the spcecified ID.
52 virtual bool WaitForSyncComplete(const std::string
& local_id
,
53 const FileOperationCallback
& callback
);
56 } // namespace file_system
59 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_OPERATION_DELEGATE_H_