| 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 WEBKIT_FILEAPI_SYNCABLE_LOCAL_FILE_SYNC_CONTEXT_H_ | 5 #ifndef WEBKIT_FILEAPI_SYNCABLE_LOCAL_FILE_SYNC_CONTEXT_H_ |
| 6 #define WEBKIT_FILEAPI_SYNCABLE_LOCAL_FILE_SYNC_CONTEXT_H_ | 6 #define WEBKIT_FILEAPI_SYNCABLE_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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 // An instance of this class is shared by FileSystemContexts and outlives | 44 // An instance of this class is shared by FileSystemContexts and outlives |
| 45 // LocalFileSyncService. | 45 // LocalFileSyncService. |
| 46 class WEBKIT_STORAGE_EXPORT LocalFileSyncContext | 46 class WEBKIT_STORAGE_EXPORT LocalFileSyncContext |
| 47 : public base::RefCountedThreadSafe<LocalFileSyncContext>, | 47 : public base::RefCountedThreadSafe<LocalFileSyncContext>, |
| 48 public LocalFileSyncStatus::Observer { | 48 public LocalFileSyncStatus::Observer { |
| 49 public: | 49 public: |
| 50 typedef base::Callback<void(SyncStatusCode status, | 50 typedef base::Callback<void(SyncStatusCode status, |
| 51 const LocalFileSyncInfo& sync_file_info)> | 51 const LocalFileSyncInfo& sync_file_info)> |
| 52 LocalFileSyncInfoCallback; | 52 LocalFileSyncInfoCallback; |
| 53 | 53 |
| 54 typedef base::Callback<void(bool has_pending_changes)> |
| 55 HasPendingLocalChangeCallback; |
| 56 |
| 54 LocalFileSyncContext(base::SingleThreadTaskRunner* ui_task_runner, | 57 LocalFileSyncContext(base::SingleThreadTaskRunner* ui_task_runner, |
| 55 base::SingleThreadTaskRunner* io_task_runner); | 58 base::SingleThreadTaskRunner* io_task_runner); |
| 56 | 59 |
| 57 // Initializes |file_system_context| for syncable file operations for | 60 // Initializes |file_system_context| for syncable file operations for |
| 58 // |service_name| and registers the it into the internal map. | 61 // |service_name| and registers the it into the internal map. |
| 59 // Calling this multiple times for the same file_system_context is valid. | 62 // Calling this multiple times for the same file_system_context is valid. |
| 60 // This method must be called on UI thread. | 63 // This method must be called on UI thread. |
| 61 void MaybeInitializeFileSystemContext(const GURL& source_url, | 64 void MaybeInitializeFileSystemContext(const GURL& source_url, |
| 62 const std::string& service_name, | 65 const std::string& service_name, |
| 63 FileSystemContext* file_system_context, | 66 FileSystemContext* file_system_context, |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 const FilePath& local_path, | 112 const FilePath& local_path, |
| 110 const FileSystemURL& url, | 113 const FileSystemURL& url, |
| 111 const SyncStatusCallback& callback); | 114 const SyncStatusCallback& callback); |
| 112 | 115 |
| 113 // This must be called on UI thread. | 116 // This must be called on UI thread. |
| 114 void GetFileMetadata( | 117 void GetFileMetadata( |
| 115 FileSystemContext* file_system_context, | 118 FileSystemContext* file_system_context, |
| 116 const FileSystemURL& url, | 119 const FileSystemURL& url, |
| 117 const SyncFileMetadataCallback& callback); | 120 const SyncFileMetadataCallback& callback); |
| 118 | 121 |
| 122 // Returns true via |callback| if the given file |url| has local pending |
| 123 // changes. |
| 124 void HasPendingLocalChanges( |
| 125 FileSystemContext* file_system_context, |
| 126 const FileSystemURL& url, |
| 127 const HasPendingLocalChangeCallback& callback); |
| 128 |
| 119 // They must be called on UI thread. | 129 // They must be called on UI thread. |
| 120 void AddOriginChangeObserver(LocalOriginChangeObserver* observer); | 130 void AddOriginChangeObserver(LocalOriginChangeObserver* observer); |
| 121 void RemoveOriginChangeObserver(LocalOriginChangeObserver* observer); | 131 void RemoveOriginChangeObserver(LocalOriginChangeObserver* observer); |
| 122 | 132 |
| 123 // OperationRunner is accessible only on IO thread. | 133 // OperationRunner is accessible only on IO thread. |
| 124 base::WeakPtr<SyncableFileOperationRunner> operation_runner() const; | 134 base::WeakPtr<SyncableFileOperationRunner> operation_runner() const; |
| 125 | 135 |
| 126 // SyncContext is accessible only on IO thread. | 136 // SyncContext is accessible only on IO thread. |
| 127 LocalFileSyncStatus* sync_status() const; | 137 LocalFileSyncStatus* sync_status() const; |
| 128 | 138 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 ObserverList<LocalOriginChangeObserver> origin_change_observers_; | 260 ObserverList<LocalOriginChangeObserver> origin_change_observers_; |
| 251 | 261 |
| 252 int mock_notify_changes_duration_in_sec_; | 262 int mock_notify_changes_duration_in_sec_; |
| 253 | 263 |
| 254 DISALLOW_COPY_AND_ASSIGN(LocalFileSyncContext); | 264 DISALLOW_COPY_AND_ASSIGN(LocalFileSyncContext); |
| 255 }; | 265 }; |
| 256 | 266 |
| 257 } // namespace fileapi | 267 } // namespace fileapi |
| 258 | 268 |
| 259 #endif // WEBKIT_FILEAPI_SYNCABLE_LOCAL_FILE_SYNC_CONTEXT_H_ | 269 #endif // WEBKIT_FILEAPI_SYNCABLE_LOCAL_FILE_SYNC_CONTEXT_H_ |
| OLD | NEW |