summaryrefslogtreecommitdiffstats
path: root/webkit/fileapi/file_observers.h
diff options
context:
space:
mode:
authorkinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-07 07:02:20 +0000
committerkinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-07 07:02:20 +0000
commitcaf6670cff5c72fd2c5f48db8ddd3f4670baeca4 (patch)
tree5c5bc5bee15e7f0cbac2538474ea8b5475f86024 /webkit/fileapi/file_observers.h
parent69df265b0c90a5d25888cb0452e3a310060525a8 (diff)
downloadchromium_src-caf6670cff5c72fd2c5f48db8ddd3f4670baeca4.zip
chromium_src-caf6670cff5c72fd2c5f48db8ddd3f4670baeca4.tar.gz
chromium_src-caf6670cff5c72fd2c5f48db8ddd3f4670baeca4.tar.bz2
Add observer classes for fileapi to observe filesystem changes
- Add common observer helper class (task_runner_bound_observer_list.h) - Add common file observers (file_observer.h) - Replace current quota notification impl with the observer BUG=146290 TEST=existing tests TEST=more tests to be added Review URL: https://chromiumcodereview.appspot.com/10909052 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@155345 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/fileapi/file_observers.h')
-rw-r--r--webkit/fileapi/file_observers.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/webkit/fileapi/file_observers.h b/webkit/fileapi/file_observers.h
new file mode 100644
index 0000000..2022b81
--- /dev/null
+++ b/webkit/fileapi/file_observers.h
@@ -0,0 +1,51 @@
+// Copyright (c) 2012 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_FILEAPI_FILE_OBSERVERS_H_
+#define WEBKIT_FILEAPI_FILE_OBSERVERS_H_
+
+#include "webkit/fileapi/fileapi_export.h"
+
+// TODO(kinuko): Split this file into per-observer multiple files.
+
+namespace fileapi {
+
+class FileSystemURL;
+
+// An abstract interface to observe update operations.
+//
+// OnStartUpdate and OnEndUpdate are called once for each target url
+// before and after following operations regardless of whether the operation
+// is made recursively or not (i.e. StartUpdate() will be called only once
+// for destination url regardless of whether it is recursive copy or not):
+// CreateFile(), CreateDirectory(),
+// Copy() (destination only),
+// Move() (both for source and destination),
+// Remove(), Write(), Truncate(), TouchFile()
+//
+// OnUpdate() is called each time the |url| is updated but works only for
+// sandboxed files (where usage is tracked).
+class FILEAPI_EXPORT FileUpdateObserver {
+ public:
+ virtual ~FileUpdateObserver() {}
+
+ virtual void OnStartUpdate(const FileSystemURL& url) = 0;
+ virtual void OnUpdate(const FileSystemURL& url, int64 delta) = 0;
+ virtual void OnEndUpdate(const FileSystemURL& url) = 0;
+};
+
+// An abstract interface to observe file access.
+// OnAccess is called whenever an operation reads file contents or metadata.
+// (It is called only once per operation regardless of whether the operation
+// is recursive or not)
+class FILEAPI_EXPORT FileAccessObserver {
+ public:
+ virtual ~FileAccessObserver() {}
+
+ virtual void OnAccess(const FileSystemURL& url) = 0;
+};
+
+} // namespace fileapi
+
+#endif // WEBKIT_FILEAPI_FILE_OBSERVERS_H_