OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 COMPONENTS_METRICS_FILE_METRICS_PROVIDER_H_ | 5 #ifndef COMPONENTS_METRICS_FILE_METRICS_PROVIDER_H_ |
6 #define COMPONENTS_METRICS_FILE_METRICS_PROVIDER_H_ | 6 #define COMPONENTS_METRICS_FILE_METRICS_PROVIDER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 }; | 83 }; |
84 | 84 |
85 FileMetricsProvider(const scoped_refptr<base::TaskRunner>& task_runner, | 85 FileMetricsProvider(const scoped_refptr<base::TaskRunner>& task_runner, |
86 PrefService* local_state); | 86 PrefService* local_state); |
87 ~FileMetricsProvider() override; | 87 ~FileMetricsProvider() override; |
88 | 88 |
89 // Indicates a file or directory to be monitored and how the file or files | 89 // Indicates a file or directory to be monitored and how the file or files |
90 // within that directory are used. Because some metadata may need to persist | 90 // within that directory are used. Because some metadata may need to persist |
91 // across process restarts, preferences entries are used based on the | 91 // across process restarts, preferences entries are used based on the |
92 // |prefs_key| name. Call RegisterPrefs() with the same name to create the | 92 // |prefs_key| name. Call RegisterPrefs() with the same name to create the |
93 // necessary keys in advance. Set |prefs_key| empty if no persistence is | 93 // necessary keys in advance. Set |prefs_key| empty (nullptr will work) if |
94 // required. | 94 // no persistence is required. ACTIVE files shouldn't have a pref key as |
| 95 // they update internal state about what has been previously sent. |
95 void RegisterSource(const base::FilePath& path, | 96 void RegisterSource(const base::FilePath& path, |
96 SourceType type, | 97 SourceType type, |
97 SourceAssociation source_association, | 98 SourceAssociation source_association, |
98 const base::StringPiece prefs_key); | 99 const base::StringPiece prefs_key); |
99 | 100 |
100 // Registers all necessary preferences for maintaining persistent state | 101 // Registers all necessary preferences for maintaining persistent state |
101 // about a monitored file across process restarts. The |prefs_key| is | 102 // about a monitored file across process restarts. The |prefs_key| is |
102 // typically the filename. | 103 // typically the filename. |
103 static void RegisterPrefs(PrefRegistrySimple* prefs, | 104 static void RegisterPrefs(PrefRegistrySimple* prefs, |
104 const base::StringPiece prefs_key); | 105 const base::StringPiece prefs_key); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 | 200 |
200 base::ThreadChecker thread_checker_; | 201 base::ThreadChecker thread_checker_; |
201 base::WeakPtrFactory<FileMetricsProvider> weak_factory_; | 202 base::WeakPtrFactory<FileMetricsProvider> weak_factory_; |
202 | 203 |
203 DISALLOW_COPY_AND_ASSIGN(FileMetricsProvider); | 204 DISALLOW_COPY_AND_ASSIGN(FileMetricsProvider); |
204 }; | 205 }; |
205 | 206 |
206 } // namespace metrics | 207 } // namespace metrics |
207 | 208 |
208 #endif // COMPONENTS_METRICS_FILE_METRICS_PROVIDER_H_ | 209 #endif // COMPONENTS_METRICS_FILE_METRICS_PROVIDER_H_ |
OLD | NEW |