OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_OBSERV
ER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_OBSERV
ER_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/callback.h" |
| 12 #include "base/files/file_path.h" |
| 13 |
| 14 namespace chromeos { |
| 15 namespace file_system_provider { |
| 16 |
| 17 class ProvidedFileSystemInfo; |
| 18 class RequestManager; |
| 19 |
| 20 // Observer class to be notified about changes happened to the provided file |
| 21 // system, especially observed entries. |
| 22 class ProvidedFileSystemObserver { |
| 23 public: |
| 24 struct ChildChange; |
| 25 |
| 26 // Type of a change to an observed entry. |
| 27 enum ChangeType { CHANGED, DELETED }; |
| 28 |
| 29 // Lust of child changes. |
| 30 typedef std::vector<ChildChange> ChildChanges; |
| 31 |
| 32 // Represents an observed entry on the file system. |
| 33 struct ObservedEntry { |
| 34 ObservedEntry(); |
| 35 ~ObservedEntry(); |
| 36 |
| 37 base::FilePath entry_path; |
| 38 bool recursive; |
| 39 std::string last_tag; |
| 40 }; |
| 41 |
| 42 // Describes a change in an entry contained in an observed directory. |
| 43 struct ChildChange { |
| 44 ChildChange(); |
| 45 ~ChildChange(); |
| 46 |
| 47 base::FilePath entry_path; |
| 48 ChangeType change_type; |
| 49 }; |
| 50 |
| 51 // Called when an observed entry is changed, including removals. |callback| |
| 52 // *must* be called after the entry change is handled. Once all observers |
| 53 // call the callback, the tag will be updated and OnObservedEntryTagUpdated |
| 54 // called. |
| 55 virtual void OnObservedEntryChanged( |
| 56 const ProvidedFileSystemInfo& file_system_info, |
| 57 const base::FilePath& observed_path, |
| 58 ChangeType change_type, |
| 59 const ChildChanges& child_changes, |
| 60 const base::Closure& callback) = 0; |
| 61 |
| 62 // Called when tag value is updated for the observed entry. |
| 63 virtual void OnObservedEntryTagUpdated( |
| 64 const ProvidedFileSystemInfo& file_system_info, |
| 65 const base::FilePath& observed_path) = 0; |
| 66 |
| 67 // Called when list of observed entries is changed. |
| 68 virtual void OnObservedEntryListChanged( |
| 69 const ProvidedFileSystemInfo& file_system_info) = 0; |
| 70 }; |
| 71 |
| 72 } // namespace file_system_provider |
| 73 } // namespace chromeos |
| 74 |
| 75 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_OBS
ERVER_H_ |
OLD | NEW |