Chromium Code Reviews| Index: chrome/browser/sync_file_system/remote_file_sync_service.h |
| diff --git a/chrome/browser/sync_file_system/remote_file_sync_service.h b/chrome/browser/sync_file_system/remote_file_sync_service.h |
| index 2325eb06523e08473c74a9eedb311ce26b972dd2..fe62981c388e397e23bb45fce310303c34d5b3a9 100644 |
| --- a/chrome/browser/sync_file_system/remote_file_sync_service.h |
| +++ b/chrome/browser/sync_file_system/remote_file_sync_service.h |
| @@ -16,6 +16,28 @@ namespace sync_file_system { |
| class RemoteChangeProcessor; |
| class LocalChangeProcessor; |
| +enum RemoteServiceState { |
| + // Remote service is up and running, or has not seen any errors yet. |
| + // The consumer of this service can make new requests while the |
| + // service is in this state. |
| + REMOTE_SERVICE_OK, |
| + |
| + // Remote service is temporarily unavailable due to network, |
| + // authentication or some other temporary failure. |
| + // This state may be automatically resolved when the underlying |
| + // network condition or service condition changes. |
| + // The consumer of this service can still make new requests but |
| + // they may fail (with recoverable error code). |
| + REMOTE_SERVICE_TEMPORARY_UNAVAILABLE, |
| + |
| + // Remote service is disabled due to unrecoverable errors, e.g. |
| + // local database corruption, no available account on the remote |
|
tzik
2012/11/16 05:21:51
maybe, "no available account" causes authenticatio
kinuko
2012/11/16 05:45:02
Per offline chat I added yet another AUTHENTICATIO
|
| + // service side etc. |
| + // Any new requests will immediately fail when the service is in |
| + // this state. |
| + REMOTE_SERVICE_DISABLED, |
| +}; |
| + |
| // This class represents a backing service of the sync filesystem. |
| // This also maintains conflict information, i.e. a list of conflicting files |
| // (at least in the current design). |
| @@ -33,9 +55,10 @@ class RemoteFileSyncService { |
| // value. |
| virtual void OnRemoteChangeAvailable(int64 pending_changes_hint) = 0; |
| - // This is called when RemoteFileSyncService changes its status. |
| - virtual void OnRemoteSyncStatusChanged( |
| - fileapi::SyncStatusCode new_status) {} |
| + // This is called when RemoteFileSyncService updates its state. |
| + virtual void OnRemoteServiceStateUpdated( |
| + RemoteServiceState state, |
| + const std::string& description) {} |
|
tzik
2012/11/16 05:21:51
Could you add getters for state and description?
kinuko
2012/11/16 05:45:02
Per offline chat I didn't add them for now. (Let's
|
| private: |
| DISALLOW_COPY_AND_ASSIGN(Observer); |
| @@ -49,12 +72,18 @@ class RemoteFileSyncService { |
| // Registers |origin| to track remote side changes for the |origin|. |
| // Upon completion, invokes |callback|. |
| + // The caller may call this method again when the remote service state |
| + // migrates to REMOTE_SERVICE_OK state if the error code returned via |
| + // |callback| was retriable ones. |
| virtual void RegisterOriginForTrackingChanges( |
| const GURL& origin, |
| const fileapi::SyncStatusCallback& callback) = 0; |
| // Unregisters |origin| to track remote side changes for the |origin|. |
| // Upon completion, invokes |callback|. |
| + // The caller may call this method again when the remote service state |
| + // migrates to REMOTE_SERVICE_OK state if the error code returned via |
| + // |callback| was retriable ones. |
| virtual void UnregisterOriginForTrackingChanges( |
| const GURL& origin, |
| const fileapi::SyncStatusCallback& callback) = 0; |