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

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

Issue 11421197: Implement SyncFileSystemService::GetFileSyncStatus method (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: indent fix Created 8 years 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
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_LOCAL_FILE_SYNC_SERVICE_H_ 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_FILE_SYNC_SERVICE_H_
6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_FILE_SYNC_SERVICE_H_ 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_FILE_SYNC_SERVICE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 // This is called when there're one or more local changes available. 45 // This is called when there're one or more local changes available.
46 // |pending_changes_hint| indicates the pending queue length to help sync 46 // |pending_changes_hint| indicates the pending queue length to help sync
47 // scheduling but the value may not be accurately reflect the real-time 47 // scheduling but the value may not be accurately reflect the real-time
48 // value. 48 // value.
49 virtual void OnLocalChangeAvailable(int64 pending_changes_hint) = 0; 49 virtual void OnLocalChangeAvailable(int64 pending_changes_hint) = 0;
50 50
51 private: 51 private:
52 DISALLOW_COPY_AND_ASSIGN(Observer); 52 DISALLOW_COPY_AND_ASSIGN(Observer);
53 }; 53 };
54 54
55 typedef base::Callback<void(bool has_pending_changes)>
56 HasPendingLocalChangeCallback;
57
55 LocalFileSyncService(); 58 LocalFileSyncService();
56 virtual ~LocalFileSyncService(); 59 virtual ~LocalFileSyncService();
57 60
58 void Shutdown(); 61 void Shutdown();
59 62
60 void MaybeInitializeFileSystemContext( 63 void MaybeInitializeFileSystemContext(
61 const GURL& app_origin, 64 const GURL& app_origin,
62 const std::string& service_name, 65 const std::string& service_name,
63 fileapi::FileSystemContext* file_system_context, 66 fileapi::FileSystemContext* file_system_context,
64 const fileapi::SyncStatusCallback& callback); 67 const fileapi::SyncStatusCallback& callback);
65 68
66 void AddChangeObserver(Observer* observer); 69 void AddChangeObserver(Observer* observer);
67 70
68 // Registers |url| to wait until sync is enabled for |url|. 71 // Registers |url| to wait until sync is enabled for |url|.
69 // |on_syncable_callback| is to be called when |url| becomes syncable 72 // |on_syncable_callback| is to be called when |url| becomes syncable
70 // (i.e. when we have no pending writes and the file is successfully locked 73 // (i.e. when we have no pending writes and the file is successfully locked
71 // for sync). 74 // for sync).
72 // Calling this method again while this already has another URL waiting 75 // Calling this method again while this already has another URL waiting
73 // for sync will overwrite the previously registered URL. 76 // for sync will overwrite the previously registered URL.
74 void RegisterURLForWaitingSync(const fileapi::FileSystemURL& url, 77 void RegisterURLForWaitingSync(const fileapi::FileSystemURL& url,
75 const base::Closure& on_syncable_callback); 78 const base::Closure& on_syncable_callback);
76 79
77 // Synchronize one (or a set of) local change(s) to the remote server 80 // Synchronize one (or a set of) local change(s) to the remote server
78 // using |processor|. 81 // using |processor|.
79 // |processor| must have same or longer lifetime than this service. 82 // |processor| must have same or longer lifetime than this service.
80 void ProcessLocalChange(LocalChangeProcessor* processor, 83 void ProcessLocalChange(LocalChangeProcessor* processor,
81 const fileapi::SyncFileCallback& callback); 84 const fileapi::SyncFileCallback& callback);
82 85
86 // Returns true via |callback| if the given file |url| has local pending
87 // changes.
88 void HasPendingLocalChanges(
89 const fileapi::FileSystemURL& url,
90 const HasPendingLocalChangeCallback& callback);
91
83 // Returns the metadata of a remote file pointed by |url|. 92 // Returns the metadata of a remote file pointed by |url|.
84 virtual void GetLocalFileMetadata( 93 virtual void GetLocalFileMetadata(
85 const fileapi::FileSystemURL& url, 94 const fileapi::FileSystemURL& url,
86 const fileapi::SyncFileMetadataCallback& callback); 95 const fileapi::SyncFileMetadataCallback& callback);
87 96
88 // RemoteChangeProcessor overrides. 97 // RemoteChangeProcessor overrides.
89 virtual void PrepareForProcessRemoteChange( 98 virtual void PrepareForProcessRemoteChange(
90 const fileapi::FileSystemURL& url, 99 const fileapi::FileSystemURL& url,
91 const PrepareChangeCallback& callback) OVERRIDE; 100 const PrepareChangeCallback& callback) OVERRIDE;
92 virtual void ApplyRemoteChange( 101 virtual void ApplyRemoteChange(
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 fileapi::SyncFileCallback local_sync_callback_; 168 fileapi::SyncFileCallback local_sync_callback_;
160 169
161 ObserverList<Observer> change_observers_; 170 ObserverList<Observer> change_observers_;
162 171
163 DISALLOW_COPY_AND_ASSIGN(LocalFileSyncService); 172 DISALLOW_COPY_AND_ASSIGN(LocalFileSyncService);
164 }; 173 };
165 174
166 } // namespace sync_file_system 175 } // namespace sync_file_system
167 176
168 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_FILE_SYNC_SERVICE_H_ 177 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_FILE_SYNC_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync_file_system/drive_file_sync_service.cc ('k') | chrome/browser/sync_file_system/local_file_sync_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698