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

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

Issue 452043003: [ew] Add basic classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added missing files. Created 6 years, 4 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/browser/fileapi/watcher_manager.h
diff --git a/webkit/browser/fileapi/watcher_manager.h b/webkit/browser/fileapi/watcher_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..83a64f691af2ad5a4889ef1505e1f41db5410c21
--- /dev/null
+++ b/webkit/browser/fileapi/watcher_manager.h
@@ -0,0 +1,67 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WEBKIT_BROWSER_FILEAPI_WATCHER_MANAGER_H_
+#define WEBKIT_BROWSER_FILEAPI_WATCHER_MANAGER_H_
+
+#include <vector>
+
+#include "base/basictypes.h"
+#include "base/callback_forward.h"
+#include "base/files/file.h"
+
+namespace base {
+class Time;
+}
+
+namespace storage {
+
+class FileSystemOperationContext;
+class FileSystemURL;
+
+// An interface for providing entry observing capability for file system
+// backends.
+//
+// It is NOT valid to give null callback to this class, and implementors
+// 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;
+
+ // Notifies about an entry represented by |url| being removed.
+ virtual void OnEntryRemoved(const FileSystemURL& url) = 0;
+ };
+
+ 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;
+
+ // Stops observing an entry represented by |url|.
+ virtual void UnwatchEntry(const FileSystemURL& url,
+ const StatusCallback& callback) = 0;
+};
+
+} // namespace storage
+
+#endif // WEBKIT_BROWSER_FILEAPI_WATCHER_MANAGER_H_

Powered by Google App Engine
This is Rietveld 408576698