| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 namespace syncFileSystem { |
| 6 |
| 7 enum SyncOperationResult { |
| 8 added, updated, deleted, conflicted |
| 9 }; |
| 10 |
| 11 enum SyncStateStatus { |
| 12 // The sync service is being initialized (e.g. restoring data from the |
| 13 // database, checking connectivity and authenticating to the service etc). |
| 14 initializing, |
| 15 |
| 16 // The sync service is up and running. |
| 17 running, |
| 18 |
| 19 // The sync service is not synchronizing files because the remote service |
| 20 // needs to be authenticated by the user to proceed. |
| 21 authentication_required, |
| 22 |
| 23 // The sync service is not synchronizing files because the remote service |
| 24 // is (temporarily) unavailable due to some recoverable errors, e.g. |
| 25 // network is offline, the remote service is down or not |
| 26 // reachable etc. More details should be given by |description| parameter |
| 27 // in OnSyncStateUpdated (which could contain service-specific details). |
| 28 temporary_unavailable, |
| 29 |
| 30 // The sync service is disabled and the content will never sync. |
| 31 // (E.g. this could happen when the user has no account on |
| 32 // the remote service or the sync service has had an unrecoverable |
| 33 // error.) |
| 34 disabled |
| 35 }; |
| 36 |
| 37 enum FileSyncStatus { |
| 38 // Not conflicting and has no pending local changes. |
| 39 synced, |
| 40 |
| 41 // Has one or more pending local changes that haven't been synchronized. |
| 42 pending, |
| 43 |
| 44 // File conflicts with remote version and must be resolved manually. |
| 45 conflicting |
| 46 }; |
| 47 |
| 48 dictionary StorageInfo { |
| 49 long usage_bytes; |
| 50 long quota_bytes; |
| 51 }; |
| 52 |
| 53 dictionary SyncState { |
| 54 DOMString service_name; // i.e. ‘drive’ |
| 55 SyncStateStatus state; |
| 56 DOMString description; |
| 57 }; |
| 58 |
| 59 // [nodoc] A callback type for requestFileSystem. |
| 60 callback GetFileSystemCallback = |
| 61 void ([instanceOf=DOMFileSystem] object fileSystem); |
| 62 |
| 63 // [nodoc] A callback type for getUsageAndQuota. |
| 64 callback QuotaAndUsageCallback = void (StorageInfo info); |
| 65 |
| 66 // Returns true if operation was successful. |
| 67 callback DeleteFileSystemCallback = void (boolean result); |
| 68 |
| 69 // [nodoc] A callback type for getFileSyncStatus. |
| 70 callback GetFileSyncStatusCallback = void (FileSyncStatus status); |
| 71 |
| 72 interface Functions { |
| 73 // Get a sync file system backed by |serviceName|. |
| 74 // Calling this multiple times from the same app with the same |serviceName| |
| 75 // will return the same handle to the same file system. |
| 76 static void requestFileSystem(DOMString serviceName, |
| 77 GetFileSystemCallback callback); |
| 78 |
| 79 // Get usage and quota in bytes for sync file system with |serviceName|. |
| 80 static void getUsageAndQuota([instanceOf=DOMFileSystem] object fileSystem, |
| 81 QuotaAndUsageCallback callback); |
| 82 |
| 83 // Deletes everything in the syncable filesystem. |
| 84 static void deleteFileSystem([instanceOf=DOMFileSystem] object fileSystem, |
| 85 DeleteFileSystemCallback callback); |
| 86 |
| 87 // Get the FileSyncStatus for the given |fileEntry|. |
| 88 static void getFileSyncStatus([instanceOf=FileEntry] object fileEntry, |
| 89 GetFileSyncStatusCallback callback); |
| 90 }; |
| 91 |
| 92 interface Events { |
| 93 // Fired when an error or other state change has happened in the |
| 94 // sync backend. (e.g. the sync is temporarily disabled due to |
| 95 // network or authentication error etc). |
| 96 static void onSyncStateChanged(SyncState detail); |
| 97 |
| 98 // Fired when a file has been updated by the background sync service. |
| 99 // TODO(calvinlo): Convert |file_entry_path| from to Webkit FileEntry. |
| 100 static void onFileSynced(DOMString file_entry_path, |
| 101 SyncOperationResult result); |
| 102 }; |
| 103 |
| 104 }; |
| OLD | NEW |