summaryrefslogtreecommitdiffstats
path: root/webkit/fileapi/syncable/local_file_sync_status.h
diff options
context:
space:
mode:
Diffstat (limited to 'webkit/fileapi/syncable/local_file_sync_status.h')
-rw-r--r--webkit/fileapi/syncable/local_file_sync_status.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/webkit/fileapi/syncable/local_file_sync_status.h b/webkit/fileapi/syncable/local_file_sync_status.h
index f99b84e..f0ce581 100644
--- a/webkit/fileapi/syncable/local_file_sync_status.h
+++ b/webkit/fileapi/syncable/local_file_sync_status.h
@@ -10,6 +10,7 @@
#include "base/basictypes.h"
#include "base/compiler_specific.h"
+#include "base/observer_list.h"
#include "base/threading/non_thread_safe.h"
#include "webkit/fileapi/file_system_url.h"
@@ -27,6 +28,15 @@ namespace fileapi {
// while the target url is in syncing must fail and vice versa.
class WEBKIT_STORAGE_EXPORT LocalFileSyncStatus : public base::NonThreadSafe {
public:
+ class WEBKIT_STORAGE_EXPORT Observer {
+ public:
+ Observer() {}
+ virtual void OnSyncEnabled(const FileSystemURL& url) = 0;
+ virtual void OnWriteEnabled(const FileSystemURL& url) = 0;
+ private:
+ DISALLOW_COPY_AND_ASSIGN(Observer);
+ };
+
LocalFileSyncStatus();
~LocalFileSyncStatus();
@@ -50,6 +60,9 @@ class WEBKIT_STORAGE_EXPORT LocalFileSyncStatus : public base::NonThreadSafe {
// Returns true if the |url| is enabled for writing (i.e. not in syncing).
bool IsWritable(const FileSystemURL& url) const;
+ void AddObserver(Observer* observer);
+ void RemoveObserver(Observer* observer);
+
private:
typedef std::map<FileSystemURL, int64, FileSystemURL::Comparator> URLCountMap;
typedef std::set<FileSystemURL, FileSystemURL::Comparator> URLSet;
@@ -63,6 +76,8 @@ class WEBKIT_STORAGE_EXPORT LocalFileSyncStatus : public base::NonThreadSafe {
// If this flag is set sync process is running on the file.
URLSet syncing_;
+ ObserverList<Observer> observer_list_;
+
DISALLOW_COPY_AND_ASSIGN(LocalFileSyncStatus);
};