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 <set> | |
9 #include <string> | 10 #include <string> |
10 | 11 |
11 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
13 #include "url/gurl.h" | |
12 | 14 |
13 namespace chromeos { | 15 namespace chromeos { |
14 namespace file_system_provider { | 16 namespace file_system_provider { |
15 | 17 |
16 struct ObservedEntry; | 18 struct ObservedEntry; |
19 struct Subscriber; | |
17 | 20 |
18 // Key for storing an observed entry in the map. There may be two observers | 21 // 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. | 22 // per path, as long as one is recursive, and the other one not. |
20 struct ObservedEntryKey { | 23 struct ObservedEntryKey { |
21 ObservedEntryKey(const base::FilePath& entry_path, bool recursive); | 24 ObservedEntryKey(const base::FilePath& entry_path, bool recursive); |
22 ~ObservedEntryKey(); | 25 ~ObservedEntryKey(); |
23 | 26 |
24 struct Comparator { | 27 struct Comparator { |
25 bool operator()(const ObservedEntryKey& a, const ObservedEntryKey& b) const; | 28 bool operator()(const ObservedEntryKey& a, const ObservedEntryKey& b) const; |
26 }; | 29 }; |
27 | 30 |
28 base::FilePath entry_path; | 31 base::FilePath entry_path; |
29 bool recursive; | 32 bool recursive; |
30 }; | 33 }; |
31 | 34 |
32 // List of observed entries. | 35 // List of observed entries. |
33 typedef std::map<ObservedEntryKey, ObservedEntry, ObservedEntryKey::Comparator> | 36 typedef std::map<ObservedEntryKey, ObservedEntry, ObservedEntryKey::Comparator> |
34 ObservedEntries; | 37 ObservedEntries; |
35 | 38 |
39 // Map of subscribers for notifications about an observed entry. | |
40 typedef std::map<GURL, Subscriber> Subscribers; | |
41 | |
42 // Represents a subscriber for notification about an observed entry. There may | |
43 // be up to one subscriber per origin for the same observed entry. | |
44 struct Subscriber { | |
45 Subscriber(); | |
46 ~Subscriber(); | |
47 | |
48 GURL origin; | |
49 bool persistent; | |
hirono
2014/10/27 04:50:31
Could you add a comment about what persistent mean
mtomasz
2014/10/27 05:01:18
Done.
| |
50 }; | |
51 | |
36 // Represents an observed entry on a file system. | 52 // Represents an observed entry on a file system. |
37 struct ObservedEntry { | 53 struct ObservedEntry { |
38 ObservedEntry(); | 54 ObservedEntry(); |
39 ~ObservedEntry(); | 55 ~ObservedEntry(); |
40 | 56 |
57 // Map of subscribers for notifications of the observed entry. | |
58 Subscribers subscribers; | |
59 | |
60 // Path of the observed entry. | |
41 base::FilePath entry_path; | 61 base::FilePath entry_path; |
62 | |
63 // Whether observing is recursive or not. | |
42 bool recursive; | 64 bool recursive; |
65 | |
66 // Tag of the last notification for this observed entry. May be empty if not | |
67 // supported. | |
43 std::string last_tag; | 68 std::string last_tag; |
44 }; | 69 }; |
45 | 70 |
46 } // namespace file_system_provider | 71 } // namespace file_system_provider |
47 } // namespace chromeos | 72 } // namespace chromeos |
48 | 73 |
49 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OBSERVED_ENTRY_H_ | 74 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OBSERVED_ENTRY_H_ |
OLD | NEW |