Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(443)

Side by Side Diff: chrome/browser/chromeos/file_system_provider/provided_file_system_observer.h

Issue 674413002: [fsp] Rename ObserveEntry with AddWatcher. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/watcher.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, including watched entries.
23 class ProvidedFileSystemObserver { 23 class ProvidedFileSystemObserver {
24 public: 24 public:
25 struct Change; 25 struct Change;
26 26
27 // Type of a change to an observed entry. 27 // Type of a change to a watched entry.
28 enum ChangeType { CHANGED, DELETED }; 28 enum ChangeType { CHANGED, DELETED };
29 29
30 // Lust of changes. 30 // Lust of changes.
31 typedef std::vector<Change> Changes; 31 typedef std::vector<Change> Changes;
32 32
33 // Describes a change related to an observed directory. 33 // Describes a change related to a watched entry.
34 struct Change { 34 struct Change {
35 Change(); 35 Change();
36 ~Change(); 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 a watched 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 OnWatcherTagUpdated
45 // called. The reference to |changes| is valid at least as long as |callback|. 45 // called. The reference to |changes| is valid at least as long as |callback|.
46 virtual void OnObservedEntryChanged( 46 virtual void OnWatcherChanged(const ProvidedFileSystemInfo& file_system_info,
47 const Watcher& watcher,
48 ChangeType change_type,
49 const Changes& changes,
50 const base::Closure& callback) = 0;
51
52 // Called after the tag value is updated for the watcher.
53 virtual void OnWatcherTagUpdated(
47 const ProvidedFileSystemInfo& file_system_info, 54 const ProvidedFileSystemInfo& file_system_info,
48 const ObservedEntry& observed_entry, 55 const Watcher& watcher) = 0;
49 ChangeType change_type,
50 const Changes& changes,
51 const base::Closure& callback) = 0;
52 56
53 // Called after the tag value is updated for the observed entry. 57 // Called after the list of watchers is changed.
54 virtual void OnObservedEntryTagUpdated( 58 virtual void OnWatcherListChanged(
55 const ProvidedFileSystemInfo& file_system_info, 59 const ProvidedFileSystemInfo& file_system_info,
56 const ObservedEntry& observed_entry) = 0; 60 const Watchers& watchers) = 0;
57
58 // Called after the list of observed entries is changed.
59 virtual void OnObservedEntryListChanged(
60 const ProvidedFileSystemInfo& file_system_info,
61 const ObservedEntries& observed_entries) = 0;
62 }; 61 };
63 62
64 } // namespace file_system_provider 63 } // namespace file_system_provider
65 } // namespace chromeos 64 } // namespace chromeos
66 65
67 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_OBS ERVER_H_ 66 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_OBS ERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698