| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 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. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_OPERATION_OBSERVER_H_ | |
| 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_OPERATION_OBSERVER_H_ | |
| 7 | |
| 8 #include "chrome/browser/chromeos/drive/file_errors.h" | |
| 9 | |
| 10 namespace base { | |
| 11 class FilePath; | |
| 12 } | |
| 13 | |
| 14 namespace drive { | |
| 15 class FileChange; | |
| 16 | |
| 17 namespace file_system { | |
| 18 | |
| 19 // Error type of sync client. | |
| 20 // Keep it synced with "DriveSyncErrorType" in file_manager_private.idl. | |
| 21 enum DriveSyncErrorType { | |
| 22 // Request to delete a file without permission. | |
| 23 DRIVE_SYNC_ERROR_DELETE_WITHOUT_PERMISSION, | |
| 24 // Google Drive is temporary unavailable. | |
| 25 DRIVE_SYNC_ERROR_SERVICE_UNAVAILABLE, | |
| 26 // Errors other than above ones. No fallback is provided for the error. | |
| 27 DRIVE_SYNC_ERROR_MISC, | |
| 28 }; | |
| 29 | |
| 30 // Passes notifications from Drive operations back to the file system. | |
| 31 // TODO(hashimoto): Give this class a more appropriate name. | |
| 32 class OperationObserver { | |
| 33 public: | |
| 34 // Sent when a content of a directory has been changed. | |
| 35 // |directory_path| is a virtual directory path representing the | |
| 36 // changed directory. | |
| 37 virtual void OnFileChangedByOperation(const FileChange& changed_files) = 0; | |
| 38 | |
| 39 // Sent when an entry is updated and sync is needed. | |
| 40 virtual void OnEntryUpdatedByOperation(const std::string& local_id) {} | |
| 41 | |
| 42 // Sent when a specific drive sync error occurred. | |
| 43 // |local_id| is the local ID of the resource entry. | |
| 44 virtual void OnDriveSyncError(DriveSyncErrorType type, | |
| 45 const std::string& local_id) {} | |
| 46 | |
| 47 // Waits for the sync task to complete and runs the callback. | |
| 48 // Returns false if no task is found for the spcecified ID. | |
| 49 virtual bool WaitForSyncComplete(const std::string& local_id, | |
| 50 const FileOperationCallback& callback); | |
| 51 }; | |
| 52 | |
| 53 } // namespace file_system | |
| 54 } // namespace drive | |
| 55 | |
| 56 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_OPERATION_OBSERVER_H_ | |
| OLD | NEW |