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