We started redesigning GpuMemoryBuffer interface to handle multiple buffers [0].
[chromium-blink-merge.git] / storage / browser / fileapi / watcher_manager.h
blobe38d207b0f0810690a2e94da7dd568d52f536b0d
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef STORAGE_BROWSER_FILEAPI_WATCHER_MANAGER_H_
6 #define STORAGE_BROWSER_FILEAPI_WATCHER_MANAGER_H_
8 #include <vector>
10 #include "base/basictypes.h"
11 #include "base/callback_forward.h"
12 #include "base/files/file.h"
14 namespace storage {
16 class FileSystemOperationContext;
17 class FileSystemURL;
19 // An interface for providing entry observing capability for file system
20 // backends.
22 // It is NOT valid to give null callback to this class, and implementors
23 // can assume that they don't get any null callbacks.
24 class WatcherManager {
25 public:
26 enum ChangeType { CHANGED, DELETED };
28 typedef base::Callback<void(base::File::Error result)> StatusCallback;
29 typedef base::Callback<void(ChangeType change_type)> NotificationCallback;
31 virtual ~WatcherManager() {}
33 // Adds an entry watcher. If the |recursive| mode is not supported then
34 // FILE_ERROR_INVALID_OPERATION must be returned as an error. If the |url| is
35 // already watched with the same |recursive|, or setting up the watcher fails,
36 // then |callback| must be called with a specific error code.
38 // There may be up to two watchers for the same |url| as well as one of them
39 // is recursive, and the other one is not.
41 // In case of a success |callback| must be called with the FILE_OK error code.
42 // |notification_callback| is called for every change related to the watched
43 // directory.
44 virtual void AddWatcher(
45 const FileSystemURL& url,
46 bool recursive,
47 const StatusCallback& callback,
48 const NotificationCallback& notification_callback) = 0;
50 // Removes a watcher represented by |url| in |recursive| mode.
51 virtual void RemoveWatcher(const FileSystemURL& url,
52 bool recursive,
53 const StatusCallback& callback) = 0;
56 } // namespace storage
58 #endif // STORAGE_BROWSER_FILEAPI_WATCHER_MANAGER_H_