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

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

Issue 674413002: [fsp] Rename ObserveEntry with AddWatcher. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 6 years, 1 month 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
(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_OBSERVED_ENTRY_H_
6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OBSERVED_ENTRY_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 ObservedEntry;
19 struct Subscriber;
20
21 // Key for storing an observed entry in the map. There may be two observers
22 // per path, as long as one is recursive, and the other one not.
23 struct ObservedEntryKey {
24 ObservedEntryKey(const base::FilePath& entry_path, bool recursive);
25 ~ObservedEntryKey();
26
27 struct Comparator {
28 bool operator()(const ObservedEntryKey& a, const ObservedEntryKey& b) const;
29 };
30
31 base::FilePath entry_path;
32 bool recursive;
33 };
34
35 // List of observed entries.
36 typedef std::map<ObservedEntryKey, ObservedEntry, ObservedEntryKey::Comparator>
37 ObservedEntries;
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 // Origin of the subscriber.
49 GURL origin;
50
51 // Whether the subscriber should be restored after shutdown or not.
52 bool persistent;
53 };
54
55 // Represents an observed entry on a file system.
56 struct ObservedEntry {
57 ObservedEntry();
58 ~ObservedEntry();
59
60 // Map of subscribers for notifications of the observed entry.
61 Subscribers subscribers;
62
63 // Path of the observed entry.
64 base::FilePath entry_path;
65
66 // Whether observing is recursive or not.
67 bool recursive;
68
69 // Tag of the last notification for this observed entry. May be empty if not
70 // supported.
71 std::string last_tag;
72 };
73
74 } // namespace file_system_provider
75 } // namespace chromeos
76
77 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OBSERVED_ENTRY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698