| 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_WATCHER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_WATCHER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_WATCHER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_WATCHER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/callback.h" |
| 12 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 14 #include "storage/browser/fileapi/watcher_manager.h" |
| 13 #include "url/gurl.h" | 15 #include "url/gurl.h" |
| 14 | 16 |
| 15 namespace chromeos { | 17 namespace chromeos { |
| 16 namespace file_system_provider { | 18 namespace file_system_provider { |
| 17 | 19 |
| 18 struct Watcher; | 20 struct Watcher; |
| 19 struct Subscriber; | 21 struct Subscriber; |
| 20 | 22 |
| 21 // Key for storing a watcher in the map. There may be two watchers per path, | 23 // 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. | 24 // as long as one is recursive, and the other one not. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 42 // one subscriber per origin for the same watcher. | 44 // one subscriber per origin for the same watcher. |
| 43 struct Subscriber { | 45 struct Subscriber { |
| 44 Subscriber(); | 46 Subscriber(); |
| 45 ~Subscriber(); | 47 ~Subscriber(); |
| 46 | 48 |
| 47 // Origin of the subscriber. | 49 // Origin of the subscriber. |
| 48 GURL origin; | 50 GURL origin; |
| 49 | 51 |
| 50 // Whether the subscriber should be restored after shutdown or not. | 52 // Whether the subscriber should be restored after shutdown or not. |
| 51 bool persistent; | 53 bool persistent; |
| 54 |
| 55 // Callback to be called for each watcher notification. It's optional, but |
| 56 // not allowed for persistent watchers. In case of persistent subscribers, |
| 57 // the notification should be handled using observers, as the callback can't |
| 58 // be restored after shutdown. |
| 59 storage::WatcherManager::NotificationCallback notification_callback; |
| 52 }; | 60 }; |
| 53 | 61 |
| 54 // Represents a watcher on a file system. | 62 // Represents a watcher on a file system. |
| 55 struct Watcher { | 63 struct Watcher { |
| 56 Watcher(); | 64 Watcher(); |
| 57 ~Watcher(); | 65 ~Watcher(); |
| 58 | 66 |
| 59 // Map of subscribers for notifications of the watcher. | 67 // Map of subscribers for notifications of the watcher. |
| 60 Subscribers subscribers; | 68 Subscribers subscribers; |
| 61 | 69 |
| 62 // Path of the watcher. | 70 // Path of the watcher. |
| 63 base::FilePath entry_path; | 71 base::FilePath entry_path; |
| 64 | 72 |
| 65 // Whether watching is recursive or not. | 73 // Whether watching is recursive or not. |
| 66 bool recursive; | 74 bool recursive; |
| 67 | 75 |
| 68 // Tag of the last notification for this watcher. May be empty if not | 76 // Tag of the last notification for this watcher. May be empty if not |
| 69 // supported. | 77 // supported. |
| 70 std::string last_tag; | 78 std::string last_tag; |
| 71 }; | 79 }; |
| 72 | 80 |
| 73 } // namespace file_system_provider | 81 } // namespace file_system_provider |
| 74 } // namespace chromeos | 82 } // namespace chromeos |
| 75 | 83 |
| 76 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_WATCHER_H_ | 84 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_WATCHER_H_ |
| OLD | NEW |