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 CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_OBSERVER_H_
6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_OBSERVER_H_
11 #include "base/callback.h"
12 #include "base/files/file_path.h"
13 #include "chrome/browser/chromeos/file_system_provider/watcher.h"
14 #include "storage/browser/fileapi/watcher_manager.h"
17 namespace file_system_provider
{
19 class ProvidedFileSystemInfo
;
22 // Observer class to be notified about changes happened to the provided file
23 // system, including watched entries.
24 class ProvidedFileSystemObserver
{
29 typedef std::vector
<Change
> Changes
;
31 // Describes a change related to a watched entry.
36 base::FilePath entry_path
;
37 storage::WatcherManager::ChangeType change_type
;
40 // Called when a watched entry is changed, including removals. |callback|
41 // *must* be called after the entry change is handled. Once all observers
42 // call the callback, the tag will be updated and OnWatcherTagUpdated
43 // called. The reference to |changes| is valid at least as long as |callback|.
44 virtual void OnWatcherChanged(const ProvidedFileSystemInfo
& file_system_info
,
45 const Watcher
& watcher
,
46 storage::WatcherManager::ChangeType change_type
,
47 const Changes
& changes
,
48 const base::Closure
& callback
) = 0;
50 // Called after the tag value is updated for the watcher.
51 virtual void OnWatcherTagUpdated(
52 const ProvidedFileSystemInfo
& file_system_info
,
53 const Watcher
& watcher
) = 0;
55 // Called after the list of watchers is changed.
56 virtual void OnWatcherListChanged(
57 const ProvidedFileSystemInfo
& file_system_info
,
58 const Watchers
& watchers
) = 0;
61 } // namespace file_system_provider
62 } // namespace chromeos
64 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_OBSERVER_H_