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

Unified Diff: webkit/fileapi/syncable/local_file_sync_status.h

Issue 11238054: Add OnSyncEnabled/OnWriteEnabled notification handling to operation runner (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: webkit/fileapi/syncable/local_file_sync_status.h
diff --git a/webkit/fileapi/syncable/local_file_sync_status.h b/webkit/fileapi/syncable/local_file_sync_status.h
index f99b84eaac968ac155926cc11c540128bcd8457d..14f083512d2cf21a3411632a840cbe53e54e2599 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 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);
};

Powered by Google App Engine
This is Rietveld 408576698