| 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 <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 | 176 |
| 177 // Sets a remote change processor. This must be called before any | 177 // Sets a remote change processor. This must be called before any |
| 178 // ProcessRemoteChange(). | 178 // ProcessRemoteChange(). |
| 179 virtual void SetRemoteChangeProcessor( | 179 virtual void SetRemoteChangeProcessor( |
| 180 RemoteChangeProcessor* processor) = 0; | 180 RemoteChangeProcessor* processor) = 0; |
| 181 | 181 |
| 182 // Returns a LocalChangeProcessor that applies a local change to the remote | 182 // Returns a LocalChangeProcessor that applies a local change to the remote |
| 183 // storage backed by this service. | 183 // storage backed by this service. |
| 184 virtual LocalChangeProcessor* GetLocalChangeProcessor() = 0; | 184 virtual LocalChangeProcessor* GetLocalChangeProcessor() = 0; |
| 185 | 185 |
| 186 // Returns true if the file |url| is marked conflicted in the remote service. | |
| 187 virtual bool IsConflicting(const fileapi::FileSystemURL& url) = 0; | |
| 188 | |
| 189 // Returns the current remote service state (should equal to the value | 186 // Returns the current remote service state (should equal to the value |
| 190 // returned by the last OnRemoteServiceStateUpdated notification. | 187 // returned by the last OnRemoteServiceStateUpdated notification. |
| 191 virtual RemoteServiceState GetCurrentState() const = 0; | 188 virtual RemoteServiceState GetCurrentState() const = 0; |
| 192 | 189 |
| 193 // Returns all origins along with an arbitrary string description of their | 190 // Returns all origins along with an arbitrary string description of their |
| 194 // corresponding sync statuses. | 191 // corresponding sync statuses. |
| 195 virtual void GetOriginStatusMap(OriginStatusMap* status_map) = 0; | 192 virtual void GetOriginStatusMap(OriginStatusMap* status_map) = 0; |
| 196 | 193 |
| 197 // Returns file metadata for |origin| to call |callback|. | 194 // Returns file metadata for |origin| to call |callback|. |
| 198 virtual void DumpFiles(const GURL& origin, | 195 virtual void DumpFiles(const GURL& origin, |
| 199 const ListCallback& callback) = 0; | 196 const ListCallback& callback) = 0; |
| 200 | 197 |
| 201 // Returns the dump of internal database. | 198 // Returns the dump of internal database. |
| 202 virtual void DumpDatabase(const ListCallback& callback) = 0; | 199 virtual void DumpDatabase(const ListCallback& callback) = 0; |
| 203 | 200 |
| 204 // Enables or disables the background sync. | 201 // Enables or disables the background sync. |
| 205 // Setting this to false should disable the synchronization (and make | 202 // Setting this to false should disable the synchronization (and make |
| 206 // the service state to REMOTE_SERVICE_DISABLED), while setting this to | 203 // the service state to REMOTE_SERVICE_DISABLED), while setting this to |
| 207 // true does not necessarily mean the service is actually turned on | 204 // true does not necessarily mean the service is actually turned on |
| 208 // (for example if Chrome is offline the service state will become | 205 // (for example if Chrome is offline the service state will become |
| 209 // REMOTE_SERVICE_TEMPORARY_UNAVAILABLE). | 206 // REMOTE_SERVICE_TEMPORARY_UNAVAILABLE). |
| 210 virtual void SetSyncEnabled(bool enabled) = 0; | 207 virtual void SetSyncEnabled(bool enabled) = 0; |
| 211 | 208 |
| 212 // Sets the conflict resolution policy. Returns SYNC_STATUS_OK on success, | |
| 213 // or returns an error code if the given policy is not supported or had | |
| 214 // an error. | |
| 215 virtual SyncStatusCode SetDefaultConflictResolutionPolicy( | |
| 216 ConflictResolutionPolicy policy) = 0; | |
| 217 virtual SyncStatusCode SetConflictResolutionPolicy( | |
| 218 const GURL& origin, | |
| 219 ConflictResolutionPolicy policy) = 0; | |
| 220 | |
| 221 // Gets the conflict resolution policy. | |
| 222 virtual ConflictResolutionPolicy GetDefaultConflictResolutionPolicy() | |
| 223 const = 0; | |
| 224 virtual ConflictResolutionPolicy GetConflictResolutionPolicy( | |
| 225 const GURL& origin) const = 0; | |
| 226 | |
| 227 // Returns a list of remote versions with their metadata. | |
| 228 // This method is typically called for a file which is in conflicting state. | |
| 229 virtual void GetRemoteVersions( | |
| 230 const fileapi::FileSystemURL& url, | |
| 231 const RemoteVersionsCallback& callback) = 0; | |
| 232 | |
| 233 // Downloads the remote image. The |id| should be the ID string for a | |
| 234 // version returned by GetRemoteVersions. | |
| 235 virtual void DownloadRemoteVersion( | |
| 236 const fileapi::FileSystemURL& url, | |
| 237 const std::string& id, | |
| 238 const DownloadVersionCallback& callback) = 0; | |
| 239 | |
| 240 virtual void PromoteDemotedChanges() = 0; | 209 virtual void PromoteDemotedChanges() = 0; |
| 241 | 210 |
| 242 private: | 211 private: |
| 243 DISALLOW_COPY_AND_ASSIGN(RemoteFileSyncService); | 212 DISALLOW_COPY_AND_ASSIGN(RemoteFileSyncService); |
| 244 }; | 213 }; |
| 245 | 214 |
| 246 } // namespace sync_file_system | 215 } // namespace sync_file_system |
| 247 | 216 |
| 248 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_REMOTE_FILE_SYNC_SERVICE_H_ | 217 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_REMOTE_FILE_SYNC_SERVICE_H_ |
| OLD | NEW |