Revert of Add button to add new FSP services to Files app. (patchset #8 id:140001...
[chromium-blink-merge.git] / chrome / browser / chromeos / file_system_provider / provided_file_system_observer.h
blob1e8d9d79f01ce972ab5341dbe707bf93523f1030
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_
8 #include <string>
9 #include <vector>
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"
16 namespace chromeos {
17 namespace file_system_provider {
19 class ProvidedFileSystemInfo;
20 class RequestManager;
22 // Observer class to be notified about changes happened to the provided file
23 // system, including watched entries.
24 class ProvidedFileSystemObserver {
25 public:
26 struct Change;
28 // Lust of changes.
29 typedef std::vector<Change> Changes;
31 // Describes a change related to a watched entry.
32 struct Change {
33 Change();
34 ~Change();
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_