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_FILESYSTEM_PUBLIC_CPP_PREFS_FILESYSTEM_JSON_PREF_STORE_H_ | 5 #ifndef COMPONENTS_FILESYSTEM_PUBLIC_CPP_PREFS_FILESYSTEM_JSON_PREF_STORE_H_ |
6 #define COMPONENTS_FILESYSTEM_PUBLIC_CPP_PREFS_FILESYSTEM_JSON_PREF_STORE_H_ | 6 #define COMPONENTS_FILESYSTEM_PUBLIC_CPP_PREFS_FILESYSTEM_JSON_PREF_STORE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <set> | 10 #include <set> |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/callback_forward.h" | 13 #include "base/callback_forward.h" |
14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
15 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
16 #include "base/gtest_prod_util.h" | 16 #include "base/gtest_prod_util.h" |
17 #include "base/macros.h" | 17 #include "base/macros.h" |
18 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
19 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
20 #include "base/observer_list.h" | 20 #include "base/observer_list.h" |
21 #include "base/prefs/base_prefs_export.h" | |
22 #include "base/prefs/persistent_pref_store.h" | |
23 #include "base/prefs/pref_filter.h" | |
24 #include "base/threading/non_thread_safe.h" | 21 #include "base/threading/non_thread_safe.h" |
25 #include "components/filesystem/public/interfaces/directory.mojom.h" | 22 #include "components/filesystem/public/interfaces/directory.mojom.h" |
26 #include "components/filesystem/public/interfaces/file.mojom.h" | 23 #include "components/filesystem/public/interfaces/file.mojom.h" |
27 #include "components/filesystem/public/interfaces/file_system.mojom.h" | 24 #include "components/filesystem/public/interfaces/file_system.mojom.h" |
28 #include "components/filesystem/public/interfaces/types.mojom.h" | 25 #include "components/filesystem/public/interfaces/types.mojom.h" |
| 26 #include "components/prefs/base_prefs_export.h" |
| 27 #include "components/prefs/persistent_pref_store.h" |
| 28 #include "components/prefs/pref_filter.h" |
29 #include "mojo/public/cpp/bindings/binding.h" | 29 #include "mojo/public/cpp/bindings/binding.h" |
30 | 30 |
31 class PrefFilter; | 31 class PrefFilter; |
32 | 32 |
33 namespace base { | 33 namespace base { |
34 class Clock; | 34 class Clock; |
35 class DictionaryValue; | 35 class DictionaryValue; |
36 class FilePath; | 36 class FilePath; |
37 class JsonPrefStoreLossyWriteTest; | 37 class JsonPrefStoreLossyWriteTest; |
38 class Value; | 38 class Value; |
39 } | 39 } |
40 | 40 |
41 namespace filesystem { | 41 namespace filesystem { |
42 | 42 |
43 // A forked, hack'n'slashed copy of base::JsonPrefStore which writes its | 43 // A forked, hack'n'slashed copy of base::JsonPrefStore which writes its |
44 // preference data to the mojo filesystem instead of the real | 44 // preference data to the mojo filesystem instead of the real |
45 // filesystem. Unlike base::JsonPrefStore, this class can safely be used inside | 45 // filesystem. Unlike base::JsonPrefStore, this class can safely be used inside |
46 // a sandboxed process. | 46 // a sandboxed process. |
47 // | 47 // |
48 // In the long run, we'll want to replace the current base::PrefService code | 48 // In the long run, we'll want to replace the current PrefService code with |
49 // with something very different, especially since this component hard punts on | 49 // something very different, especially since this component hard punts on all |
50 // all the hard things that the preference service does (enterprise management, | 50 // the hard things that the preference service does (enterprise management, |
51 // parental controls, extension integration, etc.) and its interface is really | 51 // parental controls, extension integration, etc.) and its interface is really |
52 // not optimal for a mojoified world--there are a few places where we assume | 52 // not optimal for a mojoified world--there are a few places where we assume |
53 // that writing to disk is synchronous...but it no longer is! | 53 // that writing to disk is synchronous...but it no longer is! |
54 // | 54 // |
55 // Removing this class is a part of crbug.com/580652. | 55 // Removing this class is a part of crbug.com/580652. |
56 class FilesystemJsonPrefStore | 56 class FilesystemJsonPrefStore |
57 : public PersistentPrefStore, | 57 : public PersistentPrefStore, |
58 public filesystem::FileSystemClient, | 58 public filesystem::FileSystemClient, |
59 public base::SupportsWeakPtr<FilesystemJsonPrefStore>, | 59 public base::SupportsWeakPtr<FilesystemJsonPrefStore>, |
60 public base::NonThreadSafe { | 60 public base::NonThreadSafe { |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 bool filtering_in_progress_; | 168 bool filtering_in_progress_; |
169 bool pending_lossy_write_; | 169 bool pending_lossy_write_; |
170 PrefReadError read_error_; | 170 PrefReadError read_error_; |
171 | 171 |
172 DISALLOW_COPY_AND_ASSIGN(FilesystemJsonPrefStore); | 172 DISALLOW_COPY_AND_ASSIGN(FilesystemJsonPrefStore); |
173 }; | 173 }; |
174 | 174 |
175 } // namespace filesystem | 175 } // namespace filesystem |
176 | 176 |
177 #endif // COMPONENTS_FILESYSTEM_PUBLIC_CPP_PREFS_FILESYSTEM_JSON_PREF_STORE_H_ | 177 #endif // COMPONENTS_FILESYSTEM_PUBLIC_CPP_PREFS_FILESYSTEM_JSON_PREF_STORE_H_ |
OLD | NEW |