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

Side by Side Diff: chrome/browser/prefs/pref_service_builder.h

Issue 12163003: Add FilePath to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 months 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/prefs/pref_service.h ('k') | chrome/browser/prefs/pref_service_simple.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/prefs/persistent_pref_store.h" 11 #include "base/prefs/persistent_pref_store.h"
12 #include "base/prefs/pref_store.h" 12 #include "base/prefs/pref_store.h"
13 13
14 class FilePath;
15 class PrefServiceSimple; 14 class PrefServiceSimple;
16 15
17 namespace base { 16 namespace base {
17 class FilePath;
18 class SequencedTaskRunner; 18 class SequencedTaskRunner;
19 } 19 }
20 20
21 // A class that allows convenient building of PrefService. 21 // A class that allows convenient building of PrefService.
22 class PrefServiceBuilder { 22 class PrefServiceBuilder {
23 public: 23 public:
24 PrefServiceBuilder(); 24 PrefServiceBuilder();
25 virtual ~PrefServiceBuilder(); 25 virtual ~PrefServiceBuilder();
26 26
27 // Functions for setting the various parameters of the PrefService to build. 27 // Functions for setting the various parameters of the PrefService to build.
28 // These take ownership of the |store| parameter. 28 // These take ownership of the |store| parameter.
29 PrefServiceBuilder& WithManagedPrefs(PrefStore* store); 29 PrefServiceBuilder& WithManagedPrefs(PrefStore* store);
30 PrefServiceBuilder& WithExtensionPrefs(PrefStore* store); 30 PrefServiceBuilder& WithExtensionPrefs(PrefStore* store);
31 PrefServiceBuilder& WithCommandLinePrefs(PrefStore* store); 31 PrefServiceBuilder& WithCommandLinePrefs(PrefStore* store);
32 PrefServiceBuilder& WithUserPrefs(PersistentPrefStore* store); 32 PrefServiceBuilder& WithUserPrefs(PersistentPrefStore* store);
33 PrefServiceBuilder& WithRecommendedPrefs(PrefStore* store); 33 PrefServiceBuilder& WithRecommendedPrefs(PrefStore* store);
34 34
35 // Sets up error callback for the PrefService. A do-nothing default 35 // Sets up error callback for the PrefService. A do-nothing default
36 // is provided if this is not called. 36 // is provided if this is not called.
37 PrefServiceBuilder& WithReadErrorCallback( 37 PrefServiceBuilder& WithReadErrorCallback(
38 const base::Callback<void(PersistentPrefStore::PrefReadError)>& 38 const base::Callback<void(PersistentPrefStore::PrefReadError)>&
39 read_error_callback); 39 read_error_callback);
40 40
41 // Specifies to use an actual file-backed user pref store. 41 // Specifies to use an actual file-backed user pref store.
42 PrefServiceBuilder& WithUserFilePrefs( 42 PrefServiceBuilder& WithUserFilePrefs(
43 const FilePath& prefs_file, 43 const base::FilePath& prefs_file,
44 base::SequencedTaskRunner* task_runner); 44 base::SequencedTaskRunner* task_runner);
45 45
46 PrefServiceBuilder& WithAsync(bool async); 46 PrefServiceBuilder& WithAsync(bool async);
47 47
48 // Creates a PrefServiceSimple object initialized with the 48 // Creates a PrefServiceSimple object initialized with the
49 // parameters from this builder. 49 // parameters from this builder.
50 virtual PrefServiceSimple* CreateSimple(); 50 virtual PrefServiceSimple* CreateSimple();
51 51
52 protected: 52 protected:
53 virtual void ResetDefaultState(); 53 virtual void ResetDefaultState();
54 54
55 scoped_refptr<PrefStore> managed_prefs_; 55 scoped_refptr<PrefStore> managed_prefs_;
56 scoped_refptr<PrefStore> extension_prefs_; 56 scoped_refptr<PrefStore> extension_prefs_;
57 scoped_refptr<PrefStore> command_line_prefs_; 57 scoped_refptr<PrefStore> command_line_prefs_;
58 scoped_refptr<PersistentPrefStore> user_prefs_; 58 scoped_refptr<PersistentPrefStore> user_prefs_;
59 scoped_refptr<PrefStore> recommended_prefs_; 59 scoped_refptr<PrefStore> recommended_prefs_;
60 60
61 base::Callback<void(PersistentPrefStore::PrefReadError)> read_error_callback_; 61 base::Callback<void(PersistentPrefStore::PrefReadError)> read_error_callback_;
62 62
63 // Defaults to false. 63 // Defaults to false.
64 bool async_; 64 bool async_;
65 65
66 private: 66 private:
67 DISALLOW_COPY_AND_ASSIGN(PrefServiceBuilder); 67 DISALLOW_COPY_AND_ASSIGN(PrefServiceBuilder);
68 }; 68 };
69 69
70 #endif // CHROME_BROWSER_PREFS_PREF_SERVICE_BUILDER_H_ 70 #endif // CHROME_BROWSER_PREFS_PREF_SERVICE_BUILDER_H_
OLDNEW
« no previous file with comments | « chrome/browser/prefs/pref_service.h ('k') | chrome/browser/prefs/pref_service_simple.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698