| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_OBSERV
ER_H_ | 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_ | 6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_OBSERV
ER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 13 #include "chrome/browser/chromeos/file_system_provider/observed_entry.h" | 13 #include "chrome/browser/chromeos/file_system_provider/observed_entry.h" |
| 14 | 14 |
| 15 namespace chromeos { | 15 namespace chromeos { |
| 16 namespace file_system_provider { | 16 namespace file_system_provider { |
| 17 | 17 |
| 18 class ProvidedFileSystemInfo; | 18 class ProvidedFileSystemInfo; |
| 19 class RequestManager; | 19 class RequestManager; |
| 20 | 20 |
| 21 // Observer class to be notified about changes happened to the provided file | 21 // Observer class to be notified about changes happened to the provided file |
| 22 // system, especially observed entries. | 22 // system, especially observed entries. |
| 23 class ProvidedFileSystemObserver { | 23 class ProvidedFileSystemObserver { |
| 24 public: | 24 public: |
| 25 struct ChildChange; | 25 struct Change; |
| 26 | 26 |
| 27 // Type of a change to an observed entry. | 27 // Type of a change to an observed entry. |
| 28 enum ChangeType { CHANGED, DELETED }; | 28 enum ChangeType { CHANGED, DELETED }; |
| 29 | 29 |
| 30 // Lust of child changes. | 30 // Lust of changes. |
| 31 typedef std::vector<ChildChange> ChildChanges; | 31 typedef std::vector<Change> Changes; |
| 32 | 32 |
| 33 // Describes a change in an entry contained in an observed directory. | 33 // Describes a change related to an observed directory. |
| 34 struct ChildChange { | 34 struct Change { |
| 35 ChildChange(); | 35 Change(); |
| 36 ~ChildChange(); | 36 ~Change(); |
| 37 | 37 |
| 38 base::FilePath entry_path; | 38 base::FilePath entry_path; |
| 39 ChangeType change_type; | 39 ChangeType change_type; |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 // Called when an observed entry is changed, including removals. |callback| | 42 // Called when an observed entry is changed, including removals. |callback| |
| 43 // *must* be called after the entry change is handled. Once all observers | 43 // *must* be called after the entry change is handled. Once all observers |
| 44 // call the callback, the tag will be updated and OnObservedEntryTagUpdated | 44 // call the callback, the tag will be updated and OnObservedEntryTagUpdated |
| 45 // called. The reference to |child_changes| is valid at least as long as | 45 // called. The reference to |changes| is valid at least as long as |callback|. |
| 46 // |callback|. | |
| 47 virtual void OnObservedEntryChanged( | 46 virtual void OnObservedEntryChanged( |
| 48 const ProvidedFileSystemInfo& file_system_info, | 47 const ProvidedFileSystemInfo& file_system_info, |
| 49 const ObservedEntry& observed_entry, | 48 const ObservedEntry& observed_entry, |
| 50 ChangeType change_type, | 49 ChangeType change_type, |
| 51 const ChildChanges& child_changes, | 50 const Changes& changes, |
| 52 const base::Closure& callback) = 0; | 51 const base::Closure& callback) = 0; |
| 53 | 52 |
| 54 // Called after the tag value is updated for the observed entry. | 53 // Called after the tag value is updated for the observed entry. |
| 55 virtual void OnObservedEntryTagUpdated( | 54 virtual void OnObservedEntryTagUpdated( |
| 56 const ProvidedFileSystemInfo& file_system_info, | 55 const ProvidedFileSystemInfo& file_system_info, |
| 57 const ObservedEntry& observed_entry) = 0; | 56 const ObservedEntry& observed_entry) = 0; |
| 58 | 57 |
| 59 // Called after the list of observed entries is changed. | 58 // Called after the list of observed entries is changed. |
| 60 virtual void OnObservedEntryListChanged( | 59 virtual void OnObservedEntryListChanged( |
| 61 const ProvidedFileSystemInfo& file_system_info, | 60 const ProvidedFileSystemInfo& file_system_info, |
| 62 const ObservedEntries& observed_entries) = 0; | 61 const ObservedEntries& observed_entries) = 0; |
| 63 }; | 62 }; |
| 64 | 63 |
| 65 } // namespace file_system_provider | 64 } // namespace file_system_provider |
| 66 } // namespace chromeos | 65 } // namespace chromeos |
| 67 | 66 |
| 68 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_OBS
ERVER_H_ | 67 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_OBS
ERVER_H_ |
| OLD | NEW |