Home | History | Annotate | Download | only in file_system
      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 namespace base {
      9 class FilePath;
     10 }
     11 
     12 namespace drive {
     13 namespace file_system {
     14 
     15 // Error type of sync client.
     16 // Keep it synced with "DriveSyncErrorType" in file_manager_private.idl.
     17 enum DriveSyncErrorType {
     18   // Request to delete a file without permission.
     19   DRIVE_SYNC_ERROR_DELETE_WITHOUT_PERMISSION,
     20   // Google Drive is temporary unavailable.
     21   DRIVE_SYNC_ERROR_SERVICE_UNAVAILABLE,
     22   // Errors other than above ones. No fallback is provided for the error.
     23   DRIVE_SYNC_ERROR_MISC,
     24 };
     25 
     26 // Passes notifications from Drive operations back to the file system.
     27 class OperationObserver {
     28  public:
     29   // Sent when a content of a directory has been changed.
     30   // |directory_path| is a virtual directory path representing the
     31   // changed directory.
     32   virtual void OnDirectoryChangedByOperation(
     33       const base::FilePath& directory_path) = 0;
     34 
     35   // Sent when an entry is updated and sync is needed.
     36   virtual void OnEntryUpdatedByOperation(const std::string& local_id) {}
     37 
     38   // Sent when a specific drive sync error occurred.
     39   // |local_id| is the local ID of the resource entry.
     40   virtual void OnDriveSyncError(DriveSyncErrorType type,
     41                                 const std::string& local_id) {}
     42 };
     43 
     44 }  // namespace file_system
     45 }  // namespace drive
     46 
     47 #endif  // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_OPERATION_OBSERVER_H_
     48