| 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_SYNC_FILE_SYSTEM_REMOTE_FILE_SYNC_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_REMOTE_FILE_SYNC_SERVICE_H_ |
| 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_REMOTE_FILE_SYNC_SERVICE_H_ | 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_REMOTE_FILE_SYNC_SERVICE_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "webkit/fileapi/file_system_url.h" | 9 #include "webkit/fileapi/file_system_url.h" |
| 10 #include "webkit/fileapi/syncable/sync_callbacks.h" | 10 #include "webkit/fileapi/syncable/sync_callbacks.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 class Observer { | 25 class Observer { |
| 26 public: | 26 public: |
| 27 Observer() {} | 27 Observer() {} |
| 28 virtual ~Observer() {} | 28 virtual ~Observer() {} |
| 29 | 29 |
| 30 // This is called when there're one or more remote changes available. | 30 // This is called when there're one or more remote changes available. |
| 31 // |pending_changes_hint| indicates the pending queue length to help sync | 31 // |pending_changes_hint| indicates the pending queue length to help sync |
| 32 // scheduling but the value may not be accurately reflect the real-time | 32 // scheduling but the value may not be accurately reflect the real-time |
| 33 // value. | 33 // value. |
| 34 virtual void OnRemoteChangeAvailable(int64 pending_changes_hint) = 0; | 34 virtual void OnRemoteChangeAvailable(int64 pending_changes_hint) = 0; |
| 35 |
| 36 // This is called when RemoteFileSyncService changes its status. |
| 37 virtual void OnRemoteSyncStatusChanged( |
| 38 fileapi::SyncStatusCode new_status) {} |
| 39 |
| 35 private: | 40 private: |
| 36 DISALLOW_COPY_AND_ASSIGN(Observer); | 41 DISALLOW_COPY_AND_ASSIGN(Observer); |
| 37 }; | 42 }; |
| 38 | 43 |
| 39 RemoteFileSyncService() {} | 44 RemoteFileSyncService() {} |
| 40 virtual ~RemoteFileSyncService() {} | 45 virtual ~RemoteFileSyncService() {} |
| 41 | 46 |
| 42 virtual void AddObserver(Observer* observer) = 0; | 47 virtual void AddObserver(Observer* observer) = 0; |
| 43 virtual void RemoveObserver(Observer* observer) = 0; | 48 virtual void RemoveObserver(Observer* observer) = 0; |
| 44 | 49 |
| 45 // Registers |origin| to track remote side changes for the |origin|. | 50 // Registers |origin| to track remote side changes for the |origin|. |
| 46 virtual void RegisterOriginForTrackingChanges(const GURL& origin) = 0; | 51 // Upon completion, invokes |callback| if it's non-empty. |
| 52 virtual void RegisterOriginForTrackingChanges( |
| 53 const GURL& origin, |
| 54 const fileapi::SyncStatusCallback& callback) = 0; |
| 47 | 55 |
| 48 // Unregisters |origin| to track remote side changes for the |origin|. | 56 // Unregisters |origin| to track remote side changes for the |origin|. |
| 49 virtual void UnregisterOriginForTrackingChanges(const GURL& origin) = 0; | 57 // Upon completion, invokes |callback| if it's non-empty. |
| 58 virtual void UnregisterOriginForTrackingChanges( |
| 59 const GURL& origin, |
| 60 const fileapi::SyncStatusCallback& callback) = 0; |
| 50 | 61 |
| 51 // Called by the sync engine to process one remote change. | 62 // Called by the sync engine to process one remote change. |
| 52 // After a change is processed |callback| will be called (to return | 63 // After a change is processed |callback| will be called (to return |
| 53 // the control to the sync engine). | 64 // the control to the sync engine). |
| 54 virtual void ProcessRemoteChange( | 65 virtual void ProcessRemoteChange( |
| 55 RemoteChangeProcessor* processor, | 66 RemoteChangeProcessor* processor, |
| 56 const fileapi::SyncFileCallback& callback) = 0; | 67 const fileapi::SyncFileCallback& callback) = 0; |
| 57 | 68 |
| 58 // Returns a LocalChangeProcessor that applies a local change to the remote | 69 // Returns a LocalChangeProcessor that applies a local change to the remote |
| 59 // storage backed by this service. | 70 // storage backed by this service. |
| 60 virtual LocalChangeProcessor* GetLocalChangeProcessor() = 0; | 71 virtual LocalChangeProcessor* GetLocalChangeProcessor() = 0; |
| 61 | 72 |
| 62 // Returns a list of conflicting files for the given origin. | 73 // Returns a list of conflicting files for the given origin. |
| 63 virtual void GetConflictFiles( | 74 virtual void GetConflictFiles( |
| 64 const GURL& origin, | 75 const GURL& origin, |
| 65 const fileapi::SyncFileSetCallback& callback) = 0; | 76 const fileapi::SyncFileSetCallback& callback) = 0; |
| 66 | 77 |
| 67 // Returns the metadata of a remote file pointed by |url|. | 78 // Returns the metadata of a remote file pointed by |url|. |
| 68 virtual void GetRemoteFileMetadata( | 79 virtual void GetRemoteFileMetadata( |
| 69 const fileapi::FileSystemURL& url, | 80 const fileapi::FileSystemURL& url, |
| 70 const fileapi::SyncFileMetadataCallback& callback) = 0; | 81 const fileapi::SyncFileMetadataCallback& callback) = 0; |
| 71 | 82 |
| 72 private: | 83 private: |
| 73 DISALLOW_COPY_AND_ASSIGN(RemoteFileSyncService); | 84 DISALLOW_COPY_AND_ASSIGN(RemoteFileSyncService); |
| 74 }; | 85 }; |
| 75 | 86 |
| 76 } // namespace sync_file_system | 87 } // namespace sync_file_system |
| 77 | 88 |
| 78 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_REMOTE_FILE_SYNC_SERVICE_H_ | 89 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_REMOTE_FILE_SYNC_SERVICE_H_ |
| OLD | NEW |