OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_WATCHER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_WATCHER_H_ |
| 7 |
| 8 #include <map> |
| 9 #include <set> |
| 10 #include <string> |
| 11 |
| 12 #include "base/files/file_path.h" |
| 13 #include "url/gurl.h" |
| 14 |
| 15 namespace chromeos { |
| 16 namespace file_system_provider { |
| 17 |
| 18 struct Watcher; |
| 19 struct Subscriber; |
| 20 |
| 21 // Key for storing a watcher in the map. There may be two watchers per path, |
| 22 // as long as one is recursive, and the other one not. |
| 23 struct WatcherKey { |
| 24 WatcherKey(const base::FilePath& entry_path, bool recursive); |
| 25 ~WatcherKey(); |
| 26 |
| 27 struct Comparator { |
| 28 bool operator()(const WatcherKey& a, const WatcherKey& b) const; |
| 29 }; |
| 30 |
| 31 base::FilePath entry_path; |
| 32 bool recursive; |
| 33 }; |
| 34 |
| 35 // List of watchers. |
| 36 typedef std::map<WatcherKey, Watcher, WatcherKey::Comparator> Watchers; |
| 37 |
| 38 // Map of subscribers for notifications about a watcher. |
| 39 typedef std::map<GURL, Subscriber> Subscribers; |
| 40 |
| 41 // Represents a subscriber for notification about a watcher. There may be up to |
| 42 // one subscriber per origin for the same watcher. |
| 43 struct Subscriber { |
| 44 Subscriber(); |
| 45 ~Subscriber(); |
| 46 |
| 47 // Origin of the subscriber. |
| 48 GURL origin; |
| 49 |
| 50 // Whether the subscriber should be restored after shutdown or not. |
| 51 bool persistent; |
| 52 }; |
| 53 |
| 54 // Represents a watcher on a file system. |
| 55 struct Watcher { |
| 56 Watcher(); |
| 57 ~Watcher(); |
| 58 |
| 59 // Map of subscribers for notifications of the watcher. |
| 60 Subscribers subscribers; |
| 61 |
| 62 // Path of the watcher. |
| 63 base::FilePath entry_path; |
| 64 |
| 65 // Whether watching is recursive or not. |
| 66 bool recursive; |
| 67 |
| 68 // Tag of the last notification for this watcher. May be empty if not |
| 69 // supported. |
| 70 std::string last_tag; |
| 71 }; |
| 72 |
| 73 } // namespace file_system_provider |
| 74 } // namespace chromeos |
| 75 |
| 76 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_WATCHER_H_ |
OLD | NEW |