OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_LOCAL_FILE_SYNC_CONTEXT_H_ | 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_LOCAL_FILE_SYNC_CONTEXT_H_ |
6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_LOCAL_FILE_SYNC_CONTEXT_H_ | 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_LOCAL_FILE_SYNC_CONTEXT_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 const SyncFileMetadataCallback& callback); | 182 const SyncFileMetadataCallback& callback); |
183 | 183 |
184 // Returns true via |callback| if the given file |url| has local pending | 184 // Returns true via |callback| if the given file |url| has local pending |
185 // changes. | 185 // changes. |
186 void HasPendingLocalChanges( | 186 void HasPendingLocalChanges( |
187 fileapi::FileSystemContext* file_system_context, | 187 fileapi::FileSystemContext* file_system_context, |
188 const fileapi::FileSystemURL& url, | 188 const fileapi::FileSystemURL& url, |
189 const HasPendingLocalChangeCallback& callback); | 189 const HasPendingLocalChangeCallback& callback); |
190 | 190 |
191 void PromoteDemotedChanges(const GURL& origin, | 191 void PromoteDemotedChanges(const GURL& origin, |
192 fileapi::FileSystemContext* file_system_context); | 192 fileapi::FileSystemContext* file_system_context, |
193 void UpdateChangesForOrigin(const GURL& origin); | 193 const base::Closure& callback); |
| 194 void UpdateChangesForOrigin(const GURL& origin, |
| 195 const base::Closure& callback); |
194 | 196 |
195 // They must be called on UI thread. | 197 // They must be called on UI thread. |
196 void AddOriginChangeObserver(LocalOriginChangeObserver* observer); | 198 void AddOriginChangeObserver(LocalOriginChangeObserver* observer); |
197 void RemoveOriginChangeObserver(LocalOriginChangeObserver* observer); | 199 void RemoveOriginChangeObserver(LocalOriginChangeObserver* observer); |
198 | 200 |
199 // OperationRunner is accessible only on IO thread. | 201 // OperationRunner is accessible only on IO thread. |
200 base::WeakPtr<SyncableFileOperationRunner> operation_runner() const; | 202 base::WeakPtr<SyncableFileOperationRunner> operation_runner() const; |
201 | 203 |
202 // SyncContext is accessible only on IO thread. | 204 // SyncContext is accessible only on IO thread. |
203 LocalFileSyncStatus* sync_status() const; | 205 LocalFileSyncStatus* sync_status() const; |
(...skipping 16 matching lines...) Expand all Loading... |
220 friend class base::RefCountedThreadSafe<LocalFileSyncContext>; | 222 friend class base::RefCountedThreadSafe<LocalFileSyncContext>; |
221 friend class CannedSyncableFileSystem; | 223 friend class CannedSyncableFileSystem; |
222 | 224 |
223 virtual ~LocalFileSyncContext(); | 225 virtual ~LocalFileSyncContext(); |
224 | 226 |
225 void ShutdownOnIOThread(); | 227 void ShutdownOnIOThread(); |
226 | 228 |
227 // Starts a timer to eventually call NotifyAvailableChangesOnIOThread. | 229 // Starts a timer to eventually call NotifyAvailableChangesOnIOThread. |
228 // The caller is expected to update origins_with_pending_changes_ before | 230 // The caller is expected to update origins_with_pending_changes_ before |
229 // calling this. | 231 // calling this. |
230 void ScheduleNotifyChangesUpdatedOnIOThread(); | 232 void ScheduleNotifyChangesUpdatedOnIOThread(const base::Closure& callback); |
231 | 233 |
232 // Called by the internal timer on IO thread to notify changes to UI thread. | 234 // Called by the internal timer on IO thread to notify changes to UI thread. |
233 void NotifyAvailableChangesOnIOThread(); | 235 void NotifyAvailableChangesOnIOThread(const base::Closure& callback); |
234 | 236 |
235 // Called from NotifyAvailableChangesOnIOThread. | 237 // Called from NotifyAvailableChangesOnIOThread. |
236 void NotifyAvailableChanges(const std::set<GURL>& origins); | 238 void NotifyAvailableChanges(const std::set<GURL>& origins, |
| 239 const base::Closure& callback); |
237 | 240 |
238 // Helper routines for MaybeInitializeFileSystemContext. | 241 // Helper routines for MaybeInitializeFileSystemContext. |
239 void InitializeFileSystemContextOnIOThread( | 242 void InitializeFileSystemContextOnIOThread( |
240 const GURL& source_url, | 243 const GURL& source_url, |
241 fileapi::FileSystemContext* file_system_context, | 244 fileapi::FileSystemContext* file_system_context, |
242 const GURL& /* root */, | 245 const GURL& /* root */, |
243 const std::string& /* name */, | 246 const std::string& /* name */, |
244 base::File::Error error); | 247 base::File::Error error); |
245 SyncStatusCode InitializeChangeTrackerOnFileThread( | 248 SyncStatusCode InitializeChangeTrackerOnFileThread( |
246 scoped_ptr<LocalFileChangeTracker>* tracker_ptr, | 249 scoped_ptr<LocalFileChangeTracker>* tracker_ptr, |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 ObserverList<LocalOriginChangeObserver> origin_change_observers_; | 375 ObserverList<LocalOriginChangeObserver> origin_change_observers_; |
373 | 376 |
374 int mock_notify_changes_duration_in_sec_; | 377 int mock_notify_changes_duration_in_sec_; |
375 | 378 |
376 DISALLOW_COPY_AND_ASSIGN(LocalFileSyncContext); | 379 DISALLOW_COPY_AND_ASSIGN(LocalFileSyncContext); |
377 }; | 380 }; |
378 | 381 |
379 } // namespace sync_file_system | 382 } // namespace sync_file_system |
380 | 383 |
381 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_LOCAL_FILE_SYNC_CONTEXT_H_ | 384 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_LOCAL_FILE_SYNC_CONTEXT_H_ |
OLD | NEW |