OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_PREFS_PREF_SERVICE_BUILDER_H_ | 5 #ifndef CHROME_BROWSER_PREFS_PREF_SERVICE_BUILDER_H_ |
6 #define CHROME_BROWSER_PREFS_PREF_SERVICE_BUILDER_H_ | 6 #define CHROME_BROWSER_PREFS_PREF_SERVICE_BUILDER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_ptr.h" | |
11 #include "base/prefs/persistent_pref_store.h" | 12 #include "base/prefs/persistent_pref_store.h" |
12 #include "base/prefs/pref_store.h" | 13 #include "base/prefs/pref_store.h" |
14 #include "chrome/browser/prefs/pref_registry.h" | |
13 | 15 |
14 class FilePath; | 16 class FilePath; |
15 class PrefServiceSimple; | 17 class PrefService; |
16 | 18 |
17 namespace base { | 19 namespace base { |
18 class SequencedTaskRunner; | 20 class SequencedTaskRunner; |
19 } | 21 } |
20 | 22 |
21 // A class that allows convenient building of PrefService. | 23 // A class that allows convenient building of PrefService. |
22 class PrefServiceBuilder { | 24 class PrefServiceBuilder { |
23 public: | 25 public: |
24 PrefServiceBuilder(); | 26 PrefServiceBuilder(); |
25 virtual ~PrefServiceBuilder(); | 27 virtual ~PrefServiceBuilder(); |
(...skipping 12 matching lines...) Expand all Loading... | |
38 const base::Callback<void(PersistentPrefStore::PrefReadError)>& | 40 const base::Callback<void(PersistentPrefStore::PrefReadError)>& |
39 read_error_callback); | 41 read_error_callback); |
40 | 42 |
41 // Specifies to use an actual file-backed user pref store. | 43 // Specifies to use an actual file-backed user pref store. |
42 PrefServiceBuilder& WithUserFilePrefs( | 44 PrefServiceBuilder& WithUserFilePrefs( |
43 const FilePath& prefs_file, | 45 const FilePath& prefs_file, |
44 base::SequencedTaskRunner* task_runner); | 46 base::SequencedTaskRunner* task_runner); |
45 | 47 |
46 PrefServiceBuilder& WithAsync(bool async); | 48 PrefServiceBuilder& WithAsync(bool async); |
47 | 49 |
48 // Creates a PrefServiceSimple object initialized with the | 50 // Creates a PrefService object initialized with the parameters from |
49 // parameters from this builder. | 51 // this builder. The PrefService takes ownership of the PrefRegistry |
50 virtual PrefServiceSimple* CreateSimple(); | 52 // object. |
53 virtual PrefService* Create(scoped_ptr<PrefRegistry> registry); | |
Mattias Nissler (ping if slow)
2013/01/25 14:57:11
Hm, it's a bit inconsistent to single out the regi
Jói
2013/01/29 16:10:02
Initially I did this mainly to clarify the "pass o
| |
51 | 54 |
52 protected: | 55 protected: |
53 virtual void ResetDefaultState(); | 56 virtual void ResetDefaultState(); |
54 | 57 |
55 scoped_refptr<PrefStore> managed_prefs_; | 58 scoped_refptr<PrefStore> managed_prefs_; |
56 scoped_refptr<PrefStore> extension_prefs_; | 59 scoped_refptr<PrefStore> extension_prefs_; |
57 scoped_refptr<PrefStore> command_line_prefs_; | 60 scoped_refptr<PrefStore> command_line_prefs_; |
58 scoped_refptr<PersistentPrefStore> user_prefs_; | 61 scoped_refptr<PersistentPrefStore> user_prefs_; |
59 scoped_refptr<PrefStore> recommended_prefs_; | 62 scoped_refptr<PrefStore> recommended_prefs_; |
60 | 63 |
61 base::Callback<void(PersistentPrefStore::PrefReadError)> read_error_callback_; | 64 base::Callback<void(PersistentPrefStore::PrefReadError)> read_error_callback_; |
62 | 65 |
63 // Defaults to false. | 66 // Defaults to false. |
64 bool async_; | 67 bool async_; |
65 | 68 |
66 private: | 69 private: |
67 DISALLOW_COPY_AND_ASSIGN(PrefServiceBuilder); | 70 DISALLOW_COPY_AND_ASSIGN(PrefServiceBuilder); |
68 }; | 71 }; |
69 | 72 |
70 #endif // CHROME_BROWSER_PREFS_PREF_SERVICE_BUILDER_H_ | 73 #endif // CHROME_BROWSER_PREFS_PREF_SERVICE_BUILDER_H_ |
OLD | NEW |