Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: chrome/browser/chromeos/drive/file_system/operation_observer.h

Issue 372713004: Wait for parent directory sync before performing server-side copy (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add operation_observer.cc Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_OBSERVER_H_
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_OPERATION_OBSERVER_H_ 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_OPERATION_OBSERVER_H_
7 7
8 #include "chrome/browser/chromeos/drive/file_errors.h"
9
8 namespace base { 10 namespace base {
9 class FilePath; 11 class FilePath;
10 } 12 }
11 13
12 namespace drive { 14 namespace drive {
13 class FileChange; 15 class FileChange;
14 16
15 namespace file_system { 17 namespace file_system {
16 18
17 // Error type of sync client. 19 // Error type of sync client.
18 // Keep it synced with "DriveSyncErrorType" in file_manager_private.idl. 20 // Keep it synced with "DriveSyncErrorType" in file_manager_private.idl.
19 enum DriveSyncErrorType { 21 enum DriveSyncErrorType {
20 // Request to delete a file without permission. 22 // Request to delete a file without permission.
21 DRIVE_SYNC_ERROR_DELETE_WITHOUT_PERMISSION, 23 DRIVE_SYNC_ERROR_DELETE_WITHOUT_PERMISSION,
22 // Google Drive is temporary unavailable. 24 // Google Drive is temporary unavailable.
23 DRIVE_SYNC_ERROR_SERVICE_UNAVAILABLE, 25 DRIVE_SYNC_ERROR_SERVICE_UNAVAILABLE,
24 // 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.
25 DRIVE_SYNC_ERROR_MISC, 27 DRIVE_SYNC_ERROR_MISC,
26 }; 28 };
27 29
28 // 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.
29 class OperationObserver { 32 class OperationObserver {
30 public: 33 public:
31 // Sent when a content of a directory has been changed. 34 // Sent when a content of a directory has been changed.
32 // |directory_path| is a virtual directory path representing the 35 // |directory_path| is a virtual directory path representing the
33 // changed directory. 36 // changed directory.
34 virtual void OnFileChangedByOperation(const FileChange& changed_files) = 0; 37 virtual void OnFileChangedByOperation(const FileChange& changed_files) = 0;
35 38
36 // Sent when an entry is updated and sync is needed. 39 // Sent when an entry is updated and sync is needed.
37 virtual void OnEntryUpdatedByOperation(const std::string& local_id) {} 40 virtual void OnEntryUpdatedByOperation(const std::string& local_id) {}
38 41
39 // Sent when a specific drive sync error occurred. 42 // Sent when a specific drive sync error occurred.
40 // |local_id| is the local ID of the resource entry. 43 // |local_id| is the local ID of the resource entry.
41 virtual void OnDriveSyncError(DriveSyncErrorType type, 44 virtual void OnDriveSyncError(DriveSyncErrorType type,
42 const std::string& local_id) {} 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);
43 }; 51 };
44 52
45 } // namespace file_system 53 } // namespace file_system
46 } // namespace drive 54 } // namespace drive
47 55
48 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_OPERATION_OBSERVER_H_ 56 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_OPERATION_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698