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

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

Issue 663713002: [fsp] Extract ObservedEntry and ObservedEntries to a separate file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: Added missing files. Created 6 years, 2 months 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 14
14 namespace chromeos { 15 namespace chromeos {
15 namespace file_system_provider { 16 namespace file_system_provider {
16 17
17 class ProvidedFileSystemInfo; 18 class ProvidedFileSystemInfo;
18 class RequestManager; 19 class RequestManager;
19 20
20 // 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
21 // system, especially observed entries. 22 // system, especially observed entries.
22 class ProvidedFileSystemObserver { 23 class ProvidedFileSystemObserver {
23 public: 24 public:
24 struct ChildChange; 25 struct ChildChange;
25 26
26 // Type of a change to an observed entry. 27 // Type of a change to an observed entry.
27 enum ChangeType { CHANGED, DELETED }; 28 enum ChangeType { CHANGED, DELETED };
28 29
29 // Lust of child changes. 30 // Lust of child changes.
30 typedef std::vector<ChildChange> ChildChanges; 31 typedef std::vector<ChildChange> ChildChanges;
31 32
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. 33 // Describes a change in an entry contained in an observed directory.
43 struct ChildChange { 34 struct ChildChange {
44 ChildChange(); 35 ChildChange();
45 ~ChildChange(); 36 ~ChildChange();
46 37
47 base::FilePath entry_path; 38 base::FilePath entry_path;
48 ChangeType change_type; 39 ChangeType change_type;
49 }; 40 };
50 41
51 // Called when an observed entry is changed, including removals. |callback| 42 // Called when an observed entry is changed, including removals. |callback|
52 // *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
53 // call the callback, the tag will be updated and OnObservedEntryTagUpdated 44 // call the callback, the tag will be updated and OnObservedEntryTagUpdated
54 // called. The reference to |child_changes| is valid at least as long as 45 // called. The reference to |child_changes| is valid at least as long as
55 // |callback|. 46 // |callback|.
56 virtual void OnObservedEntryChanged( 47 virtual void OnObservedEntryChanged(
57 const ProvidedFileSystemInfo& file_system_info, 48 const ProvidedFileSystemInfo& file_system_info,
58 const base::FilePath& observed_path, 49 const base::FilePath& observed_path,
59 ChangeType change_type, 50 ChangeType change_type,
60 const ChildChanges& child_changes, 51 const ChildChanges& child_changes,
61 const base::Closure& callback) = 0; 52 const base::Closure& callback) = 0;
62 53
63 // Called when tag value is updated for the observed entry. 54 // Called when tag value is updated for the observed entry.
64 virtual void OnObservedEntryTagUpdated( 55 virtual void OnObservedEntryTagUpdated(
65 const ProvidedFileSystemInfo& file_system_info, 56 const ProvidedFileSystemInfo& file_system_info,
66 const base::FilePath& observed_path) = 0; 57 const base::FilePath& observed_path,
58 const std::string& tag) = 0;
67 59
68 // Called when list of observed entries is changed. 60 // Called when list of observed entries is changed.
69 virtual void OnObservedEntryListChanged( 61 virtual void OnObservedEntryListChanged(
70 const ProvidedFileSystemInfo& file_system_info) = 0; 62 const ProvidedFileSystemInfo& file_system_info,
63 const ObservedEntries& observed_entries) = 0;
71 }; 64 };
72 65
73 } // namespace file_system_provider 66 } // namespace file_system_provider
74 } // namespace chromeos 67 } // namespace chromeos
75 68
76 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_OBS ERVER_H_ 69 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_OBS ERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698