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

Unified Diff: storage/browser/fileapi/watcher_manager.h

Issue 642343004: [ew] Simplify the entry watcher logic. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
« no previous file with comments | « content/public/test/test_file_system_backend.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: storage/browser/fileapi/watcher_manager.h
diff --git a/storage/browser/fileapi/watcher_manager.h b/storage/browser/fileapi/watcher_manager.h
index 40f3733c05cc86d84b19489f6fe83cf51d1af98e..1c4f3d1a76ec7658b937ca21a5bc220b4644f625 100644
--- a/storage/browser/fileapi/watcher_manager.h
+++ b/storage/browser/fileapi/watcher_manager.h
@@ -27,35 +27,24 @@ class FileSystemURL;
// can assume that they don't get any null callbacks.
class WatcherManager {
public:
- typedef base::Callback<void(base::File::Error result)> StatusCallback;
-
- // Observes watched entries.
- class Observer {
- public:
- Observer() {}
- virtual ~Observer() {}
-
- // Notifies about an entry represented by |url| being changed.
- virtual void OnEntryChanged(const FileSystemURL& url) = 0;
+ enum Action { CHANGED, REMOVED };
- // Notifies about an entry represented by |url| being removed.
- virtual void OnEntryRemoved(const FileSystemURL& url) = 0;
- };
+ typedef base::Callback<void(base::File::Error result)> StatusCallback;
+ typedef base::Callback<void(Action action)> NotificationCallback;
virtual ~WatcherManager() {}
- virtual void AddObserver(Observer* observer) = 0;
- virtual void RemoveObserver(Observer* observer) = 0;
- virtual bool HasObserver(Observer* observer) const = 0;
-
// Observes a directory entry. If the |recursive| mode is not supported then
// FILE_ERROR_INVALID_OPERATION must be returned as an error. If the |url| is
// already watched, or setting up the watcher fails, then |callback|
// must be called with a specific error code. Otherwise |callback| must be
- // called with the FILE_OK error code.
- virtual void WatchDirectory(const FileSystemURL& url,
- bool recursive,
- const StatusCallback& callback) = 0;
+ // called with the FILE_OK error code. |notification_callback| is called for
+ // every change related to the watched directory.
+ virtual void WatchDirectory(
benwells 2014/10/23 02:10:34 Is this implemented / called by anything?
mtomasz 2014/10/23 02:15:11 Not now, but I'll need it for upcoming CLs. FSP co
+ const FileSystemURL& url,
+ bool recursive,
+ const StatusCallback& callback,
+ const NotificationCallback& notification_callback) = 0;
// Stops observing an entry represented by |url|.
virtual void UnwatchEntry(const FileSystemURL& url,
« no previous file with comments | « content/public/test/test_file_system_backend.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698