Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Side by Side Diff: chrome/browser/sync_file_system/remote_file_provider.h

Issue 11187021: Add RemoteFileSyncService interface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: +DCHECK Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_REMOTE_FILE_PROVIDER_H_
6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_REMOTE_FILE_PROVIDER_H_
7
8 #include "webkit/fileapi/syncable/sync_status_code.h"
9
10 class FilePath;
11 class GURL;
12
13 namespace fileapi {
14 class FileSystemURL;
15 }
16
17 namespace sync_file_system {
18
19 class RemoteFileProvider;
20
21 class RemoteChange {
22 public:
23 // Returns URL that the change happened at.
24 virtual const fileapi::FileSystemURL& url() = 0;
25
26 // Returns true if the change deleted the file.
27 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
28 };
29
30 class RemoteFileObserver {
31 public:
32 // Called when RemoteFileProvider has pending RemoteChange.
33 virtual void OnRemoteChangeAvailable(
34 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
35 };
36
37 class RemoteFileProvider {
38 public:
39 typedef base::Callback<void(fileapi::SyncStatusCode status,
40 const FilePath& temp_file)> DownloadCallback;
41 typedef base::Callback<void(fileapi::SyncStatusCode status)> StatusCallback;
42
43 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.
44 virtual void ResetObserver() = 0;
45
46 // Registers |origin| as tracking origin.
47 // After this method is called, GetRemoteChange() returns remote-side changes
48 // for the origin.
49 virtual void RegisterOrigin(const GURL& origin) = 0;
50
51 // Unregisters |origin| as tracking origin.
52 // After this method is called, GetRemoteChange() doesn't return remote-side
kinuko 2012/10/17 09:22:57 ... GetRemoteChange() won't include ... ?
53 // changes for the origin.
54 virtual void UnregisterOrigin(const GURL& origin) = 0;
55
56 // Returns true if it has a pending remote change.
57 virtual bool HasRemoteChange() = 0;
58
59 // Returns remote change for a tracking origin.
60 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.
61
62 // 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.
63 virtual void ChangeApplied(const RemoteChange& change) = 0;
64
65 // Downloads the remote file for |url|. Upon completion, |callback| is
66 // 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.
67 virtual void DownloadFile(const fileapi::FileSystemURL& url,
68 const DownloadCallback& callback) = 0;
69
70 // Deletes the remote file for |url|. Upon completion, |callback| is
71 // invoked with status.
72 virtual void DeleteFile(const fileapi::FileSystemURL& url,
73 const StatusCallback& callback) = 0;
74
75 // Upload the file at |file_path| and update the remote file for |url|.
76 // 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.
77 virtual void UploadFile(const fileapi::FileSystemURL& url,
78 const FilePath& file_path,
79 const StatusCallback& callback) = 0;
80
81 private:
82 DISALLOW_COPY_AND_ASSIGN(RemoteFileProvider);
83 };
84
85 } // namespace sync_file_system
86
87 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_REMOTE_FILE_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698