Index: chrome/browser/sync_file_system/remote_file_provider.h |
diff --git a/chrome/browser/sync_file_system/remote_file_provider.h b/chrome/browser/sync_file_system/remote_file_provider.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..79acf8e66d03b4fa6db46d52681f6275a41d3bfc |
--- /dev/null |
+++ b/chrome/browser/sync_file_system/remote_file_provider.h |
@@ -0,0 +1,87 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_REMOTE_FILE_PROVIDER_H_ |
+#define CHROME_BROWSER_SYNC_FILE_SYSTEM_REMOTE_FILE_PROVIDER_H_ |
+ |
+#include "webkit/fileapi/syncable/sync_status_code.h" |
+ |
+class FilePath; |
+class GURL; |
+ |
+namespace fileapi { |
+class FileSystemURL; |
+} |
+ |
+namespace sync_file_system { |
+ |
+class RemoteFileProvider; |
+ |
+class RemoteChange { |
+ public: |
+ // Returns URL that the change happened at. |
+ virtual const fileapi::FileSystemURL& url() = 0; |
+ |
+ // Returns true if the change deleted the file. |
+ virtual bool deleted() = 0; |
kinuko
2012/10/17 09:22:57
Is it possible to reuse fileapi::FileChange for th
tzik
2012/10/18 07:18:08
I think it's true iff we use single provider.
Whe
|
+}; |
+ |
+class RemoteFileObserver { |
+ public: |
+ // Called when RemoteFileProvider has pending RemoteChange. |
+ virtual void OnRemoteChangeAvailable( |
+ RemoteFileProvider* remote_file_provider) = 0; |
kinuko
2012/10/17 09:22:57
Maybe... for now I don't think we need this argume
tzik
2012/10/18 07:18:08
It's correct if we start from single provider, as
|
+}; |
+ |
+class RemoteFileProvider { |
+ public: |
+ typedef base::Callback<void(fileapi::SyncStatusCode status, |
+ const FilePath& temp_file)> DownloadCallback; |
+ typedef base::Callback<void(fileapi::SyncStatusCode status)> StatusCallback; |
+ |
+ virtual void SetObserver(RemoteFileObserver* observer) = 0; |
kinuko
2012/10/17 09:22:57
Can you add a comment about the expected lifetime
tzik
2012/10/18 07:18:08
Done.
|
+ virtual void ResetObserver() = 0; |
+ |
+ // Registers |origin| as tracking origin. |
+ // After this method is called, GetRemoteChange() returns remote-side changes |
+ // for the origin. |
+ virtual void RegisterOrigin(const GURL& origin) = 0; |
+ |
+ // Unregisters |origin| as tracking origin. |
+ // After this method is called, GetRemoteChange() doesn't return remote-side |
kinuko
2012/10/17 09:22:57
... GetRemoteChange() won't include ... ?
|
+ // changes for the origin. |
+ virtual void UnregisterOrigin(const GURL& origin) = 0; |
+ |
+ // Returns true if it has a pending remote change. |
+ virtual bool HasRemoteChange() = 0; |
+ |
+ // Returns remote change for a tracking origin. |
+ virtual scoped_ptr<RemoteChange> GetRemoteChange() = 0; |
kinuko
2012/10/17 09:22:57
Returns a remote change
Can you also comment what
tzik
2012/10/18 07:18:08
Done.
|
+ |
+ // Notifies RemoveFileProvider of |change| is applied local filesystem. |
kinuko
2012/10/17 09:22:57
'Notifies' may be confusing with observer related
tzik
2012/10/18 07:18:08
Done.
|
+ virtual void ChangeApplied(const RemoteChange& change) = 0; |
+ |
+ // Downloads the remote file for |url|. Upon completion, |callback| is |
+ // invoked with status and temporary file. |
kinuko
2012/10/17 09:22:57
Please comment if the temporary file needs to be d
tzik
2012/10/18 07:18:08
Done.
|
+ virtual void DownloadFile(const fileapi::FileSystemURL& url, |
+ const DownloadCallback& callback) = 0; |
+ |
+ // Deletes the remote file for |url|. Upon completion, |callback| is |
+ // invoked with status. |
+ virtual void DeleteFile(const fileapi::FileSystemURL& url, |
+ const StatusCallback& callback) = 0; |
+ |
+ // Upload the file at |file_path| and update the remote file for |url|. |
+ // Upon completion, |callback| is invoked with status. |
kinuko
2012/10/17 09:22:57
Please comment if the caller needs to make sure fi
tzik
2012/10/18 07:18:08
Done.
|
+ virtual void UploadFile(const fileapi::FileSystemURL& url, |
+ const FilePath& file_path, |
+ const StatusCallback& callback) = 0; |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(RemoteFileProvider); |
+}; |
+ |
+} // namespace sync_file_system |
+ |
+#endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_REMOTE_FILE_PROVIDER_H_ |