Roll src/third_party/WebKit 9f7fb92:f103b33 (svn 202621:202622)
[chromium-blink-merge.git] / components / drive / file_system / operation_delegate.h
blobec1de18e4e54df9a4bffb677d020ba220e485cff
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 COMPONENTS_DRIVE_FILE_SYSTEM_OPERATION_DELEGATE_H_
6 #define COMPONENTS_DRIVE_FILE_SYSTEM_OPERATION_DELEGATE_H_
8 #include "components/drive/file_errors.h"
10 namespace base {
11 class FilePath;
14 namespace drive {
16 struct ClientContext;
17 class FileChange;
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 // There is no server space to sync a file.
29 DRIVE_SYNC_ERROR_NO_SERVER_SPACE,
30 // Errors other than above ones. No fallback is provided for the error.
31 DRIVE_SYNC_ERROR_MISC,
34 // Passes notifications from Drive operations back to the file system.
35 class OperationDelegate {
36 public:
37 // Sent when a content of a directory has been changed.
38 // |directory_path| is a virtual directory path representing the
39 // changed directory.
40 virtual void OnFileChangedByOperation(const FileChange& changed_files) {}
42 // Sent when an entry is updated and sync is needed. The passed |context| is
43 // used for syncing.
44 virtual void OnEntryUpdatedByOperation(const ClientContext& context,
45 const std::string& local_id) {}
47 // Sent when a specific drive sync error occurred.
48 // |local_id| is the local ID of the resource entry.
49 virtual void OnDriveSyncError(DriveSyncErrorType type,
50 const std::string& local_id) {}
52 // Waits for the sync task to complete and runs the callback.
53 // Returns false if no task is found for the spcecified ID.
54 virtual bool WaitForSyncComplete(const std::string& local_id,
55 const FileOperationCallback& callback);
58 } // namespace file_system
59 } // namespace drive
61 #endif // COMPONENTS_DRIVE_FILE_SYSTEM_OPERATION_DELEGATE_H_