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_SYNC_EVENT_OBSERVER_H_ | 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_SYNC_EVENT_OBSERVER_H_ |
6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_SYNC_EVENT_OBSERVER_H_ | 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_SYNC_EVENT_OBSERVER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "webkit/fileapi/syncable/sync_status_code.h" | 10 #include "webkit/fileapi/syncable/sync_status_code.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 | 29 |
30 // A file or directory was deleted. | 30 // A file or directory was deleted. |
31 SYNC_OPERATION_DELETE, | 31 SYNC_OPERATION_DELETE, |
32 }; | 32 }; |
33 | 33 |
34 enum SyncServiceState { | 34 enum SyncServiceState { |
35 // The sync service is being initialized (e.g. restoring data from the | 35 // The sync service is being initialized (e.g. restoring data from the |
36 // database, checking connectivity and authenticating to the service etc). | 36 // database, checking connectivity and authenticating to the service etc). |
37 SYNC_SERVICE_INITIALIZING, | 37 SYNC_SERVICE_INITIALIZING, |
38 | 38 |
39 // The sync service has detected changes in local or remote side and is | 39 // The sync service is up and running. |
40 // performing file synchronization. | 40 SYNC_SERVICE_RUNNING, |
41 SYNC_SERVICE_SYNCING, | |
42 | |
43 // The sync service is up and runnable but currently is idle (i.e. no | |
44 // file activities which require sync operation in remote and local side). | |
45 SYNC_SERVICE_IDLE, | |
46 | 41 |
47 // The sync service is (temporarily) suspended due to some recoverable | 42 // The sync service is (temporarily) suspended due to some recoverable |
48 // errors, e.g. network is offline, the user is not authenticated, remote | 43 // errors, e.g. network is offline, the user is not authenticated, remote |
49 // service is down or not reachable etc. More details should be given | 44 // service is down or not reachable etc. More details should be given |
50 // by |description| parameter in OnSyncStateUpdated (which could contain | 45 // by |description| parameter in OnSyncStateUpdated (which could contain |
51 // service-specific details). | 46 // service-specific details). |
52 // TODO(kinuko): Revisit this to see if we need a separate state for | 47 // TODO(kinuko): Revisit this to see if we need a separate state for |
53 // 'auth required'. | 48 // 'auth required'. |
54 SYNC_SERVICE_TEMPORARY_UNAVAILABLE, | 49 SYNC_SERVICE_TEMPORARY_UNAVAILABLE, |
55 | 50 |
56 // The sync service is disabled and the content will never sync. | 51 // The sync service is disabled and the content will never sync. |
57 SYNC_SERVICE_DISABLED, | 52 SYNC_SERVICE_DISABLED, |
58 }; | 53 }; |
59 | 54 |
60 // Reports there was an error in the sync file system backend. | 55 // Reports there was a state change in the sync file system backend. |
61 virtual void OnSyncStateUpdated(fileapi::SyncServiceState state, | 56 virtual void OnSyncStateUpdated(fileapi::SyncServiceState state, |
62 const std::string& description) = 0; | 57 const std::string& description) = 0; |
63 | 58 |
64 // Reports the file |url| was updated for |operation| | 59 // Reports the file |url| was updated for |operation| |
65 // by the sync file system backend. | 60 // by the sync file system backend. |
66 virtual void OnFileSynced(fileapi::SyncStatusCode status, | 61 virtual void OnFileSynced(fileapi::SyncStatusCode status, |
67 SyncOperation operation, | 62 SyncOperation operation, |
68 const FileSystemURL& url) = 0; | 63 const FileSystemURL& url) = 0; |
69 | 64 |
70 private: | 65 private: |
71 DISALLOW_COPY_AND_ASSIGN(SyncEventObserver); | 66 DISALLOW_COPY_AND_ASSIGN(SyncEventObserver); |
72 }; | 67 }; |
73 | 68 |
74 } // namespace sync_file_system | 69 } // namespace sync_file_system |
75 | 70 |
76 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_SYNC_EVENT_OBSERVER_H_ | 71 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_SYNC_EVENT_OBSERVER_H_ |
OLD | NEW |