X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fchrome%2Fbrowser%2Fchromeos%2Ffile_system_provider%2Fprovided_file_system_interface.h;h=4e8c4b8d1a35ed4eec30bcaa17faf0df4f0fb70e;hb=1afa4dd80ef85af7c90efaea6959db1d92330844;hp=04b9054aaec04fb414ad7f6ba4b032e69e92040c;hpb=90762837333c13ccf56f2ad88e4481fc71e8d281;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h b/src/chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h index 04b9054..4e8c4b8 100644 --- a/src/chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h +++ b/src/chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h @@ -6,13 +6,19 @@ #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_INTERFACE_H_ #include +#include #include "base/callback.h" #include "base/files/file.h" #include "base/files/file_path.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" +#include "base/observer_list.h" +#include "chrome/browser/chromeos/file_system_provider/provided_file_system_observer.h" +#include "chrome/browser/chromeos/file_system_provider/watcher.h" #include "storage/browser/fileapi/async_file_util.h" +#include "storage/browser/fileapi/watcher_manager.h" +#include "url/gurl.h" class EventRouter; @@ -30,8 +36,7 @@ namespace file_system_provider { class ProvidedFileSystemInfo; class RequestManager; -// Represents metadata for either a file or a directory. Returned by GetMetadata -// method in ProvidedFileSystemInterface. +// Represents metadata for either a file or a directory. struct EntryMetadata { EntryMetadata(); ~EntryMetadata(); @@ -54,6 +59,8 @@ struct EntryMetadata { // fails synchronously. class ProvidedFileSystemInterface { public: + struct Change; + // Mode of opening a file. Used by OpenFile(). enum OpenFileMode { OPEN_FILE_MODE_READ, OPEN_FILE_MODE_WRITE }; @@ -170,12 +177,51 @@ class ProvidedFileSystemInterface { int length, const storage::AsyncFileUtil::StatusCallback& callback) = 0; + // Requests adding a watcher on an entry. |recursive| must not be true for + // files. |callback| is optional, but it can't be used for persistent + // watchers. + virtual AbortCallback AddWatcher( + const GURL& origin, + const base::FilePath& entry_path, + bool recursive, + bool persistent, + const storage::AsyncFileUtil::StatusCallback& callback, + const storage::WatcherManager::NotificationCallback& + notification_callback) = 0; + + // Requests removing a watcher, which is immediately deleted from the internal + // list, hence the operation is not abortable. + virtual void RemoveWatcher( + const GURL& origin, + const base::FilePath& entry_path, + bool recursive, + const storage::AsyncFileUtil::StatusCallback& callback) = 0; + + // Notifies about changes related to the watcher within the file system. + // Invoked by the file system implementation. Returns false if the + // notification arguments are malformed or the entry is not watched anymore. + // TODO(mtomasz): Replace [entry_path, recursive] with a watcher id. + virtual bool Notify(const base::FilePath& entry_path, + bool recursive, + storage::WatcherManager::ChangeType change_type, + scoped_ptr changes, + const std::string& tag) = 0; + // Returns a provided file system info for this file system. virtual const ProvidedFileSystemInfo& GetFileSystemInfo() const = 0; + // Returns a mutable list of watchers. + virtual Watchers* GetWatchers() = 0; + // Returns a request manager for the file system. virtual RequestManager* GetRequestManager() = 0; + // Adds an observer on the file system. + virtual void AddObserver(ProvidedFileSystemObserver* observer) = 0; + + // Removes an observer. + virtual void RemoveObserver(ProvidedFileSystemObserver* observer) = 0; + // Returns a weak pointer to this object. virtual base::WeakPtr GetWeakPtr() = 0; };