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_OBSERVED_ENTRY_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OBSERVED_ENTRY_H_ |
6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OBSERVED_ENTRY_H_ | 6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OBSERVED_ENTRY_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 | 12 |
13 namespace chromeos { | 13 namespace chromeos { |
14 namespace file_system_provider { | 14 namespace file_system_provider { |
15 | 15 |
16 struct ObservedEntry; | 16 struct ObservedEntry; |
17 | 17 |
| 18 // Key for storing an observed entry in the map. There may be two observers |
| 19 // per path, as long as one is recursive, and the other one not. |
| 20 struct ObservedEntryKey { |
| 21 ObservedEntryKey(const base::FilePath& entry_path, bool recursive); |
| 22 ~ObservedEntryKey(); |
| 23 |
| 24 struct Comparator { |
| 25 bool operator()(const ObservedEntryKey& a, const ObservedEntryKey& b) const; |
| 26 }; |
| 27 |
| 28 base::FilePath entry_path; |
| 29 bool recursive; |
| 30 }; |
| 31 |
18 // List of observed entries. | 32 // List of observed entries. |
19 typedef std::map<base::FilePath, ObservedEntry> ObservedEntries; | 33 typedef std::map<ObservedEntryKey, ObservedEntry, ObservedEntryKey::Comparator> |
| 34 ObservedEntries; |
20 | 35 |
21 // Represents an observed entry on a file system. | 36 // Represents an observed entry on a file system. |
22 struct ObservedEntry { | 37 struct ObservedEntry { |
23 ObservedEntry(); | 38 ObservedEntry(); |
24 ~ObservedEntry(); | 39 ~ObservedEntry(); |
25 | 40 |
26 base::FilePath entry_path; | 41 base::FilePath entry_path; |
27 bool recursive; | 42 bool recursive; |
28 std::string last_tag; | 43 std::string last_tag; |
29 }; | 44 }; |
30 | 45 |
31 } // namespace file_system_provider | 46 } // namespace file_system_provider |
32 } // namespace chromeos | 47 } // namespace chromeos |
33 | 48 |
34 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OBSERVED_ENTRY_H_ | 49 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OBSERVED_ENTRY_H_ |
OLD | NEW |